* x11.c *
***********************************************************/
-#ifdef USE_X11_LIBRARY
+#if defined(TARGET_X11)
#include "main.h"
#include "misc.h"
static void X11InitDisplay()
{
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
XVisualInfo vinfo_template, *vinfo;
int num_visuals;
#endif
depth = DefaultDepth(display, screen);
cmap = DefaultColormap(display, screen);
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
/* look for good enough visual */
vinfo_template.screen = screen;
vinfo_template.class = (depth == 8 ? PseudoColor : TrueColor);
printf("Sorry, cannot get appropriate visual.\n");
exit(-1);
}
-#endif /* !MSDOS */
+#endif /* !PLATFORM_MSDOS */
}
-static void X11InitWindow()
+static DrawWindow X11InitWindow()
{
+ Window window;
unsigned int border_width = 4;
XGCValues gc_values;
unsigned long gc_valuemask;
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
XTextProperty windowName, iconName;
Pixmap icon_pixmap, iconmask_pixmap;
unsigned int icon_width, icon_height;
unsigned long pen_bg = BlackPixel(display,screen);
const int width = WIN_XSIZE, height = WIN_YSIZE;
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
static struct IconFileInfo icon_pic =
{
"rocks_icon.xbm",
win_xpos, win_ypos, width, height, border_width,
pen_fg, pen_bg);
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
proto_atom = XInternAtom(display, "WM_PROTOCOLS", FALSE);
delete_atom = XInternAtom(display, "WM_DELETE_WINDOW", FALSE);
if ((proto_atom != None) && (delete_atom != None))
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 */
+#endif /* TARGET_X11 */