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 3042 - SDL_MOUSEBUTTON event registered when maximizing window by double clicking the title bar
Summary: SDL_MOUSEBUTTON event registered when maximizing window by double clicking th...
Status: RESOLVED ABANDONED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.3
Hardware: x86_64 Windows 7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-27 18:16 UTC by alobeejay
Modified: 2018-08-06 21:20 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 alobeejay 2015-06-27 18:16:47 UTC
When double clicking on the title bar to maximize the SDL window a SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP event is registered with the x and y positions where the cursor "lands" after the window is maximized.

Flushing the event qeueu in the SDL_WINDOWEVENT_RESIZED event does not help.
Comment 1 Pankaj 2015-08-11 11:09:45 UTC
Any one is working or having fix for this defect?
Comment 2 Pankaj 2015-08-13 10:17:35 UTC
Hi Alobeejay,

This is the expected behaviour.

Please read the lines 
"MouseMove events are triggered when the window moves underneath the pointer. A MouseMove event can be triggered even if the mouse is stationary."

in the Note section given on below link
https://msdn.microsoft.com/en-us/library/windows/hardware/th089bb0%28v=vs.71%29.aspx


Hi Sam,

Cause of problem:
When double click on title bar, mouse move event is coming which further checks for button states:
WM_MOUSEMOVE -> 512
	(wParam = 1, mouse_button_flags = 0) 
		Sending SDL_PRESSED                           ----> we are not getting Pressed event from windows still it is sending to SDL_PushEvents.{Here is the bug}

WM_LBUTTONUP -> 514
	(wParam = 0, mouse_button_flags = 1)
		Sending SDL_RELEASED

We shouldn't send SDL_PRESSED/SDL_RELEASED event to SDL_PushEvents completely on the basis of "wParam" and "mouse_button_flags". Rather we should send SDL_PRESSED/SDL_RELEASED event on the basis of WM_LBUTTONDOWN/WM_LBUTTONUP events and by checking "wParam" & "mouse_button_flags flags". 

Checking WM_LBUTTONDOWN/WM_LBUTTONUP button state  for case of WM_MOUSEMOVE event, may be not correct.

There may be the case, when this sequence of flow comes which is wrong.
1. WM_MOUSEMOVE -> (wParam = 1 and mouse_button_flags = 0) or (wParam = 0 and mouse_button_flags = 1)
2. WM_LBUTTONUP -> (wParam = 0 and mouse_button_flags = 0)
Comment 3 Amit Jain 2015-08-24 07:33:20 UTC
Hi Sam, 

We can't prevent mouse move events to come. But we can have avoid these event to go to SDL application. I have alternative fixes for this.

We can avoid this bug to happen by little change in our code. What are your comments on  this ?

Regards,
Pankaj
Comment 4 Ryan C. Gordon 2018-08-06 21:20:21 UTC
Hello, and sorry if you're getting dozens of copies of this message by email.

We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc.

Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report.

So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues.

(please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!)

Thanks,
--ryan.