RCS file: /cvsroot/scummvm/scummvm/backends/x11/x11.cpp,v
retrieving revision 1.21
diff -u -3 -p -r1.21 x11.cpp
|
|
|
22 | 22 | |
23 | 23 | /* The bare pure X11 port done by Lionel 'BBrox' Ulmer */ |
24 | 24 | |
| 25 | #include "common/stdafx.h" |
25 | 26 | #include "backends/intern.h" |
26 | 27 | #include "common/util.h" |
27 | 28 | #include "base/engine.h" // Only #included for error() and warning() |
… |
… |
private:
|
166 | 167 | uint16 *palette; |
167 | 168 | bool _palette_changed; |
168 | 169 | Display *display; |
169 | | int screen; |
| 170 | int screen, depth; |
170 | 171 | Window window; |
171 | 172 | GC black_gc; |
172 | 173 | XImage *image; |
… |
… |
OSystem_X11::OSystem_X11()
|
352 | 353 | error("Could not open display !\n"); |
353 | 354 | exit(1); |
354 | 355 | } |
| 356 | |
| 357 | if (XShmQueryExtension(display)!=True) |
| 358 | error("No Shared Memory Extension present"); |
| 359 | |
355 | 360 | screen = DefaultScreen(display); |
| 361 | depth = DefaultDepth(display,screen); |
| 362 | if (depth != 16) |
| 363 | error("Your screen depth is %ibit. Values other than 16bit are currently not supported", depth); |
356 | 364 | |
357 | 365 | window_width = 320; |
358 | 366 | window_height = 200; |
… |
… |
void OSystem_X11::init_size(uint w, uint
|
425 | 433 | |
426 | 434 | XConfigureWindow(display, window, CWWidth | CWHeight, &new_values); |
427 | 435 | } |
428 | | image = XShmCreateImage(display, DefaultVisual(display, screen), 16, ZPixmap, NULL, &shminfo, fb_width, fb_height); |
429 | | shminfo.shmid = shmget(IPC_PRIVATE, fb_width * fb_height * 2, IPC_CREAT | 0700); |
430 | | shminfo.shmaddr = (char *)shmat(shminfo.shmid, 0, 0); |
431 | | image->data = shminfo.shmaddr; |
| 436 | |
| 437 | image = XShmCreateImage(display, DefaultVisual(display, screen), depth, ZPixmap, NULL, &shminfo, fb_width, fb_height); |
| 438 | if (!image) |
| 439 | error("Couldn't get image by XShmCreateImage()"); |
| 440 | |
| 441 | shminfo.shmid = shmget(IPC_PRIVATE, image->bytes_per_line * image->height, IPC_CREAT | 0700); |
| 442 | if (shminfo.shmid < 0) |
| 443 | error("Couldn't allocate image data by shmget()"); |
| 444 | |
| 445 | image->data = shminfo.shmaddr = (char *)shmat(shminfo.shmid, 0, 0); |
432 | 446 | shminfo.readOnly = False; |
433 | 447 | if (XShmAttach(display, &shminfo) == 0) { |
434 | 448 | error("Could not attach shared memory segment !\n"); |