Added GetClientScreenRect() and fixed build for C89 compilers
parent
a7326b9396
commit
61ff86617a
|
@ -1300,6 +1300,13 @@ void WIN_OnWindowEnter(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL GetClientScreenRect(HWND hwnd, RECT *rect)
|
||||||
|
{
|
||||||
|
return GetClientRect(hwnd, rect) && /* RECT( left , top , right , bottom ) */
|
||||||
|
ClientToScreen(hwnd, (LPPOINT)rect) && /* POINT( left , top ) */
|
||||||
|
ClientToScreen(hwnd, (LPPOINT)rect + 1); /* POINT( right , bottom ) */
|
||||||
|
}
|
||||||
|
|
||||||
void WIN_UpdateClipCursor(SDL_Window *window)
|
void WIN_UpdateClipCursor(SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->driverdata;
|
||||||
|
@ -1320,9 +1327,7 @@ void WIN_UpdateClipCursor(SDL_Window *window)
|
||||||
(window->mouse_rect.w > 0 && window->mouse_rect.h > 0)) &&
|
(window->mouse_rect.w > 0 && window->mouse_rect.h > 0)) &&
|
||||||
(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||||
if (mouse->relative_mode && !mouse->relative_mode_warp && data->mouse_relative_mode_center) {
|
if (mouse->relative_mode && !mouse->relative_mode_warp && data->mouse_relative_mode_center) {
|
||||||
if (GetClientRect(data->hwnd, &rect)) { /* RECT( left , top , right , bottom ) */
|
if (GetClientScreenRect(data->hwnd, &rect)) {
|
||||||
ClientToScreen(data->hwnd, (LPPOINT)&rect); /* POINT( left , top ) */
|
|
||||||
ClientToScreen(data->hwnd, (LPPOINT)&rect + 1); /* POINT( right , bottom ) */
|
|
||||||
/* WIN_WarpCursor() jitters by +1, and remote desktop warp wobble is +/- 1 */
|
/* WIN_WarpCursor() jitters by +1, and remote desktop warp wobble is +/- 1 */
|
||||||
LONG remote_desktop_adjustment = GetSystemMetrics(SM_REMOTESESSION) ? 2 : 0;
|
LONG remote_desktop_adjustment = GetSystemMetrics(SM_REMOTESESSION) ? 2 : 0;
|
||||||
LONG cx, cy;
|
LONG cx, cy;
|
||||||
|
@ -1343,9 +1348,7 @@ void WIN_UpdateClipCursor(SDL_Window *window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (GetClientRect(data->hwnd, &rect)) {
|
if (GetClientScreenRect(data->hwnd, &rect)) {
|
||||||
ClientToScreen(data->hwnd, (LPPOINT)&rect);
|
|
||||||
ClientToScreen(data->hwnd, (LPPOINT)&rect + 1);
|
|
||||||
if (window->mouse_rect.w > 0 && window->mouse_rect.h > 0) {
|
if (window->mouse_rect.w > 0 && window->mouse_rect.h > 0) {
|
||||||
SDL_Rect mouse_rect_win_client;
|
SDL_Rect mouse_rect_win_client;
|
||||||
RECT mouse_rect, intersection;
|
RECT mouse_rect, intersection;
|
||||||
|
|
Loading…
Reference in New Issue