| 197 |
XFree((char *)hints); |
XFree((char *)hints); |
| 198 |
} |
} |
| 199 |
|
|
| 200 |
|
// 1-bit mode is big-endian; if the X server is little-endian, we can't |
| 201 |
|
// use SHM because that doesn't allow changing the image byte order |
| 202 |
|
bool need_msb_image = (depth == 1 && XImageByteOrder(x_display) == LSBFirst); |
| 203 |
|
|
| 204 |
// Try to create and attach SHM image |
// Try to create and attach SHM image |
| 205 |
have_shm = false; |
have_shm = false; |
| 206 |
if (local_X11 && depth != 1 && XShmQueryExtension(x_display)) { |
if (local_X11 && !need_msb_image && XShmQueryExtension(x_display)) { |
| 207 |
|
|
| 208 |
// Create SHM image ("height + 2" for safety) |
// Create SHM image ("height + 2" for safety) |
| 209 |
img = XShmCreateImage(x_display, vis, depth, depth == 1 ? XYBitmap : ZPixmap, 0, &shminfo, width, height); |
img = XShmCreateImage(x_display, vis, depth == 1 ? 1 : xdepth, depth == 1 ? XYBitmap : ZPixmap, 0, &shminfo, width, height); |
| 210 |
shminfo.shmid = shmget(IPC_PRIVATE, (height + 2) * img->bytes_per_line, IPC_CREAT | 0777); |
shminfo.shmid = shmget(IPC_PRIVATE, (height + 2) * img->bytes_per_line, IPC_CREAT | 0777); |
| 211 |
the_buffer_copy = (uint8 *)shmat(shminfo.shmid, 0, 0); |
the_buffer_copy = (uint8 *)shmat(shminfo.shmid, 0, 0); |
| 212 |
shminfo.shmaddr = img->data = (char *)the_buffer_copy; |
shminfo.shmaddr = img->data = (char *)the_buffer_copy; |