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 5198

Summary: SDL_WINDOWEVENT_FOCUS_GAINED event on hidden x11 windows [patch]
Product: SDL Reporter: James Legg <jlegg>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.12   
Hardware: x86_64   
OS: Linux   
Attachments: patch

Description James Legg 2020-06-17 14:06:53 UTC
Created attachment 4387 [details]
patch

When a window with keyboard focus is hidden is hidden with SDL_HideWindow, after the expected events (SDL_WINDOWEVENT_HIDDEN and SDL_WINDOWEVENT_FOCUS_LOST), I'm receiving a SDL_WINDOWEVENT_FOCUS_GAINED window event for the hidden window. I'm using gnome-shell with XWayland and SDL's X11 backend. The attached patch fixes the issue for me.
Comment 1 Sam Lantinga 2020-06-17 17:04:43 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/dd215b7d208b