Commit 8d2de5db authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Use a specific flag instead of shrinking the clip rect.

parent ab9b99c4
......@@ -2470,9 +2470,10 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
{
struct user_thread_info *thread_info = get_user_thread_info();
MONITORINFO monitor_info = {.cbSize = sizeof(MONITORINFO)};
RECT rect, virtual_rect = NtUserGetVirtualScreenRect();
RECT rect;
HMONITOR monitor;
DWORD style;
BOOL ret;
if (hwnd == NtUserGetDesktopWindow()) return FALSE;
if (hwnd != NtUserGetForegroundWindow()) return FALSE;
......@@ -2497,11 +2498,20 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
if (is_virtual_desktop()) return FALSE;
}
/* shrink the clipping rect to make sure it is not ignored for being fullscreen */
if (EqualRect( &monitor_info.rcMonitor, &virtual_rect )) InflateRect( &monitor_info.rcMonitor, -1, -1 );
TRACE( "win %p clipping fullscreen\n", hwnd );
return NtUserClipCursor( &monitor_info.rcMonitor );
SERVER_START_REQ( set_cursor )
{
req->flags = SET_CURSOR_CLIP | SET_CURSOR_FSCLIP;
req->clip.left = monitor_info.rcMonitor.left;
req->clip.top = monitor_info.rcMonitor.top;
req->clip.right = monitor_info.rcMonitor.right;
req->clip.bottom = monitor_info.rcMonitor.bottom;
ret = !wine_server_call( req );
}
SERVER_END_REQ;
return ret;
}
/**********************************************************************
......@@ -2567,7 +2577,7 @@ BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset )
get_clip_cursor( &rect );
intersect_rect( &rect, &rect, &virtual_rect );
if (EqualRect( &rect, &virtual_rect )) empty = TRUE;
if (empty)
if (empty && !(flags & SET_CURSOR_FSCLIP))
{
/* if currently clipping, check if we should switch to fullscreen clipping */
if (was_clipping && clip_fullscreen_window( hwnd, TRUE )) return TRUE;
......
......@@ -1274,7 +1274,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
case WM_WINE_CLIPCURSOR:
/* non-hardware message, posted on display mode change to trigger fullscreen
clipping or to the desktop window to forcefully release the cursor grabs */
if (!wparam) return clip_fullscreen_window( hwnd, FALSE );
if (wparam & SET_CURSOR_FSCLIP) return clip_fullscreen_window( hwnd, FALSE );
return process_wine_clipcursor( hwnd, wparam, lparam );
case WM_WINE_SETCURSOR:
FIXME( "Unexpected non-hardware WM_WINE_SETCURSOR message\n" );
......
......@@ -2929,7 +2929,7 @@ static LONG apply_display_settings( const WCHAR *devname, const DEVMODEW *devmod
MAKELPARAM( current_mode.dmPelsWidth, current_mode.dmPelsHeight ),
SMTO_ABORTIFHUNG, 2000, FALSE );
/* post clip_fullscreen_window request to the foreground window */
NtUserPostMessage( NtUserGetForegroundWindow(), WM_WINE_CLIPCURSOR, 0, 0 );
NtUserPostMessage( NtUserGetForegroundWindow(), WM_WINE_CLIPCURSOR, SET_CURSOR_FSCLIP, 0 );
}
return ret;
......
......@@ -5357,6 +5357,7 @@ struct set_cursor_reply
#define SET_CURSOR_POS 0x04
#define SET_CURSOR_CLIP 0x08
#define SET_CURSOR_NOCLIP 0x10
#define SET_CURSOR_FSCLIP 0x20
struct get_cursor_history_request
......@@ -6417,7 +6418,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 776
#define SERVER_PROTOCOL_VERSION 777
/* ### protocol_version end ### */
......
......@@ -3719,6 +3719,7 @@ struct handle_info
#define SET_CURSOR_POS 0x04
#define SET_CURSOR_CLIP 0x08
#define SET_CURSOR_NOCLIP 0x10
#define SET_CURSOR_FSCLIP 0x20
/* Get the history of the 64 last cursor positions */
@REQ(get_cursor_history)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment