X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fx11.c;h=957443a85c7010fb8cfb150f2e4d4ccda53c4725;hb=b96c3dc500494652748c24f0aa48a8201ea202dd;hp=5b97d5ec66fb18faccc4a0974ef799c54fa9b5d5;hpb=7d958613de0b14e460ebca1a651b73cfadf9213c;p=rocksndiamonds.git diff --git a/src/x11.c b/src/x11.c index 5b97d5ec..957443a8 100644 --- a/src/x11.c +++ b/src/x11.c @@ -69,8 +69,9 @@ static void X11InitDisplay() #endif /* !MSDOS */ } -static void X11InitWindow() +static DrawWindow X11InitWindow() { + Window window; unsigned int border_width = 4; XGCValues gc_values; unsigned long gc_valuemask; @@ -185,17 +186,21 @@ static void X11InitWindow() gc_values.background = pen_bg; gc_valuemask = GCGraphicsExposures | GCForeground | GCBackground; gc = XCreateGC(display, window, gc_valuemask, &gc_values); + + return window; } -inline void X11InitBufferedDisplay(DrawBuffer *unused1, DrawWindow *unused2) +inline void X11InitBufferedDisplay(DrawBuffer *backbuffer, DrawWindow *window) { X11InitDisplay(); - X11InitWindow(); + *window = X11InitWindow(); - XMapWindow(display, window); + XMapWindow(display, *window); FlushDisplay(); - pix[PIX_DB_BACK] = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + /* create additional buffer for double-buffering */ + *backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + pix[PIX_DB_BACK] = *backbuffer; /* 'backbuffer' is off-screen buffer */ } #endif /* USE_X11_LIBRARY */