mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[Win32k]
- Move the drag detection routine to kernel space, this will decrease the number of kernel calls that is noticeable with slower systems running an emulator. svn path=/trunk/; revision=51021
This commit is contained in:
parent
f33b16a71d
commit
47dde244bd
5 changed files with 96 additions and 25 deletions
|
@ -48,9 +48,8 @@ DragDetect(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
POINT pt)
|
POINT pt)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
return NtUserDragDetect(hWnd, pt);
|
return NtUserDragDetect(hWnd, pt);
|
||||||
#else
|
#if 0
|
||||||
MSG msg;
|
MSG msg;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
POINT tmp;
|
POINT tmp;
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
NtGdiPtInRegion((WndObject)->hrgnClip, (INT)((x) - (WndObject)->rcWindow.left), \
|
NtGdiPtInRegion((WndObject)->hrgnClip, (INT)((x) - (WndObject)->rcWindow.left), \
|
||||||
(INT)((y) - (WndObject)->rcWindow.top))))
|
(INT)((y) - (WndObject)->rcWindow.top))))
|
||||||
|
|
||||||
|
#define IntPtInRect(lprc,pt) \
|
||||||
|
((pt.x >= (lprc)->left) && (pt.x < (lprc)->right) && (pt.y >= (lprc)->top) && (pt.y < (lprc)->bottom))
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
FASTCALL co_WinPosArrangeIconicWindows(PWND parent);
|
FASTCALL co_WinPosArrangeIconicWindows(PWND parent);
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
|
|
|
@ -534,29 +534,23 @@ CLEANUP:
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
HWND FASTCALL
|
||||||
*/
|
co_UserSetCapture(HWND hWnd)
|
||||||
HWND APIENTRY
|
|
||||||
NtUserSetCapture(HWND hWnd)
|
|
||||||
{
|
{
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
PWND Window, pWnd;
|
PWND Window, pWnd;
|
||||||
HWND hWndPrev;
|
HWND hWndPrev;
|
||||||
DECLARE_RETURN(HWND);
|
|
||||||
|
|
||||||
DPRINT("Enter NtUserSetCapture(%x)\n", hWnd);
|
|
||||||
UserEnterExclusive();
|
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
ThreadQueue = pti->MessageQueue;
|
ThreadQueue = pti->MessageQueue;
|
||||||
|
|
||||||
if((Window = UserGetWindowObject(hWnd)))
|
if ((Window = UserGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
if(Window->head.pti->MessageQueue != ThreadQueue)
|
if (Window->head.pti->MessageQueue != ThreadQueue)
|
||||||
{
|
{
|
||||||
RETURN(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +576,21 @@ NtUserSetCapture(HWND hWnd)
|
||||||
co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
|
co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
|
||||||
ThreadQueue->CaptureWindow = hWnd;
|
ThreadQueue->CaptureWindow = hWnd;
|
||||||
|
|
||||||
RETURN( hWndPrev);
|
return hWndPrev;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
HWND APIENTRY
|
||||||
|
NtUserSetCapture(HWND hWnd)
|
||||||
|
{
|
||||||
|
DECLARE_RETURN(HWND);
|
||||||
|
|
||||||
|
DPRINT("Enter NtUserSetCapture(%x)\n", hWnd);
|
||||||
|
UserEnterExclusive();
|
||||||
|
|
||||||
|
RETURN( co_UserSetCapture(hWnd));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetCapture, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserSetCapture, ret=%i\n",_ret_);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process);
|
BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process);
|
||||||
|
HWND FASTCALL co_UserSetCapture(HWND hWnd);
|
||||||
|
|
||||||
#define PM_BADMSGFLAGS ~((QS_RAWINPUT << 16)|PM_QS_SENDMESSAGE|PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_QS_INPUT|PM_NOYIELD|PM_REMOVE)
|
#define PM_BADMSGFLAGS ~((QS_RAWINPUT << 16)|PM_QS_SENDMESSAGE|PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_QS_INPUT|PM_NOYIELD|PM_REMOVE)
|
||||||
|
|
||||||
|
@ -1698,6 +1699,76 @@ IntUninitMessagePumpHook()
|
||||||
|
|
||||||
/** Functions ******************************************************************/
|
/** Functions ******************************************************************/
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
APIENTRY
|
||||||
|
NtUserDragDetect(
|
||||||
|
HWND hWnd,
|
||||||
|
POINT pt) // Just like the User call.
|
||||||
|
{
|
||||||
|
MSG msg;
|
||||||
|
RECT rect;
|
||||||
|
WORD wDragWidth, wDragHeight;
|
||||||
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
|
DPRINT("Enter NtUserDragDetect(%x)\n", hWnd);
|
||||||
|
UserEnterExclusive();
|
||||||
|
|
||||||
|
wDragWidth = UserGetSystemMetrics(SM_CXDRAG);
|
||||||
|
wDragHeight= UserGetSystemMetrics(SM_CYDRAG);
|
||||||
|
|
||||||
|
rect.left = pt.x - wDragWidth;
|
||||||
|
rect.right = pt.x + wDragWidth;
|
||||||
|
|
||||||
|
rect.top = pt.y - wDragHeight;
|
||||||
|
rect.bottom = pt.y + wDragHeight;
|
||||||
|
|
||||||
|
co_UserSetCapture(hWnd);
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
while (co_IntGetPeekMessage( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE, FALSE ) ||
|
||||||
|
co_IntGetPeekMessage( &msg, 0, WM_QUEUESYNC, WM_QUEUESYNC, PM_REMOVE, FALSE ) ||
|
||||||
|
co_IntGetPeekMessage( &msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE, FALSE ) )
|
||||||
|
{
|
||||||
|
if ( msg.message == WM_LBUTTONUP )
|
||||||
|
{
|
||||||
|
co_UserSetCapture(NULL);
|
||||||
|
RETURN( FALSE);
|
||||||
|
}
|
||||||
|
if ( msg.message == WM_MOUSEMOVE )
|
||||||
|
{
|
||||||
|
POINT tmp;
|
||||||
|
tmp.x = (short)LOWORD(msg.lParam);
|
||||||
|
tmp.y = (short)HIWORD(msg.lParam);
|
||||||
|
if( !IntPtInRect( &rect, tmp ) )
|
||||||
|
{
|
||||||
|
co_UserSetCapture(NULL);
|
||||||
|
RETURN( TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( msg.message == WM_KEYDOWN )
|
||||||
|
{
|
||||||
|
if ( msg.wParam == VK_ESCAPE )
|
||||||
|
{
|
||||||
|
co_UserSetCapture(NULL);
|
||||||
|
RETURN( TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( msg.message == WM_QUEUESYNC )
|
||||||
|
{
|
||||||
|
co_HOOK_CallHooks( WH_CBT, HCBT_QS, 0, 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
co_IntWaitMessage(NULL, 0, 0);
|
||||||
|
}
|
||||||
|
RETURN( FALSE);
|
||||||
|
|
||||||
|
CLEANUP:
|
||||||
|
DPRINT("Leave NtUserDragDetect, ret=%i\n",_ret_);
|
||||||
|
UserLeave();
|
||||||
|
END_CLEANUP;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
NtUserPostMessage(HWND hWnd,
|
NtUserPostMessage(HWND hWnd,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
|
|
|
@ -1338,16 +1338,6 @@ NtUserResolveDesktopForWOW(DWORD Unknown0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
|
||||||
APIENTRY
|
|
||||||
NtUserDragDetect(
|
|
||||||
HWND hWnd,
|
|
||||||
POINT pt) // Just like the User call.
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue