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

UnmapNotify does not mean that window has been iconified #3847

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

UnmapNotify does not mean that window has been iconified #3847

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.12
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2020-10-10 14:32:46 +0000, Alberts Muktupāvels wrote:

https://github.com/SDL-mirror/SDL/blob/master/src/video/x11/SDL_x11events.c#L949-L956

SDL receiving UnmapNotify event assumes that window has been iconified. This assumption seems wrong... For example UnmapNotify event is also sent when window is reparented, see https://tronche.com/gui/x/xlib/window-and-session-manager/XReparentWindow.html.

This causes problems when using SDL applications with Metacity 3.36+. Metacity now removes decorations when windows are fullscreen.

Perhaps SDL could check if next event is ReparentNotify and not dispatch UnmapNotify in that case? Something like this:

XEvent ev;
if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent.xunmap))
X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&xevent.xunmap);
else
X11_DispatchUnmapNotify(data);

static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer unmap)
{
XUnmapEvent *event;

event = (XUnmapEvent*) unmap;

return ev->type == MapNotify &&
    ev->xmap.window == event->window &&
    ev->xmap.serial == event->serial;

}

static Bool isReparentNotify(Display *dpy, XEvent *ev, XPointer unmap)
{
XUnmapEvent *event;

event = (XUnmapEvent*) unmap;

return ev->type == ReparentNotify &&
    ev->xreparent.window == event->window &&
    ev->xreparent.serial == event->serial;

}

On 2020-10-12 16:27:58 +0000, Sam Lantinga wrote:

That seems reasonable, can you provide a tested and working patch? Can you also make sure that iconification is still detected correctly?

On 2020-10-17 20:11:44 +0000, Alberts Muktupāvels wrote:

Created attachment 4480
x11events: ignore UnmapNotify events from XReparentWindow

On 2020-10-17 20:16:32 +0000, Alberts Muktupāvels wrote:

(In reply to Sam Lantinga from comment # 1)

That seems reasonable, can you provide a tested and working patch? Can you
also make sure that iconification is still detected correctly?

Patch attached. Iconification seems to work as expected.

On 2020-10-20 00:27:20 +0000, Sam Lantinga wrote:

Patch added, thanks!
https://hg.libsdl.org/SDL/rev/204628027601

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