From: divverent Date: Sat, 10 Nov 2007 12:00:36 +0000 (+0000) Subject: support vid_resizable in glx X-Git-Tag: xonotic-v0.1.0preview~2800 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4f65024b01337ca14f72f1a2e62b24352ba2adaf;p=xonotic%2Fdarkplaces.git support vid_resizable in glx git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7681 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid_glx.c b/vid_glx.c index 35f70de0..dd7ad346 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -413,6 +413,11 @@ static void HandleEvents(void) // window changed size/location win_x = event.xconfigure.x; win_y = event.xconfigure.y; + if(vid_resizable.integer < 2) + { + vid.width = event.xconfigure.width; + vid.height = event.xconfigure.height; + } break; case DestroyNotify: // window has been destroyed @@ -627,7 +632,8 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate int attrib[32]; XSetWindowAttributes attr; XClassHint *clshints; - XWMHints wmhints; + XWMHints *wmhints; + XSizeHints *szhints; unsigned long mask; Window root; XVisualInfo *visinfo; @@ -766,17 +772,28 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate win = XCreateWindow(vidx11_display, root, 0, 0, width, height, 0, visinfo->depth, InputOutput, visinfo->visual, mask, &attr); - wmhints.flags = 0; + wmhints = XAllocWMHints(); if(XpmCreatePixmapFromData(vidx11_display, win, (gamemode == GAME_NEXUIZ) ? nexuiz_xpm : darkplaces_xpm, - &wmhints.icon_pixmap, &wmhints.icon_mask, NULL) == XpmSuccess) - wmhints.flags |= IconPixmapHint | IconMaskHint; + &wmhints->icon_pixmap, &wmhints->icon_mask, NULL) == XpmSuccess) + wmhints->flags |= IconPixmapHint | IconMaskHint; clshints = XAllocClassHint(); clshints->res_name = strdup(gamename); clshints->res_class = strdup("DarkPlaces"); - XmbSetWMProperties(vidx11_display, win, gamename, gamename, (char **) com_argv, com_argc, NULL, &wmhints, clshints); + szhints = XAllocSizeHints(); + if(vid_resizable.integer == 0) + { + szhints->min_width = szhints->max_width = width; + szhints->min_height = szhints->max_height = height; + szhints->flags |= PMinSize | PMaxSize; + } + + XmbSetWMProperties(vidx11_display, win, gamename, gamename, (char **) com_argv, com_argc, szhints, wmhints, clshints); + XFree(clshints); + XFree(wmhints); + XFree(szhints); //XStoreName(vidx11_display, win, gamename); XMapWindow(vidx11_display, win);