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

No SDL_VIDEORESIZE event generated when the window manager sets the window size. #878

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

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: HG 2.0
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2013-05-21 08:35:05 +0000, Niriel wrote:

xmonad is a window manager that tiles the resizable windows to avoid overlap.

Shortly after SetVideoMode, xmonad resizes the window. SDL does not notice it and no RESIZE_EVENT is generated. GetVideoInfo and GetVideoSurface().w/h still think that my window is the way I created it, even after xmonad resized it.

As a result, I do not (cannot?) know the size of my window.

A user on StackOverflow found a workaround
http://stackoverflow.com/questions/16442573/check-for-window-dimensions-in-pygame-sdl
but it is far from ideal.

On 2013-06-13 04:54:05 +0000, Peter Wu wrote:

Confirmed with two other WMs:

  • Openbox: set True in rc.xml to make a QEMU window full-screen.
  • KWin: set a window rule to maximize the window by default.

Sometimes, the SDL_VIDEORESIZE event is generated and the window contents gets scaled correctly. At other times, there is no SDL_VIDEORESIZE event.

I identified that the X ConfigureNotify event is somehow dropped as can seen in log14 1. (for comparison, log13 is correct). After some debugging, I can finally conclude that this issue happens because of the use of XSync(SDL_Display, True) in src/video/x11/SDL_x11modes.c (src/video/x11/SDL_x11framebuffer.c in tip).

Changing that True to False causes a lot more events to be initially launched, but at least events are not dropped which result in more predictable behavior. Could this code be copied from x11vnc2?

On 2013-06-13 05:54:07 +0000, Peter Wu wrote:

Created attachment 1188
[sdl-2.0] Do not drop events queue

It seems very likely that this SDL code is based on x11perf's code. After some talk on #xorg-devel and reading about the MIT-SHM extension1, it becomes apparent that the "True" parameter to XSync is not justified.

  • The XSync manual page warns against it use.
  • x11perf does not care about events, but SDL does. Events should not be dropped, it causes bugs like this one. Furthermore, the dropped events are non-deterministic.
  • A possible event from MIT-SHM is Completion, but that is only sent when a certain parameter to XShmPutImage is True which is not the case.

After this patch, events are not dropped anymore. Programs behave more predictable.

On 2013-06-13 05:55:21 +0000, Peter Wu wrote:

Created attachment 1189
[sdl-1.2.15] Do not drop events queue

On 2014-06-27 15:51:59 +0000, Andreas Eriksson wrote:

Created attachment 1715
[sdl-2.0.3] Do not drop events queue

This bug still exists in 2.0.3. I tried the above patch and it fixed the problem for me. It didn't apply cleanly anymore so I'm attaching a modified version that does.

On 2015-08-25 09:38:21 +0000, Ryan C. Gordon wrote:

Hello, and sorry if you're getting several copies of this message by email, since we are closing many bugs at once here.

We have decided to mark all SDL 1.2-related bugs as RESOLVED ENDOFLIFE, as we don't intend to work on SDL 1.2 any further, but didn't want to mark a large quantity of bugs as RESOLVED WONTFIX, to clearly show what was left unattended to and make it easily searchable.

Our current focus is on SDL 2.0.

If you are still having problems with an ENDOFLIFE bug, your absolute best option is to move your program to SDL2, as it will likely fix the problem by default, and give you access to modern platforms and tons of super-cool new features.

Failing that, we will accept small patches to fix these issues, and put them in revision control, although we do not intend to do any further official 1.2 releases.

Failing that, please feel free to contact me directly by email (icculus@icculus.org) and we'll try to find some way to help you out of your situation.

Thank you,
--ryan.

On 2015-08-25 18:12:15 +0000, Ryan C. Gordon wrote:

I haven't looked at this yet, but apparently this still affects SDL2, so I've reopened the bug.

--ryan.

On 2015-09-11 09:05:02 +0000, Samuel Hopkins wrote:

(In reply to Ryan C. Gordon from comment # 6)

I haven't looked at this yet, but apparently this still affects SDL2, so
I've reopened the bug.

--ryan.

Just confirming that the patch from Andreas (attachment 1715) works for me under SDL 2.0.3 with xmonad.

On 2017-04-03 12:58:48 +0000, Stas Sergeev wrote:

/me too

Confirming that the patch in this ticket
fixes the full-screen switching for dosemu2
on ubuntu-16.04. Note that I am not using
xmonad, so this bug appears to be generic.

I wish someone to take care of that patch,
as it is already 3 years old and it seems
vital for full-screen to work reliably.

On 2017-04-03 20:34:36 +0000, Sam Lantinga wrote:

Patched applied, thanks!
https://hg.libsdl.org/SDL/rev/f931db466859
https://hg.libsdl.org/SDL/rev/f318f6a4882f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant