]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_glx.c
make precache_sound return the sound index (for using WriteStuff to send a sound...
[xonotic/darkplaces.git] / vid_glx.c
index 35f70de073d66a4efc16088e684a05ba0968612c..7f5fbe051eb359f4c47cc74f90f8e1cc00f32f53 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <X11/Xutil.h>
 #include <GL/glx.h>
 
+#include "quakedef.h"
+
 #include <X11/keysym.h>
 #include <X11/cursorfont.h>
 #include <X11/xpm.h>
@@ -35,8 +37,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #endif
 #include <X11/extensions/xf86vmode.h>
 
-#include "quakedef.h"
-
 #include "nexuiz.xpm"
 #include "darkplaces.xpm"
 
@@ -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);