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

Malformed window resize is sometimes reported on activity resume #906

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

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: Android (All), ARM

Comments on the original bug report:

On 2013-06-06 04:09:19 +0000, wrote:

Created attachment 1176
Fix for display mode updates

*** BEGIN WARNING ***

Before reading this, it worths to warn that the attached patch may break compatibility with a few Android apps. To be more specific I am talking about any app which, for any arbitrary reason, queries the display mode of the desktop/display/window after a resize or restore event arrives.

The reason is that with the given patch, the display mode actually gets updated.

*** END OF WARNING ***

Alright, on to the report itself. At the moment, when a screen rotation occurs, the display mode is not updated anywhere; Not for the window (if there is any), nor for the display.
One side effect of this occurs when the activity resumes. Basically, a SDL_WINDOWEVENT_RESTORED event is added to the queue. The addition of such an event results in an indirect check for any update to the window's dimensions, sending a resize event if necessary.

Problem is it queries a display mode at some point.

The given patch modifies the code so whenever a surface resize is detected (in the Java code), the screen's display mode as updated, along with the window's if there's any. I'm not sure it's the best way to handle that, but at least it seems to fix the issue for me.

On 2013-07-14 04:11:34 +0000, wrote:

I wonder why I didn't think of this or at least comment about that earlier...

Anyway, there is one big problem with the current patch: A case of not being thread safe when updating the display mode (desktop, current and window if there's any).

Maybe the function SDL_SendWindowEvent from SDL_windowevents.c (called by the secondary SDL C thread) should update the window's display mode after a window resize event is sent, although it may seem a bit dangerous at the moment.

Furthermore, maybe the current display mode should be changed here, but not the desktop's.

On 2013-07-14 08:19:46 +0000, wrote:

Of course there are chances that there is no window at all, yet an update to the display mode is still desired.

Due to the thread safety issues I am going to mark the current patch "obsolete", although it should still be available for reference.

On 2017-08-15 18:53:10 +0000, wrote:

Just updating that I think this was resolved, at least after these commits were applied (see also bug 2808):

https://hg.libsdl.org/SDL/rev/f7d8e9d871c5
https://hg.libsdl.org/SDL/rev/82f21f6121db

I believe this bug can be marked as resolved. It can be re-opened if it is reproduced in any later revision of SDL2.

On 2017-08-15 22:59:47 +0000, Sam Lantinga wrote:

Glad to hear it, thanks!

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