Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_WINDOW_FULLSCREEN_DESKTOP not always restored after focus loss #1191

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed
Labels
abandoned Bug has been abandoned for various reasons

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.1
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2013-11-04 20:33:24 +0000, Daniel Scharrer wrote:

Created attachment 1406
xprop and xwininfo output for a "broken" window

SDL (by default) minimizes fullscreen windows when they lose focus and restore the fullscreen more when they regain focus. This works fine with SDL_WINDOW_FULLSCREEN, but with SDL_WINDOW_FULLSCREEN_DESKTOP the fullscreen state isn't always properly restore and instead the window is restored at whatever its last non-fullscreen size was.

I am experiencing this with various SDL2 programs, including Source engine games and the WIP SDL2 support in Arx Libertatis [1].

This bug might be WM-specific - I'm using KWin 4.11.2. Curiously, the improperly restored window still has the _NET_WM_STATE_FULLSCREEN set but obviously doesn't have the display size (1920x1200) - see the attached xprop and xwininfo output.

While I haven't found what exactly is causing this bug, I noticed that SDL_MinimizeWindow() always calls SDL_UpdateFullscreenMode(SDL_FALSE) while this isn't needed for the _NET_WM_STATE_FULLSCREEN case. And indeed, disabling that call allows the fullscreen state to be properly restored (see attached patch).

This has the added benefit of a smoother fullscreen<->minimized transition - there is no window momentarily flashing during the transition. I have tested this with both Portal and Arx Libertatis under Linux, but don't know if this breaks other systems.

[1] https://github.com/arx/ArxLibertatis/tree/sdl2

On 2013-11-04 20:34:26 +0000, Daniel Scharrer wrote:

Created attachment 1407
Patch to fix restoring minimized SDL_WINDOW_FULLSCREEN_DESKTOP windows

On 2013-11-25 17:49:59 +0000, wrote:

I am also having a similar issue. There is a window which has been minimized and then the code is calling SDL_SetWindowFullscreen with SDL_WINDOW_FULLSCREEN_DESKTOP however the FULLSCREEN_VISIBLE macro seems to evaulate to false because the SDL_WINDOW_MINIMIZED bit is still set on the window.

I tried adding in SDL_MaximizeWindow, SDL_ShowWindow and SDL_RestoreWindow but it still seems as though the SDL_WINDOW_MINIMIZED never gets unset.

On 2013-12-13 23:49:31 +0000, Gabriel Kind wrote:

That bug occurs under Windows (only Windows 7 tested) with SDL_WINDOW_FULLSCREEN_DESKTOP, too.
The attached patch by Daniel Scharrer does not resolve the issue for me.

How to reproduce:

  1. Create window with SDL_WINDOW_FULLSCREEN_DESKTOP state
  2. Press Windows key, the SDL application is now gone and Desktop (or other programs) are visible.
  3. Reopen the window via the Windows taskbar. The window is fullscreen but there is only in topleft corner a non-zoomed state rendered, the rest is of the window black (same as already stated "instead the window is restored at whatever its last non-fullscreen size was.")

On 2015-03-17 04:36:25 +0000, Robert wrote:

I can also concur. This is tested on Windows 8.1 - I noticed that after invalidation that the window bounds have been returned to their defaults. IE: The values passed in SDL_CreateWindow, and not those of the fullscreen window before (ex: 1920 x 1080 (fullscreen) to 700 x 700 (passed values).

This may relate to another bug I noticed on one of programming projects that caused random partial invalidation of SDL_Renderer, where the Textures could not be drawn (but were "valid"), and the SDL_RenderDrawRects started to draw to much smaller sizes. I can attach the src for the game if it might be of assistance.

On 2017-08-15 04:48:43 +0000, Sam Lantinga wrote:

We need to review this for 2.0.6 release.

Thanks!

On 2017-08-30 06:18:41 +0000, Sam Lantinga wrote:

I wasn't able to reproduce this with the latest SDL snapshot:
http://www.libsdl.org/tmp/SDL-2.0.zip

On Windows 8, I ran this command:
testsprite --fullscreen-desktop --info all

Then I pressed the Windows key, which minimized testsprite, then clicked on the task bar to restore it.

Here was the output:
INFO: Current renderer:
INFO: Renderer direct3d:
INFO: Flags: 0x0000000A (Accelerated | TargetTexturesSupported)
INFO: Texture formats (3): ARGB8888, YV12, IYUV
INFO: Max Texture Size: 16384x16384
INFO: SDL EVENT: Window 1 moved to 0,0
INFO: SDL EVENT: Window 1 changed size to 1920x1080
INFO: SDL EVENT: Window 1 resized to 1920x1080
INFO: SDL EVENT: Window 1 shown
INFO: SDL EVENT: Window 1 gained keyboard focus
INFO: SDL EVENT: Keyboard: text editing "" in window 1
INFO: SDL EVENT: Mouse entered window 1
INFO: SDL EVENT: Mouse left window 1
INFO: SDL EVENT: Mouse entered window 1
INFO: SDL EVENT: Window 1 exposed
INFO: SDL EVENT: Keyboard: key pressed in window 1: scancode 0x000000E3 = Left Windows, keycode 0x400000E3 = Left Windows
INFO: SDL EVENT: Keyboard: key released in window 1: scancode 0x000000E3 = Left Windows, keycode 0x400000E3 = Left Windows
INFO: SDL EVENT: Window 1 moved to 640,300
INFO: SDL EVENT: Window 1 resized to 640x480
INFO: SDL EVENT: Window 1 changed size to 640x480
INFO: SDL EVENT: Window 1 minimized
INFO: SDL EVENT: Window 1 lost keyboard focus
INFO: SDL EVENT: Keyboard: text editing "" in window 1
INFO: SDL EVENT: Window 1 exposed
INFO: SDL EVENT: Mouse left window 1
INFO: SDL EVENT: Window 1 moved to 0,0
INFO: SDL EVENT: Window 1 changed size to 1920x1080
INFO: SDL EVENT: Window 1 resized to 1920x1080
INFO: SDL EVENT: Window 1 restored
INFO: SDL EVENT: Window 1 gained keyboard focus
INFO: SDL EVENT: Mouse entered window 1
INFO: SDL EVENT: Mouse left window 1
INFO: SDL EVENT: Mouse entered window 1
INFO: SDL EVENT: Window 1 exposed
INFO: SDL EVENT: render targets reset
INFO: SDL EVENT: Keyboard: key pressed in window 1: scancode 0x00000029 = Escape, keycode 0x0000001B = Escape
INFO: 93479.58 frames per second

Can you see if this has been fixed for you in the latest snapshot?

Thanks!

On 2018-08-06 21:20:22 +0000, Ryan C. Gordon wrote:

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.

@SDLBugzilla SDLBugzilla added abandoned Bug has been abandoned for various reasons bug labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned Bug has been abandoned for various reasons
Projects
None yet
Development

No branches or pull requests

1 participant