]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
GLX: Fix desktopfullscreen size when we actually switched to it.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 20 Sep 2013 07:22:34 +0000 (07:22 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 21 Sep 2013 12:26:06 +0000 (14:26 +0200)
Should fix a few possible issues with getresolution(-1) on a multihead
setup with some window managers.

Also, remove a superfluous memory allocation on GLX when not using
DPSOFTRAST.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12011 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=21f2a75b80193c21c1e5458f531445b979f20454

vid_glx.c
vid_sdl.c

index 69155d1e9c8897e8f1511b7cb47a4cc5c0715bab..9e33fdc91f7fe5c631f1ef9a6ac284dca719abd2 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -654,6 +654,15 @@ static void HandleEvents(void)
                        // window changed size/location
                        win_x = event.xconfigure.x;
                        win_y = event.xconfigure.y;
+                       // HACK on X11, we just request fullscreen mode, but
+                       // cannot guess what the window manager will do for us
+                       // exactly. That is why we read back the resolution we
+                       // actually got here.
+                       if(vid_isdesktopfullscreen)
+                       {
+                               desktop_mode.width = event.xconfigure.width;
+                               desktop_mode.height = event.xconfigure.height;
+                       }
                        if((vid_resizable.integer < 2 || vid_isdesktopfullscreen) && (vid.width != event.xconfigure.width || vid.height != event.xconfigure.height))
                        {
                                vid.width = event.xconfigure.width;
@@ -663,19 +672,19 @@ static void HandleEvents(void)
                                else
                                        Con_DPrintf("Updating to ConfigureNotify resolution %dx%d\n", vid.width, vid.height);
 
-                               DPSOFTRAST_Flush();
-
-                               if(vid.softdepthpixels)
-                                       free(vid.softdepthpixels);
-
-                               DestroyXImages();
-                               XSync(vidx11_display, False);
-                               if(!BuildXImages(vid.width, vid.height))
-                                       return;
-                               XSync(vidx11_display, False);
-
-                               vid.softpixels = (unsigned int *) vidx11_ximage[vidx11_ximage_pos]->data;
-                               vid.softdepthpixels = (unsigned int *)calloc(4, vid.width * vid.height);
+                               if(vid.renderpath == RENDERPATH_SOFT)
+                               {
+                                       DPSOFTRAST_Flush();
+                                       if(vid.softdepthpixels)
+                                               free(vid.softdepthpixels);
+                                       DestroyXImages();
+                                       XSync(vidx11_display, False);
+                                       if(!BuildXImages(vid.width, vid.height))
+                                               return;
+                                       XSync(vidx11_display, False);
+                                       vid.softpixels = (unsigned int *) vidx11_ximage[vidx11_ximage_pos]->data;
+                                       vid.softdepthpixels = (unsigned int *)calloc(4, vid.width * vid.height);
+                               }
                        }
                        break;
                case DestroyNotify:
index c9600ce713fa23da753196dfa3e30f9e83949c95..abb90970eac7c6a031a2f21e582424473331f36f 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -2885,6 +2885,9 @@ vid_mode_t *VID_GetDesktopMode(void)
        modes[k].refreshrate = mode.refreshrate;
        modes[k].pixelheight_num = 1;
        modes[k].pixelheight_denom = 1; // SDL does not provide this
+       // TODO check whether this actually works, or whether we do still need
+       // a read-window-size-after-entering-desktop-fullscreen hack for
+       // multiscreen setups.
 #endif
        return &desktop_mode;
 }