Ticket #8326: scumm-x11-1.diff

File scumm-x11-1.diff, 2.1 KB (added by SF/gjasny, 20 years ago)

Patch No. 1

  • backends/x11/x11.cpp

    RCS file: /cvsroot/scummvm/scummvm/backends/x11/x11.cpp,v
    retrieving revision 1.21
    diff -u -3 -p -r1.21 x11.cpp
     
    2222
    2323/* The bare pure X11 port done by Lionel 'BBrox' Ulmer */
    2424
     25#include "common/stdafx.h"
    2526#include "backends/intern.h"
    2627#include "common/util.h"
    2728#include "base/engine.h"        // Only #included for error() and warning()
    private:  
    166167        uint16 *palette;
    167168        bool _palette_changed;
    168169        Display *display;
    169         int screen;
     170        int screen, depth;
    170171        Window window;
    171172        GC black_gc;
    172173        XImage *image;
    OSystem_X11::OSystem_X11()  
    352353                error("Could not open display !\n");
    353354                exit(1);
    354355        }
     356
     357        if (XShmQueryExtension(display)!=True)
     358                error("No Shared Memory Extension present");
     359       
    355360        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);
    356364
    357365        window_width = 320;
    358366        window_height = 200;
    void OSystem_X11::init_size(uint w, uint  
    425433
    426434                XConfigureWindow(display, window, CWWidth | CWHeight, &new_values);
    427435        }
    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);
    432446        shminfo.readOnly = False;
    433447        if (XShmAttach(display, &shminfo) == 0) {
    434448                error("Could not attach shared memory segment !\n");