You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reported in version: HG 2.0 Reported for operating system, platform: Linux, x86_64
Comments on the original bug report:
On 2011-02-12 13:13:59 +0000, Martin Decky wrote:
Created attachment 567
Proposed patch
When the SDL_SetWindowSize() is called, it should
(a) Immediately update the window width and height before calling _this->SetWindowSize() (since the new values are required by this function and obviously there is no other way _this->SetWindowSize() can get them).
(b) Generate an event which would notify various parties about the window size change, most notably the renderer.
The latest hg sources fail to do (a), thus the window size does not get altered (e.g. in X11). The window->w and window->h do get updated in SDL_SendWindowEvent() thanks to (b), but then they do not match the physical window size.
Several days ago the SDL sources did implement (a) correctly, but then again the code failed to notify the renderer about the window size change -- in SDL_SendWindowEvent() the SDL_WINDOWEVENT_RESIZED was discarded if the current window->w and window->h equal to data1 and data2 (this was obviously true because of (a)).
In both cases the result was a distorted video output because various data structures contained different window width and height values.
The proposed patch fixes (a) and with respect to (b) it introduces a new event SDL_WINDOWEVENT_SIZE_SET. This event is then used to notify the renderer and other parties about the programmatic window size change.
Note: It would be probably not a good idea to change the behaviour of SDL_WINDOWEVENT_RESIZED and never discard it in SDL_SendWindowEvent(). Some SDL 1.2 applications (e.g. QEMU) call SDL_SetVideoMode() to change the window size, but they do not expect to receive the SDL_WINDOWEVENT_RESIZED event (or SDL_VIDEORESIZE event) as a result. This might cause endless looping, switching to "scaling" mode without any good reason and other troubles.
On 2011-02-12 17:39:50 +0000, Sam Lantinga wrote:
Thank you very much for your patch for SDL 1.3!
Do you give me permission to release your code with SDL 1.3 and future
versions of SDL under both the LGPL and a closed-source commercial
license?
On 2011-02-12 17:46:28 +0000, Martin Decky wrote:
(In reply to comment # 1)
Do you give me permission to release your code with SDL 1.3 and future
versions of SDL under both the LGPL and a closed-source commercial
license?
Of course, yes. Permission granted.
On 2011-02-12 17:52:48 +0000, Sam Lantinga wrote:
Thanks! :)
On 2011-02-12 19:03:12 +0000, Sam Lantinga wrote:
I fixed this slightly differently. I wanted a single event that was always sent when a window was resized, regardless of the reason. http://hg.libsdl.org/SDL/rev/8e421890cdb8
Can you let me know if this works for you?
Thanks!
On 2011-02-13 03:58:49 +0000, Martin Decky wrote:
Created attachment 569
Fix local variable initialization and scope
Rationale: The local variable "renderer" needs to be initialized to NULL, otherwise the code in the if (!data) { ... } branch might fail to actually create a renderer (note the second for-loop guarded by (!renderer)).
Secondly, move the "renderer" variable scope into the branch to make sure that the code actually uses data->renderer outside the branch (which holds the only provably correct value in both cases).
On 2011-02-13 04:07:11 +0000, Martin Decky wrote:
Your solution from changeset 8e421890cdb8 works for me perfectly.
BTW: I am sorry again for making such a mess, I just hate this Bugzilla feature of automatically progressing to a next bug after writing a comment. Please go ahead and remove my comment # 5 and attachment 569, both are not related to this bug.
The text was updated successfully, but these errors were encountered:
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
Fix local variable initialization and scope (sdl_renderer.take2.patch, text/plain, 2011-02-13 03:58:49 +0000, 1392 bytes)Reported in version: HG 2.0
Reported for operating system, platform: Linux, x86_64
Comments on the original bug report:
On 2011-02-12 13:13:59 +0000, Martin Decky wrote:
On 2011-02-12 17:39:50 +0000, Sam Lantinga wrote:
On 2011-02-12 17:46:28 +0000, Martin Decky wrote:
On 2011-02-12 17:52:48 +0000, Sam Lantinga wrote:
On 2011-02-12 19:03:12 +0000, Sam Lantinga wrote:
On 2011-02-13 03:58:49 +0000, Martin Decky wrote:
On 2011-02-13 04:07:11 +0000, Martin Decky wrote:
The text was updated successfully, but these errors were encountered: