From 2b0a8867f035b023490135e76713de4afd9933e0 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 16 Feb 2017 15:46:49 +0000 Subject: Fixed linux build problems. --- Makefile | 2 +- linux/gfx.c | 24 ++++++++++-------------- linux/platgui.c | 23 ++++++++++++----------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index c048fe1..6fc9d14 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ # linux # cygwin-xfree (Same as linux) # -MAKEPLAT=djgpp +MAKEPLAT=linux # 2. Set to the directory where you want to install viDOOM. Note this is not 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) diff --git a/linux/platgui.c b/linux/platgui.c index 5fd9c74..36fbcf8 100644 --- a/linux/platgui.c +++ b/linux/platgui.c @@ -787,11 +787,12 @@ static int CreateFileList(int x, int y, int w, int h, return no; } +static void TextEditInfo(GuiObjTextEdit *o); + static int CreateTextEdit(int x, int y, int w, int h, TextEditLine *lines, int no_lines, int info, int read_only) { - static void TextEditInfo(GuiObjTextEdit *o); int no=dialog_no++; DialCommon(no,GuiTextEdit,x,y,w,h,TRUE); @@ -818,18 +819,18 @@ static int CreateTextEdit(int x, int y, int w, int h, /* ---------------------------------------- DIALOG CALLBACK FUNCTIONS */ +static CallbackReturn BoxCallback(GuiObj *o ,ObjEvent ev); +static CallbackReturn LabelCallback(GuiObj *o,ObjEvent ev); +static CallbackReturn ButtonCallback(GuiObj *o,ObjEvent ev); +static CallbackReturn ToggleCallback(GuiObj *o,ObjEvent ev); +static CallbackReturn RadioCallback(GuiObj *o,ObjEvent ev); +static CallbackReturn ImageListCallback(GuiObj *o,ObjEvent ev); +static CallbackReturn TextCallback(GuiObj *o,ObjEvent ev); +static CallbackReturn FileListCallback(GuiObj *o,ObjEvent ev); +static CallbackReturn TextEditCallback(GuiObj *o,ObjEvent ev); + static CallbackReturn Callback(GuiObj *o, ObjEvent ev) { - static CallbackReturn BoxCallback(GuiObj *o ,ObjEvent ev); - static CallbackReturn LabelCallback(GuiObj *o,ObjEvent ev); - static CallbackReturn ButtonCallback(GuiObj *o,ObjEvent ev); - static CallbackReturn ToggleCallback(GuiObj *o,ObjEvent ev); - static CallbackReturn RadioCallback(GuiObj *o,ObjEvent ev); - static CallbackReturn ImageListCallback(GuiObj *o,ObjEvent ev); - static CallbackReturn TextCallback(GuiObj *o,ObjEvent ev); - static CallbackReturn FileListCallback(GuiObj *o,ObjEvent ev); - static CallbackReturn TextEditCallback(GuiObj *o,ObjEvent ev); - switch(o->common.type) { case GuiBox: -- cgit v1.2.3