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 2972 - Mouse Warp not working due to in_title_click variable
Summary: Mouse Warp not working due to in_title_click variable
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.3
Hardware: x86_64 Windows 7
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-01 15:04 UTC by Anders Davallius
Modified: 2016-10-08 00:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Davallius 2015-05-01 15:04:34 UTC
We used an older version of SDL until recently when we decided to compile our own, but then we started to run in to a new bug, where some of our players of our game (Cloudbuilt) had problem with the mouse.

We have managed to track it down quite far, but are not sure how to really solve it.

We are pretty sure it's because of these changes: http://hg.libsdl.org/SDL/rev/75ad8ebb3768

When running windows normally, there is no issue, but when we change windows performance options to "Adjust for best performance" we never get the WM_NCMOUSELEAVE event, thus the "in_title_click" variable stays true all the time if it's ever set to true (by clicking on the title bar or resizing the window or similar). Which is stopping mouse warping form working, rendering relative mouse pretty much useless for those players(and this is quite severe, because these widows settings can significantly boost performance if turned down).

We are not sure why this is happening, and the errors seem to be partially due to windows not sending the event, but it also seems like SDL could do something a little differently to work around it. Maybe there is a better event to listen to instead, or something like that?

If the person that made these changes is around, maybe he might have some ideas?

Please let me know if you have any problem recreating or understanding the issue!

Thanks!
Comment 1 Anders Davallius 2015-05-01 15:09:37 UTC
There seem to be some discussions bout this event here:
http://forums.codeguru.com/showthread.php?393227-No-WM_NCMOUSELEAVE-under-quot-Windows-Classic-Style-quot-!

Might be useful.
Comment 2 Anders Davallius 2015-05-01 15:23:37 UTC
I tried a little "hack", to always run the following code when I get a SDL_WINDOWEVENT_ENTER event:

	TRACKMOUSEEVENT* tme = new TRACKMOUSEEVENT();
	tme->hwndTrack = handle;
	tme->cbSize = sizeof(TRACKMOUSEEVENT);
	
	tme->dwFlags = TME_LEAVE | TME_NONCLIENT ;

	tme->dwHoverTime = 1000 * 3;
	TrackMouseEvent(tme);

And that seem to solve it, because the mouse tracking is not automatic when you are running some windows settings. Though, it might be redundant to run this code if the mouse is already being tracked, or maybe this affect something else negatively? I would love if someone more knowledgeable about SDL could look in to this a little bit more and see what would be the best things to do.