mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-06 15:30:50 +00:00
use GetMessagePos instead of GetCursorPos
This commit is contained in:
parent
bfbeaca29f
commit
a82f70dc21
1 changed files with 4 additions and 2 deletions
|
@ -1467,8 +1467,10 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||||
if (!(data->window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
|
if (!(data->window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
|
||||||
if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode && !IsIconic(hwnd)) {
|
if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode && !IsIconic(hwnd)) {
|
||||||
SDL_Mouse *mouse;
|
SDL_Mouse *mouse;
|
||||||
|
DWORD pos = GetMessagePos();
|
||||||
POINT cursorPos;
|
POINT cursorPos;
|
||||||
GetCursorPos(&cursorPos);
|
cursorPos.x = GET_X_LPARAM(pos);
|
||||||
|
cursorPos.y = GET_Y_LPARAM(pos);
|
||||||
ScreenToClient(hwnd, &cursorPos);
|
ScreenToClient(hwnd, &cursorPos);
|
||||||
mouse = SDL_GetMouse();
|
mouse = SDL_GetMouse();
|
||||||
if (!mouse->was_touch_mouse_events) { // we're not a touch handler causing a mouse leave?
|
if (!mouse->was_touch_mouse_events) { // we're not a touch handler causing a mouse leave?
|
||||||
|
@ -1607,7 +1609,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||||
// Reference: https://gamedev.net/forums/topic/672094-keeping-things-moving-during-win32-moveresize-events/5254386/
|
// Reference: https://gamedev.net/forums/topic/672094-keeping-things-moving-during-win32-moveresize-events/5254386/
|
||||||
if (SendMessage(hwnd, WM_NCHITTEST, wParam, lParam) == HTCAPTION) {
|
if (SendMessage(hwnd, WM_NCHITTEST, wParam, lParam) == HTCAPTION) {
|
||||||
POINT cursorPos;
|
POINT cursorPos;
|
||||||
GetCursorPos(&cursorPos);
|
GetCursorPos(&cursorPos); // want the most current pos so as to not cause position change
|
||||||
ScreenToClient(hwnd, &cursorPos);
|
ScreenToClient(hwnd, &cursorPos);
|
||||||
PostMessage(hwnd, WM_MOUSEMOVE, 0, cursorPos.x | (((Uint32)((Sint16)cursorPos.y)) << 16));
|
PostMessage(hwnd, WM_MOUSEMOVE, 0, cursorPos.x | (((Uint32)((Sint16)cursorPos.y)) << 16));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue