From 3ce8734c49de6a2ddab6ed41cfa323a4f2f21cc8 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 6 Jun 2011 08:23:46 +0000 Subject: Changed to use default visuals and depths. --- xd.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/xd.c b/xd.c index 52a694a..ff4b3c9 100644 --- a/xd.c +++ b/xd.c @@ -259,7 +259,6 @@ static Pixmap pix=None; static Pixmap saved=None; static GC gc=None; static Display *disp=NULL; -static XVisualInfo visual; static XFontStruct *font=NULL; static int width; static int height; @@ -491,6 +490,9 @@ static void Bounce(int *x, int *y, int *ix, int *iy) */ static void OpenX(void) { + /* XVisualInfo visual_info; */ + Visual *visual; + int depth; XGCValues gc_val; XSizeHints hint; int f; @@ -502,13 +504,18 @@ static void OpenX(void) Error("Couldn't open X display"); } - if (!XMatchVisualInfo(disp,DefaultScreen(disp),32,TrueColor,&visual) && - !XMatchVisualInfo(disp,DefaultScreen(disp),24,TrueColor,&visual) && - !XMatchVisualInfo(disp,DefaultScreen(disp),16,TrueColor,&visual) && - !XMatchVisualInfo(disp,DefaultScreen(disp),15,TrueColor,&visual)) + /* + if (!XMatchVisualInfo(disp,DefaultScreen(disp),32,TrueColor,&visual_info) && + !XMatchVisualInfo(disp,DefaultScreen(disp),24,TrueColor,&visual_info) && + !XMatchVisualInfo(disp,DefaultScreen(disp),16,TrueColor,&visual_info) && + !XMatchVisualInfo(disp,DefaultScreen(disp),15,TrueColor,&visual_info)) { Error("Couldn't find a visual"); } + */ + + visual = DefaultVisual(disp, DefaultScreen(disp)); + depth = DefaultDepth(disp, DefaultScreen(disp)); font=XLoadQueryFont(disp,"fixed"); @@ -522,12 +529,10 @@ static void OpenX(void) if (!use_root) { - win=XCreateWindow(disp,DefaultRootWindow(disp), - 0,0,width,height,0, - visual.depth, - InputOutput, - visual.visual, - 0,NULL); + win=XCreateWindow + (disp, DefaultRootWindow(disp), + 0, 0, width, height, 0, + depth, InputOutput, visual, 0, NULL); } else { @@ -555,8 +560,8 @@ static void OpenX(void) XSetWMNormalHints(disp,win,&hint); - pix=XCreatePixmap(disp,win,width,height,visual.depth); - saved=XCreatePixmap(disp,win,width,height,visual.depth); + pix=XCreatePixmap(disp,win,width,height,depth); + saved=XCreatePixmap(disp,win,width,height,depth); gc_val.function=GXcopy; gc_val.plane_mask=AllPlanes; -- cgit v1.2.3