Commit 1cea2be9 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Move cursor clipping functions to input.c.

parent c22c10d6
......@@ -150,81 +150,6 @@ HCURSOR WINAPI NtUserGetCursor(void)
return ret;
}
/***********************************************************************
* NtUserClipCursor (win32u.@)
*/
BOOL WINAPI NtUserClipCursor( const RECT *rect )
{
UINT dpi;
BOOL ret;
RECT new_rect;
TRACE( "Clipping to %s\n", wine_dbgstr_rect(rect) );
if (rect)
{
if (rect->left > rect->right || rect->top > rect->bottom) return FALSE;
if ((dpi = get_thread_dpi()))
{
HMONITOR monitor = monitor_from_rect( rect, MONITOR_DEFAULTTOPRIMARY, dpi );
new_rect = map_dpi_rect( *rect, dpi, get_monitor_dpi( monitor ));
rect = &new_rect;
}
}
SERVER_START_REQ( set_cursor )
{
if (rect)
{
req->flags = SET_CURSOR_CLIP;
req->clip.left = rect->left;
req->clip.top = rect->top;
req->clip.right = rect->right;
req->clip.bottom = rect->bottom;
}
else req->flags = SET_CURSOR_NOCLIP;
if ((ret = !wine_server_call( req )))
{
new_rect.left = reply->new_clip.left;
new_rect.top = reply->new_clip.top;
new_rect.right = reply->new_clip.right;
new_rect.bottom = reply->new_clip.bottom;
}
}
SERVER_END_REQ;
if (ret) user_driver->pClipCursor( &new_rect );
return ret;
}
BOOL get_clip_cursor( RECT *rect )
{
UINT dpi;
BOOL ret;
if (!rect) return FALSE;
SERVER_START_REQ( set_cursor )
{
req->flags = 0;
if ((ret = !wine_server_call( req )))
{
rect->left = reply->new_clip.left;
rect->top = reply->new_clip.top;
rect->right = reply->new_clip.right;
rect->bottom = reply->new_clip.bottom;
}
}
SERVER_END_REQ;
if (ret && (dpi = get_thread_dpi()))
{
HMONITOR monitor = monitor_from_rect( rect, MONITOR_DEFAULTTOPRIMARY, 0 );
*rect = map_dpi_rect( *rect, get_monitor_dpi( monitor ), dpi );
}
return ret;
}
HICON alloc_cursoricon_handle( BOOL is_icon )
{
struct cursoricon_object *obj;
......
......@@ -2468,3 +2468,78 @@ BOOL WINAPI NtUserGetPointerInfoList( UINT32 id, POINTER_INPUT_TYPE type, UINT_P
RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
}
BOOL get_clip_cursor( RECT *rect )
{
UINT dpi;
BOOL ret;
if (!rect) return FALSE;
SERVER_START_REQ( set_cursor )
{
req->flags = 0;
if ((ret = !wine_server_call( req )))
{
rect->left = reply->new_clip.left;
rect->top = reply->new_clip.top;
rect->right = reply->new_clip.right;
rect->bottom = reply->new_clip.bottom;
}
}
SERVER_END_REQ;
if (ret && (dpi = get_thread_dpi()))
{
HMONITOR monitor = monitor_from_rect( rect, MONITOR_DEFAULTTOPRIMARY, 0 );
*rect = map_dpi_rect( *rect, get_monitor_dpi( monitor ), dpi );
}
return ret;
}
/***********************************************************************
* NtUserClipCursor (win32u.@)
*/
BOOL WINAPI NtUserClipCursor( const RECT *rect )
{
UINT dpi;
BOOL ret;
RECT new_rect;
TRACE( "Clipping to %s\n", wine_dbgstr_rect(rect) );
if (rect)
{
if (rect->left > rect->right || rect->top > rect->bottom) return FALSE;
if ((dpi = get_thread_dpi()))
{
HMONITOR monitor = monitor_from_rect( rect, MONITOR_DEFAULTTOPRIMARY, dpi );
new_rect = map_dpi_rect( *rect, dpi, get_monitor_dpi( monitor ));
rect = &new_rect;
}
}
SERVER_START_REQ( set_cursor )
{
if (rect)
{
req->flags = SET_CURSOR_CLIP;
req->clip.left = rect->left;
req->clip.top = rect->top;
req->clip.right = rect->right;
req->clip.bottom = rect->bottom;
}
else req->flags = SET_CURSOR_NOCLIP;
if ((ret = !wine_server_call( req )))
{
new_rect.left = reply->new_clip.left;
new_rect.top = reply->new_clip.top;
new_rect.right = reply->new_clip.right;
new_rect.bottom = reply->new_clip.bottom;
}
}
SERVER_END_REQ;
if (ret) user_driver->pClipCursor( &new_rect );
return ret;
}
......@@ -39,7 +39,6 @@ extern void release_clipboard_owner( HWND hwnd ) DECLSPEC_HIDDEN;
/* cursoricon.c */
extern HICON alloc_cursoricon_handle( BOOL is_icon ) DECLSPEC_HIDDEN;
extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN;
extern ULONG_PTR get_icon_param( HICON handle ) DECLSPEC_HIDDEN;
extern ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ) DECLSPEC_HIDDEN;
......@@ -101,6 +100,7 @@ extern BOOL set_caret_pos( int x, int y ) DECLSPEC_HIDDEN;
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;
/* menu.c */
extern HMENU create_menu( BOOL is_popup ) DECLSPEC_HIDDEN;
......
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