You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is manifested in windowed mode, when the main window has captured the mouse using SetCapture() call from windows API. In this case, when the mouse is on the left or above the main window, WM_MOUSEMOVE is sending negative 16bit coordinates and LOWORD incorrectly typecasts it to an unsigned word. Typecasting LOWORD(lParam) to (Sint16)LOWORD(lParam) resolves the problem.
Of course, for this to work properly, further modifications are required in SDL_mouse.c. I had to remove the constraints on mouse cursor assignment:
if (mouse->x > x_max) { mouse->x = x_max; }, etc...
If would be nice if you could add a flag into the SDL_mouse structure to disable this check.
I know that in general, cursor capturing is not supported, but it would be beneficial for building GUIs based on SDL. At its present stage, it is possible to work around by using direct windows API calls, but some built-in support would be good.
On 2013-05-21 02:32:27 +0000, Sam Lantinga wrote:
Hey Jorgen, can you take a quick look at this for SDL 2.0 release?
Thanks!
On 2013-06-05 15:00:57 +0000, (disabled) Jørgen Tjernø wrote:
Alex, if you look at SDL_GetMouse()->last_x + event.motion.xrel and SDL_GetMouse()->last_y + event.motion.yrel, you should be able to get the coordinate outside the window even with SetCapture.
I'm updating the code so that it will properly cast the lParam, but I'm not adding any functionality (right now) to support mouse motion events with absolute values outside of the window.
This bug report was migrated from our old Bugzilla tracker.
Reported in version: HG 2.0
Reported for operating system, platform: Windows (All), x86
Comments on the original bug report:
On 2011-03-22 08:19:42 +0000, Alex Denisov wrote:
On 2013-05-21 02:32:27 +0000, Sam Lantinga wrote:
On 2013-06-05 15:00:57 +0000, (disabled) Jørgen Tjernø wrote:
The text was updated successfully, but these errors were encountered: