We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2895

Summary: legacy fullscreen mode does not resize window
Product: SDL Reporter: Stas Sergeev <stsp2>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: REOPENED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   

Description Stas Sergeev 2015-02-28 20:46:34 UTC
Hello.

Normally the app can create window with W/H set to 0
and make it fullscreen. It will be resized to desktop size.
However, in X11 legacy mode the window is not resized!
Instead, the new full-screen window is created and the
old one gets centered to it, but never resized. You can
easily see that by reading the source of X11_BeginWindowFullscreenLegacy()
function. So is this intentional or what?

To reproduce, one can do the following:

--- a/include/SDL_test_common.h	Sun Feb 22 20:34:08 2015 -0500
+++ b/include/SDL_test_common.h	Sat Feb 28 23:43:18 2015 +0300
@@ -38,8 +38,8 @@
 #define DEFAULT_WINDOW_WIDTH  480
 #define DEFAULT_WINDOW_HEIGHT 272
 #else
-#define DEFAULT_WINDOW_WIDTH  640
-#define DEFAULT_WINDOW_HEIGHT 480
+#define DEFAULT_WINDOW_WIDTH  0
+#define DEFAULT_WINDOW_HEIGHT 0
 #endif
 
 #define VERBOSE_VIDEO   0x00000001


With that change, tests will create the zero-sized window.
Now do the following:

./testdraw2 --fullscreen-desktop

and it works great.
Now do the following:

SDL_VIDEO_X11_LEGACY_FULLSCREEN=1 ./testdraw2 --fullscreen-desktop

Black screen, and the mouse is wrongly confined.
Comment 1 Stas Sergeev 2015-03-01 15:26:31 UTC
With the folowing change:

diff -r 3b0bea866440 src/video/x11/SDL_x11window.c
--- a/src/video/x11/SDL_x11window.c	Sun Mar 01 02:12:52 2015 +0300
+++ b/src/video/x11/SDL_x11window.c	Sun Mar 01 18:11:38 2015 +0300
@@ -1154,6 +1154,7 @@
                                    displaydata->depth, InputOutput,
                                    visual, xattrmask, &xattr);
 
+    X11_XResizeWindow(display, data->xwindow, rect.w, rect.h);
     X11_XSelectInput(display, data->fswindow, StructureNotifyMask);
     X11_XSetWindowBackground(display, data->fswindow, 0);
     X11_XInstallColormap(display, data->colormap);
@@ -1177,7 +1178,7 @@
     SetWindowBordered(display, displaydata->screen, data->xwindow, SDL_FALSE);
 
     /* Center actual window within our cover-the-screen window. */
-    X11_XReparentWindow(display, data->xwindow, data->fswindow,
+    X11_XReparentWindow(display, data->fswindow, data->xwindow,
                     (rect.w - window->w) / 2, (rect.h - window->h) / 2);
 
     /* Move the mouse to the upper left to make sure it's on-screen */

the things mostly work...
But I have absolutely no idea why swapping args
of XReparentWindow() is needed...
Comment 2 Ryan C. Gordon 2018-08-06 21:20:22 UTC
Hello, and sorry if you're getting dozens of copies of this message by email.

We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc.

Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report.

So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues.

(please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!)

Thanks,
--ryan.
Comment 3 Stas Sergeev 2018-08-07 11:31:18 UTC
This bug is easily reproducible with the
existing SDL test program, just run
---
SDL_VIDEO_X11_LEGACY_FULLSCREEN=1 ./testdraw2 --fullscreen-desktop
---

No modifications to source are needed any more
for reproducing it, because SDL_test_common.c:943
now looks up the actual window size. So you'll get
---
Window requested size 640x480, got 1280x1024
---
and will reproduce the bug without any problem.