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 4599 - X11: Mouse button down not triggered subsequently after mouse button was only lifted while minimized.
Summary: X11: Mouse button down not triggered subsequently after mouse button was only...
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.9
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-15 01:05 UTC by captain.gxj
Modified: 2019-04-17 04:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description captain.gxj 2019-04-15 01:05:56 UTC
I find unexpected behavior when having SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH enabled together with setting borderless window.

Steps to replicate: 

1. Make the SDL2 window borderless.
2. Minimize the SDL2 window.
3. Raise the SDL2 window.
4. Click on another window to defocus. (I find this step is not needed on GNOME, but does on some other DE's)
5. Click back in SDL2 window.

Upon clicking in the window in step 5, the expected behavior is that the click is registered and a SDL_MOUSEBUTTONDOWN event is sent, but it does not.

SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH works as expected otherwise.
Comment 1 Sam Lantinga 2019-04-17 02:37:31 UTC
I don't have a test setup to reproduce this, but tested patches are welcome!
Comment 2 captain.gxj 2019-04-17 03:44:17 UTC
I have done some more testing and I believe I understand the issue better now. My initial report was wrong.

Its not because of being borderless exactly, I see that is it caused by minimizing the window while the mouse button is held down. (Such as what happens when a program is drawing its own window controls.)

It seems SDL is excepting a SDL_MOUSEBUTTONUP before it will register another SDL_MOUSEBUTTONDOWN for a mouse button.

But a SDL_MOUSEBUTTONUP does not resister as the window is minimized.

Is this behavior a bug? And/or is there a way I can reset the events so a click down can be registered without subsequent click up?
Comment 3 captain.gxj 2019-04-17 04:03:39 UTC
Actually, I can workaround this issue by introducing a delay of about 80ms before using SDL_MinimizeWindow() after a click.

I notice this complication does not occur on Windows.

I don't mind if this bug report is closed now. I'm not sure if this is a valid bug or not. Apologies for the noise.