mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
win32u: Move WM_SETCURSOR implementation from user32.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
parent
67e39efb75
commit
bdae778e7f
4 changed files with 64 additions and 68 deletions
|
@ -123,7 +123,6 @@ extern LRESULT NC_HandleNCMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam ) D
|
||||||
extern LRESULT NC_HandleNCMouseLeave( HWND hwnd ) DECLSPEC_HIDDEN;
|
extern LRESULT NC_HandleNCMouseLeave( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
|
extern LRESULT NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
|
extern LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
/* scrollbar */
|
/* scrollbar */
|
||||||
|
|
||||||
|
|
|
@ -225,21 +225,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
|
||||||
case WM_CTLCOLOR:
|
case WM_CTLCOLOR:
|
||||||
return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) );
|
return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) );
|
||||||
|
|
||||||
case WM_SETCURSOR:
|
|
||||||
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD)
|
|
||||||
{
|
|
||||||
/* with the exception of the border around a resizable wnd,
|
|
||||||
* give the parent first chance to set the cursor */
|
|
||||||
if ((LOWORD(lParam) < HTSIZEFIRST) || (LOWORD(lParam) > HTSIZELAST))
|
|
||||||
{
|
|
||||||
HWND parent = GetParent( hwnd );
|
|
||||||
if (parent != GetDesktopWindow() &&
|
|
||||||
SendMessageW( parent, WM_SETCURSOR, wParam, lParam )) return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NC_HandleSetCursor( hwnd, wParam, lParam );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
return NC_HandleSysCommand( hwnd, wParam, lParam );
|
return NC_HandleSysCommand( hwnd, wParam, lParam );
|
||||||
|
|
||||||
|
|
|
@ -236,58 +236,6 @@ LRESULT NC_HandleNCMouseLeave(HWND hwnd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* NC_HandleSetCursor
|
|
||||||
*
|
|
||||||
* Handle a WM_SETCURSOR message. Called from DefWindowProc().
|
|
||||||
*/
|
|
||||||
LRESULT NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
|
|
||||||
{
|
|
||||||
hwnd = WIN_GetFullHandle( (HWND)wParam );
|
|
||||||
|
|
||||||
switch((short)LOWORD(lParam))
|
|
||||||
{
|
|
||||||
case HTERROR:
|
|
||||||
{
|
|
||||||
WORD msg = HIWORD( lParam );
|
|
||||||
if ((msg == WM_LBUTTONDOWN) || (msg == WM_MBUTTONDOWN) ||
|
|
||||||
(msg == WM_RBUTTONDOWN) || (msg == WM_XBUTTONDOWN))
|
|
||||||
MessageBeep(0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HTCLIENT:
|
|
||||||
{
|
|
||||||
HCURSOR hCursor = (HCURSOR)GetClassLongPtrW(hwnd, GCLP_HCURSOR);
|
|
||||||
if(hCursor) {
|
|
||||||
NtUserSetCursor(hCursor);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
case HTLEFT:
|
|
||||||
case HTRIGHT:
|
|
||||||
return (LRESULT)NtUserSetCursor( LoadCursorA( 0, (LPSTR)IDC_SIZEWE ) );
|
|
||||||
|
|
||||||
case HTTOP:
|
|
||||||
case HTBOTTOM:
|
|
||||||
return (LRESULT)NtUserSetCursor( LoadCursorA( 0, (LPSTR)IDC_SIZENS ) );
|
|
||||||
|
|
||||||
case HTTOPLEFT:
|
|
||||||
case HTBOTTOMRIGHT:
|
|
||||||
return (LRESULT)NtUserSetCursor( LoadCursorA( 0, (LPSTR)IDC_SIZENWSE ) );
|
|
||||||
|
|
||||||
case HTTOPRIGHT:
|
|
||||||
case HTBOTTOMLEFT:
|
|
||||||
return (LRESULT)NtUserSetCursor( LoadCursorA( 0, (LPSTR)IDC_SIZENESW ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default cursor: arrow */
|
|
||||||
return (LRESULT)NtUserSetCursor( LoadCursorA( 0, (LPSTR)IDC_ARROW ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* NC_TrackScrollBar
|
* NC_TrackScrollBar
|
||||||
|
|
|
@ -414,6 +414,55 @@ static HICON set_window_icon( HWND hwnd, WPARAM type, HICON icon )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT handle_set_cursor( HWND hwnd, WPARAM wparam, LPARAM lparam )
|
||||||
|
{
|
||||||
|
UINT cursor_id = IDC_ARROW;
|
||||||
|
HCURSOR cursor;
|
||||||
|
|
||||||
|
hwnd = get_full_window_handle( (HWND)wparam );
|
||||||
|
|
||||||
|
switch((short)LOWORD( lparam ))
|
||||||
|
{
|
||||||
|
case HTERROR:
|
||||||
|
{
|
||||||
|
WORD msg = HIWORD( lparam );
|
||||||
|
if (msg == WM_LBUTTONDOWN || msg == WM_MBUTTONDOWN ||
|
||||||
|
msg == WM_RBUTTONDOWN || msg == WM_XBUTTONDOWN)
|
||||||
|
message_beep( 0 );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTCLIENT:
|
||||||
|
cursor = (HCURSOR)get_class_long_ptr( hwnd, GCLP_HCURSOR, FALSE );
|
||||||
|
if (!cursor) return FALSE;
|
||||||
|
NtUserSetCursor( cursor );
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case HTLEFT:
|
||||||
|
case HTRIGHT:
|
||||||
|
cursor_id = IDC_SIZEWE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTTOP:
|
||||||
|
case HTBOTTOM:
|
||||||
|
cursor_id = IDC_SIZENS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTTOPLEFT:
|
||||||
|
case HTBOTTOMRIGHT:
|
||||||
|
cursor_id = IDC_SIZENWSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HTTOPRIGHT:
|
||||||
|
case HTBOTTOMLEFT:
|
||||||
|
cursor_id = IDC_SIZENESW;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor = LoadImageW( 0, MAKEINTRESOURCEW( cursor_id ), IMAGE_CURSOR,
|
||||||
|
0, 0, LR_SHARED | LR_DEFAULTSIZE );
|
||||||
|
return (LRESULT)NtUserSetCursor( cursor );
|
||||||
|
}
|
||||||
|
|
||||||
static LONG handle_window_pos_changing( HWND hwnd, WINDOWPOS *winpos )
|
static LONG handle_window_pos_changing( HWND hwnd, WINDOWPOS *winpos )
|
||||||
{
|
{
|
||||||
LONG style = get_window_long( hwnd, GWL_STYLE );
|
LONG style = get_window_long( hwnd, GWL_STYLE );
|
||||||
|
@ -2307,6 +2356,21 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
|
||||||
result = (LRESULT)get_window_icon( hwnd, wparam );
|
result = (LRESULT)get_window_icon( hwnd, wparam );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_SETCURSOR:
|
||||||
|
if (get_window_long( hwnd, GWL_STYLE ) & WS_CHILD)
|
||||||
|
{
|
||||||
|
/* with the exception of the border around a resizable window,
|
||||||
|
* give the parent first chance to set the cursor */
|
||||||
|
if ((LOWORD( lparam ) < HTSIZEFIRST) || (LOWORD( lparam ) > HTSIZELAST))
|
||||||
|
{
|
||||||
|
HWND parent = get_parent( hwnd );
|
||||||
|
if (parent != get_desktop_window() &&
|
||||||
|
send_message( parent, WM_SETCURSOR, wparam, lparam )) return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handle_set_cursor( hwnd, wparam, lparam );
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
result = handle_sys_command( hwnd, wparam, lparam );
|
result = handle_sys_command( hwnd, wparam, lparam );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue