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 3089 - SDL_MOUSEBUTTONUP event triggers out of the SDL window
Summary: SDL_MOUSEBUTTONUP event triggers out of the SDL window
Status: REOPENED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.3
Hardware: x86 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-11 05:37 UTC by Amit Jain
Modified: 2016-10-08 01:14 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Jain 2015-08-11 05:37:23 UTC
Step to reproduce:
1. Press the left mouse button with inside SDL window and keep the button pressed.
2. Move the mouse cursor outside of SDL window and release it.
3. SDL Window triggers a single SDL_MOUSEBUTTONUP event.

Expected result:
 >> This SDL_MOUSEBUTTONUP event beyond the window shouldn't appear.
Comment 1 Ryan C. Gordon 2015-08-12 14:16:47 UTC
My understanding is that this has to happen, or apps may think the mouse button was held down forever.

--ryan.
Comment 2 Pankaj 2015-08-13 06:48:49 UTC
(In reply to Ryan C. Gordon from comment #1)
> My understanding is that this has to happen, or apps may think the mouse
> button was held down forever.
> 
> --ryan.

Hi Ryan,

As per my analysis current behavior of SDL_MOUSEBUTTONUP event in Linux & Windows :
Linux: 
1. Press the left mouse button with inside SDL window and keep the button pressed.
2. Move the mouse cursor outside of SDL window and release it.
3. SDL_MOUSEBUTTONUP event comes to application at the moment we release button.

Windows:
1. Press the left mouse button with inside SDL window and keep the button pressed.
2. Move the mouse cursor outside of SDL window and release it.
3. SDL_MOUSEBUTTONUP event doesn't come(It comes when cursor moves inside the SDL window)

In linux case, application is knowing button released event at the same time when it is released.
In windows case, application is not knowing when button is released. It knows only mouse moves inside the window.

Behaviour of Release events should be consistent in both the platforms.
Comment 3 Ryan C. Gordon 2015-08-15 05:20:12 UTC
(In reply to Pankaj from comment #2)
> In linux case, application is knowing button released event at the same time
> when it is released.
> In windows case, application is not knowing when button is released. It
> knows only mouse moves inside the window.
> 
> Behaviour of Release events should be consistent in both the platforms.


Tossing this bug to Sam to look at.

Sam, which platform is correct here, or should either behavior be considered acceptable?

--ryan.
Comment 4 Amit Jain 2015-08-24 07:24:12 UTC
Hi Mr. Sam,

Which is correct behavior?


Regards,
Pankaj
Comment 5 Sam Lantinga 2016-10-08 01:14:33 UTC
We probably want to release the button when it actually goes up. I think currently we also release the button when the window loses focus.