diff options
Diffstat (limited to 'linux/gfx.c')
-rw-r--r-- | linux/gfx.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/linux/gfx.c b/linux/gfx.c index 01c7f4a..0f0575d 100644 --- a/linux/gfx.c +++ b/linux/gfx.c @@ -52,7 +52,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 curr_func; @@ -430,7 +429,7 @@ Pixmap VIDOOM_GFX_SAVE_UNDER(int x, int y, int w, int h) { Pixmap p; - p=XCreatePixmap(disp,win,w,h,visual.depth); + p=XCreatePixmap(disp,win,w,h,DefaultDepth(disp, DefaultScreen(disp))); XCopyArea(disp,pix,p,gc,x,y,w,h,0,0); return p; @@ -489,17 +488,11 @@ void GFX_init(void) init=TRUE; - /* Open display and find an appropriate visual + /* Open display */ if (!(disp=XOpenDisplay(NULL))) GFX_exit(EXIT_FAILURE,"Couldn't open X display\n"); - 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)) - GFX_exit(EXIT_FAILURE,"Couldn't find a TrueColor visual\n"); - f=0; while(font_names[f] && !font) font=XLoadQueryFont(disp,font_names[f++]); @@ -576,9 +569,9 @@ void GFX_open(int w,int h) win=XCreateWindow(disp,DefaultRootWindow(disp), 0,0,width,height,0, - visual.depth, + DefaultDepth(disp, DefaultScreen(disp)), InputOutput, - visual.visual, + DefaultVisual(disp, DefaultScreen(disp)), 0,NULL); XSelectInput @@ -594,8 +587,10 @@ void GFX_open(int w,int h) 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, + DefaultDepth(disp, DefaultScreen(disp))); + saved=XCreatePixmap(disp,win,width,height, + DefaultDepth(disp, DefaultScreen(disp))); curr_func=gc_val.function=GXcopy; gc_val.plane_mask=AllPlanes; @@ -941,7 +936,8 @@ GFX_IMAGE GFX_create_image(GFX_BITMAP *bm) data=Grab(bm->w*bm->h*4); - i.p=XCreateImage(disp,visual.visual,visual.depth, + i.p=XCreateImage(disp,DefaultVisual(disp, DefaultScreen(disp)), + DefaultDepth(disp, DefaultScreen(disp)), ZPixmap,0,data,bm->w,bm->h,32,4*bm->w); if (!i.p) |