SDL icon indicating copy to clipboard operation
SDL copied to clipboard

SDL_SetWindowFullscreen don't create SDL_WINDOWEVENT_SIZE_CHANGED event

Open CarlosBarrazaE opened this issue 3 years ago • 3 comments

The SDL_SetWindowFullscreen function does not raise the SDL_WINDOWEVENT_SIZE_CHANGED event, but when exiting fullscreen with SDL_SetWindowFullscreen(window, 0) the event is raised, possibly due to the mesa update to version 22.1.5

In libsdl2-2.0.22

CarlosBarrazaE avatar Aug 09 '22 00:08 CarlosBarrazaE

I can't reproduce this here on X11. Is this a Wayland thing, maybe?

icculus avatar Aug 09 '22 13:08 icculus

No, it's from X11 on gentoo. kwin-5.25.4-r1 xorg-server-21.1.4 nvidia-drivers-390.151 I don't know what additional information you may need.

More or less one out of ten times that I test it works fine, it may be a kwin_x11 error because when kwin_x11 is off the event is generated correctly.

ghost avatar Aug 09 '22 15:08 ghost

If I start my application with SDL_WINDOW_FULLSCREEN_DESKTOP it works as intended, if I toggle it using SDL_SetWindowFullscreen then the image is not re-scaled but the window is indeed fullscreen. Could this be related?

omgitsaheadcrab avatar Aug 10 '22 09:08 omgitsaheadcrab

@omgitsaheadcrab It's the same problem, if I start my application with SDL_WINDOW_FULLSCREEN_DESKTOP it works fine the problem only happens from window to full screen.

ghost avatar Aug 10 '22 12:08 ghost

Moving to 2.24 in case I can reproduce this quickly with this new info, but it's bumping back to 2.26 if not (we're almost out of time for 2.24).

icculus avatar Aug 10 '22 14:08 icculus

I also ran into this bug. SDL_Window is created with SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE.

Some extra details:

  • If I resize the window beforehand I'm not able to reproduce this bug.
  • SIZE_CHANGED is sent everytime when exiting fullscreen state, but not when entering
  • Calling SDL_GetWindowSize after SDL_SetWindowFullscreen does always report correct size
  • Usually (not always) when entering FULLSCREEN_DESKTOP for the 3rd time, SIZE_CHANGED event is finally sent
  • On my laptop running Plasma Wayland I can also reproduce this bug with SDL_VIDEODRIVER=x11
  • On same laptop I can't reproduce this problem if running with SDL_VIDEODRIVER=wayland

Both computers are running kwin-5.25.4. Desktop is running xorg-server 21.1.4 and nvidia-515.49.06 Laptop is running xorg-xwayland 22.1.3 and mesa 22.1.4

Danderaion avatar Aug 10 '22 17:08 Danderaion

Running SDL_EVENT_LOGGING=1 ./testvulkan --resizable here and pressing alt-enter to go fullscreen_desktop and back is working correctly on Gnome/x11; I get a SIZE_CHANGED for both going and coming from fullscreen_desktop mode.

It's possible it only triggers on kwin...?

icculus avatar Aug 11 '22 18:08 icculus

Remove kwin and put twm, it worked correctly, I have no gnome to test.

ghost avatar Aug 11 '22 19:08 ghost

Wait, this does reproduce for me with Gnome, if I use the actual 2.0.22 release. The latest in revision control works correctly...it's possible this was fixed by cf63af8ae265c99e80ffc93e9930336c939524bc in some way I don't understand yet. I'll bisect and see if it was something else instead.

Has anyone tried this on kwin with the latest SDL, or has this all been tested with 2.0.22?

icculus avatar Aug 11 '22 19:08 icculus

The actual fix was 9edd411a8315540b86fceec590dd5aa6be41f5f0, which was made after 2.0.22 shipped (this explicitly generates a RESIZED event in response to a fullscreen change, which will cause SDL to generate a SIZED_CHANGED event under the hood as well).

I'm assuming this is fixed for 2.24.0 already, but if you find this is still busted on kwin with the latest in revision control, please let me know and I'll reopen the issue. Thanks!

icculus avatar Aug 11 '22 19:08 icculus