win32u: Move NtUserSetCapture implementation from user32.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5deb0412f6
commit
4f6ba11fde
|
@ -262,7 +262,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
|
|||
{
|
||||
SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 );
|
||||
set_button_state( hWnd, get_button_state( hWnd ) | BUTTON_BTNPRESSED );
|
||||
SetCapture( hWnd );
|
||||
NtUserSetCapture( hWnd );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -277,7 +277,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
|
|||
}
|
||||
/* fall through */
|
||||
case WM_LBUTTONDOWN:
|
||||
SetCapture( hWnd );
|
||||
NtUserSetCapture( hWnd );
|
||||
NtUserSetFocus( hWnd );
|
||||
set_button_state( hWnd, get_button_state( hWnd ) | BUTTON_BTNPRESSED );
|
||||
SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 );
|
||||
|
|
|
@ -1007,7 +1007,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
|||
|
||||
EnableWindow( lphc->hWndLBox, TRUE );
|
||||
if (GetCapture() != lphc->self)
|
||||
SetCapture(lphc->hWndLBox);
|
||||
NtUserSetCapture(lphc->hWndLBox);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1605,7 +1605,7 @@ static void COMBO_LButtonDown( LPHEADCOMBO lphc, LPARAM lParam )
|
|||
/* drop down the listbox and start tracking */
|
||||
|
||||
lphc->wState |= CBF_CAPTURE;
|
||||
SetCapture( hWnd );
|
||||
NtUserSetCapture( hWnd );
|
||||
CBDropDown( lphc );
|
||||
}
|
||||
if( bButton ) CBRepaintButton( lphc );
|
||||
|
@ -1634,7 +1634,7 @@ static void COMBO_LButtonUp( LPHEADCOMBO lphc )
|
|||
}
|
||||
}
|
||||
ReleaseCapture();
|
||||
SetCapture(lphc->hWndLBox);
|
||||
NtUserSetCapture(lphc->hWndLBox);
|
||||
}
|
||||
|
||||
if( lphc->wState & CBF_BUTTONDOWN )
|
||||
|
|
|
@ -100,10 +100,6 @@ static void CDECL nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
|
|||
{
|
||||
}
|
||||
|
||||
static void CDECL nulldrv_SetCapture( HWND hwnd, UINT flags )
|
||||
{
|
||||
}
|
||||
|
||||
static void CDECL nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
|
||||
{
|
||||
}
|
||||
|
@ -207,7 +203,7 @@ static struct user_driver_funcs lazy_load_driver =
|
|||
nulldrv_MsgWaitForMultipleObjectsEx,
|
||||
nulldrv_ReleaseDC,
|
||||
NULL,
|
||||
nulldrv_SetCapture,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nulldrv_SetParent,
|
||||
|
@ -254,7 +250,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
|
|||
SET_USER_FUNC(GetDC);
|
||||
SET_USER_FUNC(MsgWaitForMultipleObjectsEx);
|
||||
SET_USER_FUNC(ReleaseDC);
|
||||
SET_USER_FUNC(SetCapture);
|
||||
SET_USER_FUNC(SetParent);
|
||||
SET_USER_FUNC(SetWindowIcon);
|
||||
SET_USER_FUNC(SetWindowStyle);
|
||||
|
|
|
@ -3584,7 +3584,7 @@ static LRESULT EDIT_WM_LButtonDblClk(EDITSTATE *es)
|
|||
INT ll;
|
||||
|
||||
es->bCaptureState = TRUE;
|
||||
SetCapture(es->hwndSelf);
|
||||
NtUserSetCapture(es->hwndSelf);
|
||||
|
||||
l = EDIT_EM_LineFromChar(es, e);
|
||||
li = EDIT_EM_LineIndex(es, l);
|
||||
|
@ -3610,7 +3610,7 @@ static LRESULT EDIT_WM_LButtonDown(EDITSTATE *es, DWORD keys, INT x, INT y)
|
|||
BOOL after_wrap;
|
||||
|
||||
es->bCaptureState = TRUE;
|
||||
SetCapture(es->hwndSelf);
|
||||
NtUserSetCapture(es->hwndSelf);
|
||||
EDIT_ConfinePoint(es, &x, &y);
|
||||
e = EDIT_CharFromPos(es, x, y, &after_wrap);
|
||||
EDIT_EM_SetSel(es, (keys & MK_SHIFT) ? es->selection_start : e, e, after_wrap);
|
||||
|
|
|
@ -117,35 +117,8 @@ static HKL get_locale_kbd_layout(void)
|
|||
*/
|
||||
BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
{
|
||||
HWND previous = 0;
|
||||
UINT flags = 0;
|
||||
BOOL ret;
|
||||
|
||||
if (gui_flags & GUI_INMENUMODE) flags |= CAPTURE_MENU;
|
||||
if (gui_flags & GUI_INMOVESIZE) flags |= CAPTURE_MOVESIZE;
|
||||
|
||||
SERVER_START_REQ( set_capture_window )
|
||||
{
|
||||
req->handle = wine_server_user_handle( hwnd );
|
||||
req->flags = flags;
|
||||
if ((ret = !wine_server_call_err( req )))
|
||||
{
|
||||
previous = wine_server_ptr_handle( reply->previous );
|
||||
hwnd = wine_server_ptr_handle( reply->full_handle );
|
||||
}
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
USER_Driver->pSetCapture( hwnd, gui_flags );
|
||||
|
||||
if (previous)
|
||||
SendMessageW( previous, WM_CAPTURECHANGED, 0, (LPARAM)hwnd );
|
||||
|
||||
if (prev_ret) *prev_ret = previous;
|
||||
}
|
||||
return ret;
|
||||
/* FIXME: move callers to win32u or use NtUserSetCapture */
|
||||
return NtUserCallHwndParam( hwnd, gui_flags, NtUserSetCaptureWindow );
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,29 +280,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* SetCapture (USER32.@)
|
||||
*/
|
||||
HWND WINAPI DECLSPEC_HOTPATCH SetCapture( HWND hwnd )
|
||||
{
|
||||
HWND previous = 0;
|
||||
|
||||
set_capture_window( hwnd, 0, &previous );
|
||||
return previous;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* ReleaseCapture (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseCapture(void)
|
||||
{
|
||||
BOOL ret = set_capture_window( 0, 0, NULL );
|
||||
|
||||
/* Somebody may have missed some mouse movements */
|
||||
if (ret) mouse_event( MOUSEEVENTF_MOVE, 0, 0, 0, 0 );
|
||||
|
||||
return ret;
|
||||
return NtUserCallNoParam( NtUserReleaseCapture );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2145,7 +2145,7 @@ static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr, DWORD keys, INT x, IN
|
|||
}
|
||||
|
||||
descr->captured = TRUE;
|
||||
SetCapture( descr->self );
|
||||
NtUserSetCapture( descr->self );
|
||||
|
||||
if (descr->style & (LBS_EXTENDEDSEL | LBS_MULTIPLESEL))
|
||||
{
|
||||
|
@ -2294,7 +2294,7 @@ static LRESULT LISTBOX_HandleLButtonDownCombo( LB_DESCR *descr, UINT msg, DWORD
|
|||
/* Resume the Capture after scrolling is complete
|
||||
*/
|
||||
if(hWndOldCapture != 0)
|
||||
SetCapture(hWndOldCapture);
|
||||
NtUserSetCapture(hWndOldCapture);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1240,7 +1240,7 @@ static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam )
|
|||
paintButton = NC_DrawMaxButton;
|
||||
}
|
||||
|
||||
SetCapture( hwnd );
|
||||
NtUserSetCapture( hwnd );
|
||||
|
||||
(*paintButton)( hwnd, hdc, TRUE, FALSE);
|
||||
|
||||
|
@ -1305,7 +1305,7 @@ static void NC_TrackCloseButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
hdc = GetWindowDC( hwnd );
|
||||
|
||||
SetCapture( hwnd );
|
||||
NtUserSetCapture( hwnd );
|
||||
|
||||
NC_DrawCloseButton (hwnd, hdc, TRUE, FALSE);
|
||||
|
||||
|
@ -1460,7 +1460,7 @@ LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
|
|||
{
|
||||
case HTCAPTION:
|
||||
case HTSYSMENU:
|
||||
SetCapture( hwnd );
|
||||
NtUserSetCapture( hwnd );
|
||||
for (;;)
|
||||
{
|
||||
if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break;
|
||||
|
|
|
@ -816,7 +816,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt )
|
|||
{
|
||||
case WM_LBUTTONDOWN: /* Initialise mouse tracking */
|
||||
HideCaret(hwnd); /* hide caret while holding down LBUTTON */
|
||||
SetCapture( hwnd );
|
||||
NtUserSetCapture( hwnd );
|
||||
prevPt = pt;
|
||||
g_tracking_info.hit_test = hittest = SCROLL_THUMB;
|
||||
break;
|
||||
|
@ -853,7 +853,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt )
|
|||
trackThumbPos = thumbPos;
|
||||
prevPt = pt;
|
||||
if (nBar == SB_CTL && (GetWindowLongW(hwnd, GWL_STYLE) & WS_TABSTOP)) NtUserSetFocus( hwnd );
|
||||
SetCapture( hwnd );
|
||||
NtUserSetCapture( hwnd );
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
|
|
|
@ -645,7 +645,7 @@
|
|||
@ stdcall SendNotifyMessageW(long long long long)
|
||||
@ stub ServerSetFunctionPointers
|
||||
@ stdcall SetActiveWindow(long) NtUserSetActiveWindow
|
||||
@ stdcall SetCapture(long)
|
||||
@ stdcall -import SetCapture(long) NtUserSetCapture
|
||||
@ stdcall SetCaretBlinkTime(long)
|
||||
@ stdcall SetCaretPos(long long)
|
||||
@ stdcall SetClassLongA(long long long)
|
||||
|
|
|
@ -145,6 +145,7 @@ static const struct user_callbacks user_funcs =
|
|||
CopyImage,
|
||||
PostMessageW,
|
||||
RedrawWindow,
|
||||
SendInput,
|
||||
SendMessageTimeoutW,
|
||||
SendMessageW,
|
||||
SendNotifyMessageW,
|
||||
|
|
|
@ -3137,7 +3137,7 @@ BOOL WINAPI DragDetect( HWND hWnd, POINT pt )
|
|||
wDragHeight= GetSystemMetrics(SM_CYDRAG);
|
||||
SetRect(&rect, pt.x - wDragWidth, pt.y - wDragHeight, pt.x + wDragWidth, pt.y + wDragHeight);
|
||||
|
||||
SetCapture(hWnd);
|
||||
NtUserSetCapture( hWnd );
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
|
|
@ -1185,6 +1185,7 @@ static const struct user_driver_funcs lazy_load_driver =
|
|||
/* windowing functions */
|
||||
.pCreateDesktopWindow = loaderdrv_CreateDesktopWindow,
|
||||
.pFlashWindowEx = loaderdrv_FlashWindowEx,
|
||||
.pSetCapture = nulldrv_SetCapture,
|
||||
.pSetLayeredWindowAttributes = loaderdrv_SetLayeredWindowAttributes,
|
||||
.pSetWindowRgn = loaderdrv_SetWindowRgn,
|
||||
.pMsgWaitForMultipleObjectsEx = nulldrv_MsgWaitForMultipleObjectsEx,
|
||||
|
|
|
@ -1183,6 +1183,7 @@ static struct unix_funcs unix_funcs =
|
|||
NtUserScrollDC,
|
||||
NtUserSelectPalette,
|
||||
NtUserSetActiveWindow,
|
||||
NtUserSetCapture,
|
||||
NtUserSetClassLong,
|
||||
NtUserSetClassLongPtr,
|
||||
NtUserSetClassWord,
|
||||
|
|
|
@ -65,6 +65,15 @@ BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach )
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NtUserSendInput (win32u.@)
|
||||
*/
|
||||
UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size )
|
||||
{
|
||||
if (!user_callbacks) return 0;
|
||||
return user_callbacks->pSendInput( count, inputs, size );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NtUserSetCursorPos (win32u.@)
|
||||
*/
|
||||
|
@ -1063,6 +1072,71 @@ int WINAPI NtUserGetMouseMovePointsEx( UINT size, MOUSEMOVEPOINT *ptin, MOUSEMOV
|
|||
return copied;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* set_capture_window
|
||||
*/
|
||||
BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
{
|
||||
HWND previous = 0;
|
||||
UINT flags = 0;
|
||||
BOOL ret;
|
||||
|
||||
if (gui_flags & GUI_INMENUMODE) flags |= CAPTURE_MENU;
|
||||
if (gui_flags & GUI_INMOVESIZE) flags |= CAPTURE_MOVESIZE;
|
||||
|
||||
SERVER_START_REQ( set_capture_window )
|
||||
{
|
||||
req->handle = wine_server_user_handle( hwnd );
|
||||
req->flags = flags;
|
||||
if ((ret = !wine_server_call_err( req )))
|
||||
{
|
||||
previous = wine_server_ptr_handle( reply->previous );
|
||||
hwnd = wine_server_ptr_handle( reply->full_handle );
|
||||
}
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
user_driver->pSetCapture( hwnd, gui_flags );
|
||||
|
||||
if (previous)
|
||||
send_message( previous, WM_CAPTURECHANGED, 0, (LPARAM)hwnd );
|
||||
|
||||
if (prev_ret) *prev_ret = previous;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* NtUserSetCapture (win32u.@)
|
||||
*/
|
||||
HWND WINAPI NtUserSetCapture( HWND hwnd )
|
||||
{
|
||||
HWND previous = 0;
|
||||
|
||||
set_capture_window( hwnd, 0, &previous );
|
||||
return previous;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* release_capture
|
||||
*/
|
||||
BOOL WINAPI release_capture(void)
|
||||
{
|
||||
BOOL ret = set_capture_window( 0, 0, NULL );
|
||||
|
||||
/* Somebody may have missed some mouse movements */
|
||||
if (ret)
|
||||
{
|
||||
INPUT input = { .type = INPUT_MOUSE };
|
||||
input.mi.dwFlags = MOUSEEVENTF_MOVE;
|
||||
NtUserSendInput( 1, &input, sizeof(input) );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* NtUserGetForegroundWindow (win32u.@)
|
||||
*/
|
||||
|
|
|
@ -32,6 +32,7 @@ struct user_callbacks
|
|||
HANDLE (WINAPI *pCopyImage)( HANDLE, UINT, INT, INT, UINT );
|
||||
BOOL (WINAPI *pPostMessageW)( HWND, UINT, WPARAM, LPARAM );
|
||||
BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
|
||||
UINT (WINAPI *pSendInput)( UINT count, INPUT *inputs, int size );
|
||||
LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
|
||||
LRESULT (WINAPI *pSendMessageW)( HWND, UINT, WPARAM, LPARAM );
|
||||
BOOL (WINAPI *pSendNotifyMessageW)( HWND, UINT, WPARAM, LPARAM );
|
||||
|
|
|
@ -4613,6 +4613,8 @@ ULONG_PTR WINAPI NtUserCallNoParam( ULONG code )
|
|||
return HandleToUlong( get_desktop_window() );
|
||||
case NtUserGetInputState:
|
||||
return get_input_state();
|
||||
case NtUserReleaseCapture:
|
||||
return release_capture();
|
||||
/* temporary exports */
|
||||
case NtUserThreadDetach:
|
||||
thread_detach();
|
||||
|
|
|
@ -1169,7 +1169,7 @@
|
|||
@ stub NtUserSetBridgeWindowChild
|
||||
@ stub NtUserSetBrokeredForeground
|
||||
@ stub NtUserSetCalibrationData
|
||||
@ stub NtUserSetCapture
|
||||
@ stdcall NtUserSetCapture(long)
|
||||
@ stub NtUserSetChildWindowNoActivate
|
||||
@ stdcall NtUserSetClassLong(long long long long)
|
||||
@ stdcall NtUserSetClassLongPtr(long long long long)
|
||||
|
|
|
@ -228,6 +228,7 @@ struct unix_funcs
|
|||
HRGN ret_update_rgn, RECT *update_rect );
|
||||
HPALETTE (WINAPI *pNtUserSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg );
|
||||
HWND (WINAPI *pNtUserSetActiveWindow)( HWND hwnd );
|
||||
HWND (WINAPI *pNtUserSetCapture)( HWND hwnd );
|
||||
DWORD (WINAPI *pNtUserSetClassLong)( HWND hwnd, INT offset, LONG newval, BOOL ansi );
|
||||
ULONG_PTR (WINAPI *pNtUserSetClassLongPtr)( HWND hwnd, INT offset, LONG_PTR newval, BOOL ansi );
|
||||
WORD (WINAPI *pNtUserSetClassWord)( HWND hwnd, INT offset, WORD newval );
|
||||
|
@ -289,6 +290,8 @@ extern LONG global_key_state_counter DECLSPEC_HIDDEN;
|
|||
extern HWND get_active_window(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL get_cursor_pos( POINT *pt ) DECLSPEC_HIDDEN;
|
||||
extern DWORD get_input_state(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL WINAPI release_capture(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN;
|
||||
extern BOOL set_foreground_window( HWND hwnd, BOOL mouse ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* message.c */
|
||||
|
|
|
@ -1945,6 +1945,8 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
|
|||
return is_child( hwnd, UlongToHandle(param) );
|
||||
case NtUserMonitorFromWindow:
|
||||
return HandleToUlong( monitor_from_window( hwnd, param, NtUserMonitorFromWindow ));
|
||||
case NtUserSetCaptureWindow:
|
||||
return set_capture_window( hwnd, param, NULL );
|
||||
case NtUserSetForegroundWindow:
|
||||
return set_foreground_window( hwnd, param );
|
||||
/* temporary exports */
|
||||
|
|
|
@ -909,6 +909,12 @@ HWND WINAPI NtUserSetActiveWindow( HWND hwnd )
|
|||
return unix_funcs->pNtUserSetActiveWindow( hwnd );
|
||||
}
|
||||
|
||||
HWND WINAPI NtUserSetCapture( HWND hwnd )
|
||||
{
|
||||
if (!unix_funcs) return 0;
|
||||
return unix_funcs->pNtUserSetCapture( hwnd );
|
||||
}
|
||||
|
||||
HCURSOR WINAPI NtUserSetCursor( HCURSOR cursor )
|
||||
{
|
||||
if (!unix_funcs) return 0;
|
||||
|
|
|
@ -89,6 +89,7 @@ enum
|
|||
{
|
||||
NtUserGetDesktopWindow,
|
||||
NtUserGetInputState,
|
||||
NtUserReleaseCapture,
|
||||
/* temporary exports */
|
||||
NtUserThreadDetach,
|
||||
};
|
||||
|
@ -173,6 +174,7 @@ enum
|
|||
NtUserGetWindowWord,
|
||||
NtUserIsChild,
|
||||
NtUserMonitorFromWindow,
|
||||
NtUserSetCaptureWindow,
|
||||
NtUserSetForegroundWindow,
|
||||
/* temporary exports */
|
||||
NtUserIsWindowDrawable,
|
||||
|
@ -367,6 +369,7 @@ BOOL WINAPI NtUserScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, cons
|
|||
HRGN ret_update_rgn, RECT *update_rect );
|
||||
HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE palette, WORD force_background );
|
||||
HWND WINAPI NtUserSetActiveWindow( HWND hwnd );
|
||||
HWND WINAPI NtUserSetCapture( HWND hwnd );
|
||||
DWORD WINAPI NtUserSetClassLong( HWND hwnd, INT offset, LONG newval, BOOL ansi );
|
||||
ULONG_PTR WINAPI NtUserSetClassLongPtr( HWND hwnd, INT offset, LONG_PTR newval, BOOL ansi );
|
||||
WORD WINAPI NtUserSetClassWord( HWND hwnd, INT offset, WORD newval );
|
||||
|
|
Loading…
Reference in New Issue