summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xd.c31
1 files 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;