Use 32-bit hook functions where possible. Cleaned up a couple of

16-bit type uses.
This commit is contained in:
Alexandre Julliard 2001-05-09 17:33:00 +00:00
parent e76218dd61
commit 32ee168200
4 changed files with 38 additions and 54 deletions

View File

@ -113,8 +113,7 @@ HWND WINAPI SetFocus( HWND hwnd )
} }
/* call hooks */ /* call hooks */
if( HOOK_CallHooks16( WH_CBT, HCBT_SETFOCUS, (WPARAM16)hwnd, if( HOOK_CallHooksA( WH_CBT, HCBT_SETFOCUS, (WPARAM)hwnd, (LPARAM)hWndFocus) )
(LPARAM)hWndFocus) )
goto CLEANUP; goto CLEANUP;
/* activate hwndTop if needed. */ /* activate hwndTop if needed. */
@ -133,7 +132,7 @@ HWND WINAPI SetFocus( HWND hwnd )
} }
else /* NULL hwnd passed in */ else /* NULL hwnd passed in */
{ {
if( HOOK_CallHooks16( WH_CBT, HCBT_SETFOCUS, 0, (LPARAM)hWndFocus ) ) if( HOOK_CallHooksA( WH_CBT, HCBT_SETFOCUS, 0, (LPARAM)hWndFocus ) )
goto CLEANUP; goto CLEANUP;
/* Get the current focus from the perQ data of the current message Q */ /* Get the current focus from the perQ data of the current message Q */

View File

@ -100,18 +100,18 @@ static void MSG_SendParentNotify(WND* wndPtr, WORD event, WORD idChild, LPARAM l
*/ */
static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last, static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
MSG *msg, BOOL remove, WND* pWndScope, MSG *msg, BOOL remove, WND* pWndScope,
INT16 *pHitTest, POINT16 *pScreen_pt, BOOL *pmouseClick ) INT *pHitTest, POINT *screen_pt, BOOL *pmouseClick )
{ {
static DWORD dblclk_time_limit = 0; static DWORD dblclk_time_limit = 0;
static UINT16 clk_message = 0; static UINT16 clk_message = 0;
static HWND16 clk_hwnd = 0; static HWND16 clk_hwnd = 0;
static POINT16 clk_pos = { 0, 0 }; static POINT clk_pos;
WND *pWnd; WND *pWnd;
HWND hWnd; HWND hWnd;
INT16 ht, hittest; INT16 ht, hittest;
UINT message = msg->message; UINT message = msg->message;
POINT16 screen_pt, pt; POINT16 pt;
HANDLE16 hQ = GetFastQueue16(); HANDLE16 hQ = GetFastQueue16();
MESSAGEQUEUE *queue = QUEUE_Lock(hQ); MESSAGEQUEUE *queue = QUEUE_Lock(hQ);
BOOL mouseClick = ((message == WM_LBUTTONDOWN) || BOOL mouseClick = ((message == WM_LBUTTONDOWN) ||
@ -191,8 +191,7 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
} }
} }
/* save mouse position */ /* save mouse position */
screen_pt = pt; CONV_POINT16TO32( &pt, screen_pt );
*pScreen_pt = pt;
if (hittest != HTCLIENT) if (hittest != HTCLIENT)
{ {
@ -221,9 +220,9 @@ static DWORD MSG_TranslateMouseMsg( HWND hTopWnd, DWORD first, DWORD last,
{ {
/* set conditions */ /* set conditions */
dblclk_time_limit = msg->time; dblclk_time_limit = msg->time;
clk_message = msg->message; clk_message = msg->message;
clk_hwnd = hWnd; clk_hwnd = hWnd;
clk_pos = screen_pt; clk_pos = *screen_pt;
} else } else
/* got double click - zero them out */ /* got double click - zero them out */
dblclk_time_limit = clk_hwnd = 0; dblclk_time_limit = clk_hwnd = 0;
@ -261,8 +260,8 @@ END:
* SYSQ_MSG_ACCEPT - the translated message must be passed to the user * SYSQ_MSG_ACCEPT - the translated message must be passed to the user
* MSG_PeekHardwareMsg should return TRUE. * MSG_PeekHardwareMsg should return TRUE.
*/ */
static DWORD MSG_ProcessMouseMsg( MSG *msg, BOOL remove, INT16 hittest, static DWORD MSG_ProcessMouseMsg( MSG *msg, BOOL remove, INT hittest,
POINT16 screen_pt, BOOL mouseClick ) POINT screen_pt, BOOL mouseClick )
{ {
WND *pWnd; WND *pWnd;
HWND hWnd = msg->hwnd; HWND hWnd = msg->hwnd;
@ -277,19 +276,13 @@ static DWORD MSG_ProcessMouseMsg( MSG *msg, BOOL remove, INT16 hittest,
if (HOOK_IsHooked( WH_MOUSE )) if (HOOK_IsHooked( WH_MOUSE ))
{ {
SYSQ_STATUS ret = 0; MOUSEHOOKSTRUCT hook;
MOUSEHOOKSTRUCT16 *hook = SEGPTR_NEW(MOUSEHOOKSTRUCT16); hook.pt = screen_pt;
if( hook ) hook.hwnd = hWnd;
{ hook.wHitTestCode = hittest;
hook->pt = screen_pt; hook.dwExtraInfo = 0;
hook->hwnd = hWnd; if (HOOK_CallHooksA( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE,
hook->wHitTestCode = hittest; message, (LPARAM)&hook ))
hook->dwExtraInfo = 0;
ret = HOOK_CallHooks16( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE,
message, (LPARAM)SEGPTR_GET(hook) );
SEGPTR_FREE(hook);
}
if( ret )
{ {
retvalue = MAKELONG((INT16)SYSQ_MSG_SKIP, hittest); retvalue = MAKELONG((INT16)SYSQ_MSG_SKIP, hittest);
goto END; goto END;
@ -441,8 +434,8 @@ static DWORD MSG_ProcessKbdMsg( MSG *msg, BOOL remove )
WIN_ReleaseWndPtr(pWnd); WIN_ReleaseWndPtr(pWnd);
} }
return (HOOK_CallHooks16( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE, return (HOOK_CallHooksA( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE,
LOWORD (msg->wParam), msg->lParam ) LOWORD (msg->wParam), msg->lParam )
? SYSQ_MSG_SKIP : SYSQ_MSG_ACCEPT); ? SYSQ_MSG_SKIP : SYSQ_MSG_ACCEPT);
} }
@ -595,8 +588,8 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, DWORD first, DWORD last,
for ( qmsg = sysMsgQueue->firstMsg; qmsg; qmsg = nextqmsg ) for ( qmsg = sysMsgQueue->firstMsg; qmsg; qmsg = nextqmsg )
{ {
INT16 hittest; INT hittest;
POINT16 screen_pt; POINT screen_pt;
BOOL mouseClick; BOOL mouseClick;
*msg = qmsg->msg; *msg = qmsg->msg;
@ -686,21 +679,16 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, DWORD first, DWORD last,
if (HOOK_IsHooked( WH_CBT )) if (HOOK_IsHooked( WH_CBT ))
{ {
if( msgType == KEYBOARD_MSG ) if( msgType == KEYBOARD_MSG )
HOOK_CallHooks16( WH_CBT, HCBT_KEYSKIPPED, HOOK_CallHooksA( WH_CBT, HCBT_KEYSKIPPED,
LOWORD (msg->wParam), msg->lParam ); LOWORD (msg->wParam), msg->lParam );
else if ( msgType == MOUSE_MSG ) else if ( msgType == MOUSE_MSG )
{ {
MOUSEHOOKSTRUCT16 *hook = SEGPTR_NEW(MOUSEHOOKSTRUCT16); MOUSEHOOKSTRUCT hook;
if (hook) hook.pt = msg->pt;
{ hook.hwnd = msg->hwnd;
CONV_POINT32TO16( &msg->pt,&hook->pt ); hook.wHitTestCode = HIWORD(status);
hook->hwnd = msg->hwnd; hook.dwExtraInfo = 0;
hook->wHitTestCode = HIWORD(status); HOOK_CallHooksA( WH_CBT, HCBT_CLICKSKIPPED, msg->message, (LPARAM)&hook );
hook->dwExtraInfo = 0;
HOOK_CallHooks16( WH_CBT, HCBT_CLICKSKIPPED ,msg->message & 0xffff,
(LPARAM)SEGPTR_GET(hook) );
SEGPTR_FREE(hook);
}
} }
} }

View File

@ -980,7 +980,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
/* Call WH_SHELL hook */ /* Call WH_SHELL hook */
if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner) if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
TRACE("created window %04x\n", hwnd); TRACE("created window %04x\n", hwnd);
retvalue = hwnd; retvalue = hwnd;
@ -1336,7 +1336,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
/* Call hooks */ /* Call hooks */
if( HOOK_CallHooks16( WH_CBT, HCBT_DESTROYWND, hwnd, 0L) ) if( HOOK_CallHooksA( WH_CBT, HCBT_DESTROYWND, hwnd, 0L) )
{ {
retvalue = FALSE; retvalue = FALSE;
goto end; goto end;
@ -1344,7 +1344,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner) if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
{ {
HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWDESTROYED, hwnd, 0L ); HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWDESTROYED, hwnd, 0L );
/* FIXME: clean up palette - see "Internals" p.352 */ /* FIXME: clean up palette - see "Internals" p.352 */
} }

View File

@ -1227,7 +1227,7 @@ UINT WINPOS_MinMaximize( WND* wndPtr, UINT16 cmd, LPRECT16 lpRect )
size.x = wndPtr->rectWindow.left; size.y = wndPtr->rectWindow.top; size.x = wndPtr->rectWindow.left; size.y = wndPtr->rectWindow.top;
lpPos = WINPOS_InitInternalPos( wndPtr, size, &wndPtr->rectWindow ); lpPos = WINPOS_InitInternalPos( wndPtr, size, &wndPtr->rectWindow );
if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, wndPtr->hwndSelf, cmd)) if (lpPos && !HOOK_CallHooksA(WH_CBT, HCBT_MINMAX, wndPtr->hwndSelf, cmd))
{ {
if( wndPtr->dwStyle & WS_MINIMIZE ) if( wndPtr->dwStyle & WS_MINIMIZE )
{ {
@ -1722,7 +1722,6 @@ void WINAPI SetInternalWindowPos( HWND hwnd, UINT showCmd,
*/ */
BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus) BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
{ {
CBTACTIVATESTRUCT16* cbtStruct;
WND* wndPtr=0, *wndTemp; WND* wndPtr=0, *wndTemp;
HQUEUE16 hOldActiveQueue, hNewActiveQueue; HQUEUE16 hOldActiveQueue, hNewActiveQueue;
MESSAGEQUEUE *pOldActiveQueue = 0, *pNewActiveQueue = 0; MESSAGEQUEUE *pOldActiveQueue = 0, *pNewActiveQueue = 0;
@ -1759,14 +1758,12 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
TRACE("no current active window.\n"); TRACE("no current active window.\n");
/* call CBT hook chain */ /* call CBT hook chain */
if ((cbtStruct = SEGPTR_NEW(CBTACTIVATESTRUCT16))) if (HOOK_IsHooked( WH_CBT ))
{ {
cbtStruct->fMouse = fMouse; CBTACTIVATESTRUCT cbt;
cbtStruct->hWndActive = hwndActive; cbt.fMouse = fMouse;
bRet = (BOOL)HOOK_CallHooks16( WH_CBT, HCBT_ACTIVATE, (WPARAM16)hWnd, cbt.hWndActive = hwndActive;
(LPARAM)SEGPTR_GET(cbtStruct) ); if (HOOK_CallHooksA( WH_CBT, HCBT_ACTIVATE, hWnd, (LPARAM)&cbt )) goto CLEANUP_END;
SEGPTR_FREE(cbtStruct);
if (bRet) goto CLEANUP_END;
} }
/* set prev active wnd to current active wnd and send notification */ /* set prev active wnd to current active wnd and send notification */