From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 6 +++--- dlls/win32u/input.c | 10 +++++----- dlls/win32u/message.c | 2 +- dlls/win32u/win32u_private.h | 2 +- dlls/winemac.drv/macdrv.h | 3 +-- dlls/winemac.drv/mouse.c | 6 ++++-- dlls/winex11.drv/mouse.c | 13 +++++++------ dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 2 +- 9 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index d4c1c722203..26bdbe7baf6 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -752,7 +752,7 @@ static BOOL nulldrv_SetCursorPos( INT x, INT y ) return TRUE; }
-static BOOL nulldrv_ClipCursor( LPCRECT clip ) +static BOOL nulldrv_ClipCursor( const RECT *clip, BOOL reset ) { return TRUE; } @@ -1133,9 +1133,9 @@ static BOOL loaderdrv_SetCursorPos( INT x, INT y ) return load_driver()->pSetCursorPos( x, y ); }
-static BOOL loaderdrv_ClipCursor( const RECT *clip ) +static BOOL loaderdrv_ClipCursor( const RECT *clip, BOOL reset ) { - return load_driver()->pClipCursor( clip ); + return load_driver()->pClipCursor( clip, reset ); }
static LRESULT nulldrv_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 22f371969b9..2df1266041d 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2497,16 +2497,16 @@ BOOL get_clip_cursor( RECT *rect ) return ret; }
-BOOL process_wine_clipcursor( BOOL empty ) +BOOL process_wine_clipcursor( BOOL empty, BOOL reset ) { RECT rect;
- TRACE( "empty %u\n", empty ); + TRACE( "empty %u, reset %u\n", empty, reset );
- if (empty) return user_driver->pClipCursor( NULL ); + if (empty || reset) return user_driver->pClipCursor( NULL, reset );
get_clip_cursor( &rect ); - return user_driver->pClipCursor( &rect ); + return user_driver->pClipCursor( &rect, FALSE ); }
/*********************************************************************** @@ -2552,6 +2552,6 @@ BOOL WINAPI NtUserClipCursor( const RECT *rect ) } } SERVER_END_REQ; - if (ret) user_driver->pClipCursor( &new_rect ); + if (ret) user_driver->pClipCursor( &new_rect, FALSE ); return ret; } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 44cd0640434..cc6a36449d9 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1272,7 +1272,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR return call_current_hook( h_extra->handle, HC_ACTION, wparam, h_extra->lparam ); } case WM_WINE_CLIPCURSOR: - return process_wine_clipcursor( wparam ); + return process_wine_clipcursor( wparam, lparam ); case WM_WINE_UPDATEWINDOWSTATE: update_window_state( hwnd ); return 0; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index a459db75d94..45e58093ba4 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -101,7 +101,7 @@ extern BOOL set_foreground_window( HWND hwnd, BOOL mouse ) DECLSPEC_HIDDEN; extern void toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN; extern void update_mouse_tracking_info( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN; -extern BOOL process_wine_clipcursor( BOOL empty ) DECLSPEC_HIDDEN; +extern BOOL process_wine_clipcursor( BOOL empty, BOOL reset ) DECLSPEC_HIDDEN;
/* menu.c */ extern HMENU create_menu( BOOL is_popup ) DECLSPEC_HIDDEN; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index af104a130fe..d857a7d0919 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -133,7 +133,7 @@ extern BOOL macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device BOOL force, void *param ) DECLSPEC_HIDDEN; extern BOOL macdrv_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) DECLSPEC_HIDDEN; extern BOOL macdrv_SetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) DECLSPEC_HIDDEN; -extern BOOL macdrv_ClipCursor(LPCRECT clip) DECLSPEC_HIDDEN; +extern BOOL macdrv_ClipCursor(const RECT *clip, BOOL reset) DECLSPEC_HIDDEN; extern LRESULT macdrv_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) DECLSPEC_HIDDEN; extern void macdrv_DestroyWindow(HWND hwnd) DECLSPEC_HIDDEN; extern void macdrv_SetDesktopWindow(HWND hwnd) DECLSPEC_HIDDEN; @@ -157,7 +157,6 @@ extern void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags const RECT *visible_rect, const RECT *valid_rects, struct window_surface *surface) DECLSPEC_HIDDEN; extern void macdrv_DestroyCursorIcon(HCURSOR cursor) DECLSPEC_HIDDEN; -extern BOOL macdrv_ClipCursor(LPCRECT clip) DECLSPEC_HIDDEN; extern BOOL macdrv_GetCursorPos(LPPOINT pos) DECLSPEC_HIDDEN; extern void macdrv_SetCapture(HWND hwnd, UINT flags) DECLSPEC_HIDDEN; extern void macdrv_SetCursor(HCURSOR cursor) DECLSPEC_HIDDEN; diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index cb194095d55..1ff0f631fe6 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -659,11 +659,13 @@ void macdrv_DestroyCursorIcon(HCURSOR cursor) * * Set the cursor clipping rectangle. */ -BOOL macdrv_ClipCursor(LPCRECT clip) +BOOL macdrv_ClipCursor(const RECT *clip, BOOL reset) { CGRect rect;
- TRACE("%s\n", wine_dbgstr_rect(clip)); + TRACE("%s %u\n", wine_dbgstr_rect(clip), reset); + + if (reset) return TRUE;
if (clip) { diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index fc35081652c..8d23facea99 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1557,17 +1557,18 @@ BOOL X11DRV_GetCursorPos(LPPOINT pos) /*********************************************************************** * ClipCursor (X11DRV.@) */ -BOOL X11DRV_ClipCursor( LPCRECT clip ) +BOOL X11DRV_ClipCursor( const RECT *clip, BOOL reset ) { - RECT virtual_rect = NtUserGetVirtualScreenRect(); + TRACE( "clip %p, reset %u\n", clip, reset );
- if (!clip) clip = &virtual_rect; - - if (grab_pointer) + if (!reset && grab_pointer) { + RECT virtual_rect = NtUserGetVirtualScreenRect(); HWND foreground = NtUserGetForegroundWindow(); DWORD tid, pid;
+ if (!clip) clip = &virtual_rect; + /* forward request to the foreground window if it's in a different thread */ tid = NtUserGetWindowThread( foreground, &pid ); if (tid && tid != GetCurrentThreadId() && pid == GetCurrentProcessId()) @@ -1615,7 +1616,7 @@ LRESULT clip_cursor_request( HWND hwnd, BOOL fullscreen, BOOL reset ) else { NtUserGetClipCursor( &clip ); - X11DRV_ClipCursor( &clip ); + X11DRV_ClipCursor( &clip, FALSE ); }
return 0; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9f6ba45d175..aea62c90b7c 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -216,7 +216,7 @@ extern void X11DRV_DestroyCursorIcon( HCURSOR handle ) DECLSPEC_HIDDEN; extern void X11DRV_SetCursor( HCURSOR handle ) DECLSPEC_HIDDEN; extern BOOL X11DRV_SetCursorPos( INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL X11DRV_GetCursorPos( LPPOINT pos ) DECLSPEC_HIDDEN; -extern BOOL X11DRV_ClipCursor( LPCRECT clip ) DECLSPEC_HIDDEN; +extern BOOL X11DRV_ClipCursor( const RECT *clip, BOOL reset ) DECLSPEC_HIDDEN; extern LONG X11DRV_ChangeDisplaySettings( LPDEVMODEW displays, LPCWSTR primary_name, HWND hwnd, DWORD flags, LPVOID lpvoid ) DECLSPEC_HIDDEN; extern BOOL X11DRV_GetCurrentDisplaySettings( LPCWSTR name, BOOL is_primary, LPDEVMODEW devmode ) DECLSPEC_HIDDEN; extern INT X11DRV_GetDisplayDepth( LPCWSTR name, BOOL is_primary ) DECLSPEC_HIDDEN; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index dc9a1b40d38..ff7d61a1274 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -301,7 +301,7 @@ struct user_driver_funcs void (*pSetCursor)(HCURSOR); BOOL (*pGetCursorPos)(LPPOINT); BOOL (*pSetCursorPos)(INT,INT); - BOOL (*pClipCursor)(LPCRECT); + BOOL (*pClipCursor)(const RECT*,BOOL); /* clipboard functions */ LRESULT (*pClipboardWindowProc)(HWND,UINT,WPARAM,LPARAM); void (*pUpdateClipboard)(void);