We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1447

Summary: Maximize and restore events not generated
Product: SDL Reporter: Charles Huber <genpfault>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P1 CC: amaranth72, andreidrx-sdl2, henrique_santiago93, icculus, rainerd, szaszg
Version: HG 2.0Keywords: target-2.0.0
Hardware: x86_64   
OS: Linux   
Attachments: SDL_WINDOWEVENT logger
Generate maximize/restore events with x11
patch for hg snapshot

Description Charles Huber 2012-03-08 16:36:48 UTC
Created attachment 837 [details]
SDL_WINDOWEVENT logger

Running the attached program and maximizing/minimizing/restoring the window results in the following events:

Maximize: No event
Restore (from maximize): No event
Restore (from minimize): Event received
Minimize: Event received

Ubuntu 10.04, amd64.
GNOME2 with Metacity.

testver output:
Compiled with SDL 2.0 or newer
Compiled version: 2.0.0.6303 (hg-6303:6bb657898f55)
Linked version: 2.0.0.6303 (hg-6303:6bb657898f55)
Comment 1 Ryan C. Gordon 2013-07-12 18:52:29 UTC
(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.0, Priority 1.

This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.
Comment 2 Henrique Santiago 2013-09-02 03:44:03 UTC
I still have this bug on 2.0.0.

I've been looking at:

/src/video/x11/SDL_x11events.c

Line 509:
case ConfigureNotify:{

******

Maximized event is raised at ConfigureNotify case.
So i guess X11_GetNetWMState should be called from there to check if it's maximized or not, and then raise an SDL_WINDOWEVENT_MAXIMIZED if it's maximized.
I couldn't test it, but it seems that this can be the solution.
Comment 3 Andrei Drexler 2013-09-10 19:43:52 UTC
Created attachment 1327 [details]
Generate maximize/restore events with x11

Patch created against SDL2-2.0.0, generating maximize/restore events when running in x11.
Comment 4 Alex Szpakowski 2014-08-26 10:37:44 UTC
You should probably create the patch based on SDL-HG, rather than 1 year old code...
Comment 5 Alex Szpakowski 2014-08-26 20:06:55 UTC
Well that's embarrassing, I didn't see the date on your reply. :)
Comment 6 Gergely Szász 2014-08-27 11:25:59 UTC
Created attachment 1853 [details]
patch for hg snapshot
Comment 7 Ryan C. Gordon 2015-02-02 06:22:09 UTC
(In reply to Gergely Szász from comment #6)
> Created attachment 1853 [details]
> patch for hg snapshot

I modified this slightly, and now this patch is https://hg.libsdl.org/SDL/rev/bb0b744fd1a6

Thanks, everyone!

--ryan.
Comment 8 Ryan C. Gordon 2015-02-02 06:26:13 UTC
*** Bug 2793 has been marked as a duplicate of this bug. ***