Commit a8ed1c94 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserDragDetect implementation from user32.

parent 540dc761
...@@ -1482,47 +1482,9 @@ BOOL WINAPI SetWindowContextHelpId( HWND hwnd, DWORD id ) ...@@ -1482,47 +1482,9 @@ BOOL WINAPI SetWindowContextHelpId( HWND hwnd, DWORD id )
/******************************************************************* /*******************************************************************
* DragDetect (USER32.@) * DragDetect (USER32.@)
*/ */
BOOL WINAPI DragDetect( HWND hWnd, POINT pt ) BOOL WINAPI DragDetect( HWND hwnd, POINT pt )
{ {
MSG msg; return NtUserDragDetect( hwnd, pt.x, pt.y );
RECT rect;
WORD wDragWidth, wDragHeight;
TRACE( "%p,%s\n", hWnd, wine_dbgstr_point( &pt ) );
if (!(NtUserGetKeyState( VK_LBUTTON ) & 0x8000))
return FALSE;
wDragWidth = GetSystemMetrics(SM_CXDRAG);
wDragHeight= GetSystemMetrics(SM_CYDRAG);
SetRect(&rect, pt.x - wDragWidth, pt.y - wDragHeight, pt.x + wDragWidth, pt.y + wDragHeight);
NtUserSetCapture( hWnd );
while(1)
{
while (PeekMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ))
{
if( msg.message == WM_LBUTTONUP )
{
ReleaseCapture();
return FALSE;
}
if( msg.message == WM_MOUSEMOVE )
{
POINT tmp;
tmp.x = (short)LOWORD(msg.lParam);
tmp.y = (short)HIWORD(msg.lParam);
if( !PtInRect( &rect, tmp ))
{
ReleaseCapture();
return TRUE;
}
}
}
WaitMessage();
}
return FALSE;
} }
/****************************************************************************** /******************************************************************************
......
...@@ -1158,6 +1158,7 @@ static struct unix_funcs unix_funcs = ...@@ -1158,6 +1158,7 @@ static struct unix_funcs unix_funcs =
NtUserDestroyMenu, NtUserDestroyMenu,
NtUserDestroyWindow, NtUserDestroyWindow,
NtUserDispatchMessage, NtUserDispatchMessage,
NtUserDragDetect,
NtUserDrawIconEx, NtUserDrawIconEx,
NtUserEmptyClipboard, NtUserEmptyClipboard,
NtUserEnableMenuItem, NtUserEnableMenuItem,
......
...@@ -1394,6 +1394,51 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info ) ...@@ -1394,6 +1394,51 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info )
return TRUE; return TRUE;
} }
/*******************************************************************
* NtUserDragDetect (win32u.@)
*/
BOOL WINAPI NtUserDragDetect( HWND hwnd, int x, int y )
{
WORD width, height;
RECT rect;
MSG msg;
TRACE( "%p (%d,%d)\n", hwnd, x, y );
if (!(NtUserGetKeyState( VK_LBUTTON ) & 0x8000)) return FALSE;
width = get_system_metrics( SM_CXDRAG );
height = get_system_metrics( SM_CYDRAG );
SetRect( &rect, x - width, y - height, x + width, y + height );
NtUserSetCapture( hwnd );
for (;;)
{
while (NtUserPeekMessage( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ))
{
if (msg.message == WM_LBUTTONUP)
{
release_capture();
return FALSE;
}
if (msg.message == WM_MOUSEMOVE)
{
POINT tmp;
tmp.x = (short)LOWORD( msg.lParam );
tmp.y = (short)HIWORD( msg.lParam );
if (!PtInRect( &rect, tmp ))
{
release_capture();
return TRUE;
}
}
}
NtUserMsgWaitForMultipleObjectsEx( 0, NULL, INFINITE, QS_ALLINPUT, 0 );
}
return FALSE;
}
/********************************************************************** /**********************************************************************
* set_capture_window * set_capture_window
*/ */
......
...@@ -845,7 +845,7 @@ ...@@ -845,7 +845,7 @@
@ stub NtUserDoSoundConnect @ stub NtUserDoSoundConnect
@ stub NtUserDoSoundDisconnect @ stub NtUserDoSoundDisconnect
@ stub NtUserDownlevelTouchpad @ stub NtUserDownlevelTouchpad
@ stub NtUserDragDetect @ stdcall NtUserDragDetect(long long long)
@ stub NtUserDragObject @ stub NtUserDragObject
@ stub NtUserDrawAnimatedRects @ stub NtUserDrawAnimatedRects
@ stub NtUserDrawCaption @ stub NtUserDrawCaption
......
...@@ -214,6 +214,7 @@ struct unix_funcs ...@@ -214,6 +214,7 @@ struct unix_funcs
BOOL (WINAPI *pNtUserDestroyMenu)( HMENU handle ); BOOL (WINAPI *pNtUserDestroyMenu)( HMENU handle );
BOOL (WINAPI *pNtUserDestroyWindow)( HWND hwnd ); BOOL (WINAPI *pNtUserDestroyWindow)( HWND hwnd );
LRESULT (WINAPI *pNtUserDispatchMessage)( const MSG *msg ); LRESULT (WINAPI *pNtUserDispatchMessage)( const MSG *msg );
BOOL (WINAPI *pNtUserDragDetect)( HWND hwnd, int x, int y );
BOOL (WINAPI *pNtUserDrawIconEx)( HDC hdc, INT x0, INT y0, HICON icon, INT width, BOOL (WINAPI *pNtUserDrawIconEx)( HDC hdc, INT x0, INT y0, HICON icon, INT width,
INT height, UINT istep, HBRUSH hbr, UINT flags ); INT height, UINT istep, HBRUSH hbr, UINT flags );
BOOL (WINAPI *pNtUserEmptyClipboard)(void); BOOL (WINAPI *pNtUserEmptyClipboard)(void);
......
...@@ -855,6 +855,12 @@ LRESULT WINAPI NtUserDispatchMessage( const MSG *msg ) ...@@ -855,6 +855,12 @@ LRESULT WINAPI NtUserDispatchMessage( const MSG *msg )
return unix_funcs->pNtUserDispatchMessage( msg ); return unix_funcs->pNtUserDispatchMessage( msg );
} }
BOOL WINAPI NtUserDragDetect( HWND hwnd, int x, int y )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserDragDetect( hwnd, x, y );
}
BOOL WINAPI NtUserDrawIconEx( HDC hdc, INT x0, INT y0, HICON icon, INT width, BOOL WINAPI NtUserDrawIconEx( HDC hdc, INT x0, INT y0, HICON icon, INT width,
INT height, UINT istep, HBRUSH hbr, UINT flags ) INT height, UINT istep, HBRUSH hbr, UINT flags )
{ {
......
...@@ -513,6 +513,7 @@ BOOL WINAPI NtUserDestroyCursor( HCURSOR cursor, ULONG arg ); ...@@ -513,6 +513,7 @@ BOOL WINAPI NtUserDestroyCursor( HCURSOR cursor, ULONG arg );
BOOL WINAPI NtUserDestroyMenu( HMENU menu ); BOOL WINAPI NtUserDestroyMenu( HMENU menu );
BOOL WINAPI NtUserDestroyWindow( HWND hwnd ); BOOL WINAPI NtUserDestroyWindow( HWND hwnd );
LRESULT WINAPI NtUserDispatchMessage( const MSG *msg ); LRESULT WINAPI NtUserDispatchMessage( const MSG *msg );
BOOL WINAPI NtUserDragDetect( HWND hwnd, int x, int y );
BOOL WINAPI NtUserDrawIconEx( HDC hdc, INT x0, INT y0, HICON icon, INT width, BOOL WINAPI NtUserDrawIconEx( HDC hdc, INT x0, INT y0, HICON icon, INT width,
INT height, UINT istep, HBRUSH hbr, UINT flags ); INT height, UINT istep, HBRUSH hbr, UINT flags );
BOOL WINAPI NtUserEmptyClipboard(void); BOOL WINAPI NtUserEmptyClipboard(void);
......
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