From b6f4eccdbd4c167db15b9c56b32a2243c9b59a7e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 26 Apr 2005 08:18:47 +0000 Subject: [PATCH] Moved some messaging and input functions to message.c and input.c respectively. --- dlls/user/input.c | 131 ++++++++++++++++++++++++++++++++++ dlls/user/message.c | 169 ++++++++++++++++++++++---------------------- windows/queue.c | 130 ---------------------------------- 3 files changed, 214 insertions(+), 216 deletions(-) diff --git a/dlls/user/input.c b/dlls/user/input.c index 4decb81e343..ab60cd084af 100644 --- a/dlls/user/input.c +++ b/dlls/user/input.c @@ -223,6 +223,137 @@ SHORT WINAPI GetAsyncKeyState(INT nKey) } +/*********************************************************************** + * GetQueueStatus (USER32.@) + */ +DWORD WINAPI GetQueueStatus( UINT flags ) +{ + DWORD ret = 0; + + /* check for pending X events */ + if (USER_Driver.pMsgWaitForMultipleObjectsEx) + USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 ); + + SERVER_START_REQ( get_queue_status ) + { + req->clear = 1; + wine_server_call( req ); + ret = MAKELONG( reply->changed_bits & flags, reply->wake_bits & flags ); + } + SERVER_END_REQ; + return ret; +} + + +/*********************************************************************** + * GetInputState (USER32.@) + */ +BOOL WINAPI GetInputState(void) +{ + DWORD ret = 0; + + /* check for pending X events */ + if (USER_Driver.pMsgWaitForMultipleObjectsEx) + USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_INPUT, 0 ); + + SERVER_START_REQ( get_queue_status ) + { + req->clear = 0; + wine_server_call( req ); + ret = reply->wake_bits & (QS_KEY | QS_MOUSEBUTTON); + } + SERVER_END_REQ; + return ret; +} + + +/********************************************************************** + * AttachThreadInput (USER32.@) + * + * Attaches the input processing mechanism of one thread to that of + * another thread. + */ +BOOL WINAPI AttachThreadInput( DWORD from, DWORD to, BOOL attach ) +{ + BOOL ret; + + SERVER_START_REQ( attach_thread_input ) + { + req->tid_from = from; + req->tid_to = to; + req->attach = attach; + ret = !wine_server_call_err( req ); + } + SERVER_END_REQ; + return ret; +} + + +/********************************************************************** + * GetKeyState (USER32.@) + * + * An application calls the GetKeyState function in response to a + * keyboard-input message. This function retrieves the state of the key + * at the time the input message was generated. + */ +SHORT WINAPI GetKeyState(INT vkey) +{ + SHORT retval = 0; + + SERVER_START_REQ( get_key_state ) + { + req->tid = GetCurrentThreadId(); + req->key = vkey; + if (!wine_server_call( req )) retval = (signed char)reply->state; + } + SERVER_END_REQ; + TRACE("key (0x%x) -> %x\n", vkey, retval); + return retval; +} + + +/********************************************************************** + * GetKeyboardState (USER32.@) + */ +BOOL WINAPI GetKeyboardState( LPBYTE state ) +{ + BOOL ret; + + TRACE("(%p)\n", state); + + memset( state, 0, 256 ); + SERVER_START_REQ( get_key_state ) + { + req->tid = GetCurrentThreadId(); + req->key = -1; + wine_server_set_reply( req, state, 256 ); + ret = !wine_server_call_err( req ); + } + SERVER_END_REQ; + return ret; +} + + +/********************************************************************** + * SetKeyboardState (USER32.@) + */ +BOOL WINAPI SetKeyboardState( LPBYTE state ) +{ + BOOL ret; + + TRACE("(%p)\n", state); + + SERVER_START_REQ( set_key_state ) + { + req->tid = GetCurrentThreadId(); + wine_server_add_data( req, state, 256 ); + ret = !wine_server_call_err( req ); + } + SERVER_END_REQ; + return ret; +} + + /********************************************************************** * VkKeyScanA (USER32.@) * diff --git a/dlls/user/message.c b/dlls/user/message.c index d30e2fd69dc..d4d5e426e90 100644 --- a/dlls/user/message.c +++ b/dlls/user/message.c @@ -2984,6 +2984,89 @@ LONG WINAPI DispatchMessageW( const MSG* msg ) } +/*********************************************************************** + * GetMessagePos (USER.119) + * GetMessagePos (USER32.@) + * + * The GetMessagePos() function returns a long value representing a + * cursor position, in screen coordinates, when the last message + * retrieved by the GetMessage() function occurs. The x-coordinate is + * in the low-order word of the return value, the y-coordinate is in + * the high-order word. The application can use the MAKEPOINT() + * macro to obtain a POINT structure from the return value. + * + * For the current cursor position, use GetCursorPos(). + * + * RETURNS + * + * Cursor position of last message on success, zero on failure. + * + * CONFORMANCE + * + * ECMA-234, Win32 + * + */ +DWORD WINAPI GetMessagePos(void) +{ + MESSAGEQUEUE *queue; + + if (!(queue = QUEUE_Current())) return 0; + return queue->GetMessagePosVal; +} + + +/*********************************************************************** + * GetMessageTime (USER.120) + * GetMessageTime (USER32.@) + * + * GetMessageTime() returns the message time for the last message + * retrieved by the function. The time is measured in milliseconds with + * the same offset as GetTickCount(). + * + * Since the tick count wraps, this is only useful for moderately short + * relative time comparisons. + * + * RETURNS + * + * Time of last message on success, zero on failure. + */ +LONG WINAPI GetMessageTime(void) +{ + MESSAGEQUEUE *queue; + + if (!(queue = QUEUE_Current())) return 0; + return queue->GetMessageTimeVal; +} + + +/*********************************************************************** + * GetMessageExtraInfo (USER.288) + * GetMessageExtraInfo (USER32.@) + */ +LPARAM WINAPI GetMessageExtraInfo(void) +{ + MESSAGEQUEUE *queue; + + if (!(queue = QUEUE_Current())) return 0; + return queue->GetMessageExtraInfoVal; +} + + +/*********************************************************************** + * SetMessageExtraInfo (USER32.@) + */ +LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam) +{ + MESSAGEQUEUE *queue; + LONG old_value; + + if (!(queue = QUEUE_Current())) return 0; + old_value = queue->GetMessageExtraInfoVal; + queue->GetMessageExtraInfoVal = lParam; + return old_value; +} + + /*********************************************************************** * WaitMessage (USER.112) Suspend thread pending messages * WaitMessage (USER32.@) Suspend thread pending messages @@ -3313,28 +3396,6 @@ BOOL WINAPI KillSystemTimer( HWND hwnd, UINT_PTR id ) } -/********************************************************************** - * AttachThreadInput (USER32.@) - * - * Attaches the input processing mechanism of one thread to that of - * another thread. - */ -BOOL WINAPI AttachThreadInput( DWORD from, DWORD to, BOOL attach ) -{ - BOOL ret; - - SERVER_START_REQ( attach_thread_input ) - { - req->tid_from = from; - req->tid_to = to; - req->attach = attach; - ret = !wine_server_call_err( req ); - } - SERVER_END_REQ; - return ret; -} - - /********************************************************************** * GetGUIThreadInfo (USER32.@) */ @@ -3368,70 +3429,6 @@ BOOL WINAPI GetGUIThreadInfo( DWORD id, GUITHREADINFO *info ) } -/********************************************************************** - * GetKeyState (USER32.@) - * - * An application calls the GetKeyState function in response to a - * keyboard-input message. This function retrieves the state of the key - * at the time the input message was generated. - */ -SHORT WINAPI GetKeyState(INT vkey) -{ - SHORT retval = 0; - - SERVER_START_REQ( get_key_state ) - { - req->tid = GetCurrentThreadId(); - req->key = vkey; - if (!wine_server_call( req )) retval = (signed char)reply->state; - } - SERVER_END_REQ; - TRACE("key (0x%x) -> %x\n", vkey, retval); - return retval; -} - - -/********************************************************************** - * GetKeyboardState (USER32.@) - */ -BOOL WINAPI GetKeyboardState( LPBYTE state ) -{ - BOOL ret; - - TRACE("(%p)\n", state); - - memset( state, 0, 256 ); - SERVER_START_REQ( get_key_state ) - { - req->tid = GetCurrentThreadId(); - req->key = -1; - wine_server_set_reply( req, state, 256 ); - ret = !wine_server_call_err( req ); - } - SERVER_END_REQ; - return ret; -} - - -/********************************************************************** - * SetKeyboardState (USER32.@) - */ -BOOL WINAPI SetKeyboardState( LPBYTE state ) -{ - BOOL ret; - - TRACE("(%p)\n", state); - - SERVER_START_REQ( set_key_state ) - { - req->tid = GetCurrentThreadId(); - wine_server_add_data( req, state, 256 ); - ret = !wine_server_call_err( req ); - } - SERVER_END_REQ; - return ret; -} - /****************************************************************** * IsHungAppWindow (USER32.@) * diff --git a/windows/queue.c b/windows/queue.c index 810a77ea57c..af60eae36bb 100644 --- a/windows/queue.c +++ b/windows/queue.c @@ -136,133 +136,3 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags ) MESSAGEQUEUE *queue = QUEUE_Current(); return queue ? queue->self : 0; } - -/*********************************************************************** - * GetQueueStatus (USER32.@) - */ -DWORD WINAPI GetQueueStatus( UINT flags ) -{ - DWORD ret = 0; - - /* check for pending X events */ - if (USER_Driver.pMsgWaitForMultipleObjectsEx) - USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 ); - - SERVER_START_REQ( get_queue_status ) - { - req->clear = 1; - wine_server_call( req ); - ret = MAKELONG( reply->changed_bits & flags, reply->wake_bits & flags ); - } - SERVER_END_REQ; - return ret; -} - - -/*********************************************************************** - * GetInputState (USER32.@) - */ -BOOL WINAPI GetInputState(void) -{ - DWORD ret = 0; - - /* check for pending X events */ - if (USER_Driver.pMsgWaitForMultipleObjectsEx) - USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_INPUT, 0 ); - - SERVER_START_REQ( get_queue_status ) - { - req->clear = 0; - wine_server_call( req ); - ret = reply->wake_bits & (QS_KEY | QS_MOUSEBUTTON); - } - SERVER_END_REQ; - return ret; -} - -/*********************************************************************** - * GetMessagePos (USER.119) - * GetMessagePos (USER32.@) - * - * The GetMessagePos() function returns a long value representing a - * cursor position, in screen coordinates, when the last message - * retrieved by the GetMessage() function occurs. The x-coordinate is - * in the low-order word of the return value, the y-coordinate is in - * the high-order word. The application can use the MAKEPOINT() - * macro to obtain a POINT structure from the return value. - * - * For the current cursor position, use GetCursorPos(). - * - * RETURNS - * - * Cursor position of last message on success, zero on failure. - * - * CONFORMANCE - * - * ECMA-234, Win32 - * - */ -DWORD WINAPI GetMessagePos(void) -{ - MESSAGEQUEUE *queue; - - if (!(queue = QUEUE_Current())) return 0; - return queue->GetMessagePosVal; -} - - -/*********************************************************************** - * GetMessageTime (USER.120) - * GetMessageTime (USER32.@) - * - * GetMessageTime() returns the message time for the last message - * retrieved by the function. The time is measured in milliseconds with - * the same offset as GetTickCount(). - * - * Since the tick count wraps, this is only useful for moderately short - * relative time comparisons. - * - * RETURNS - * - * Time of last message on success, zero on failure. - * - * CONFORMANCE - * - * ECMA-234, Win32 - * - */ -LONG WINAPI GetMessageTime(void) -{ - MESSAGEQUEUE *queue; - - if (!(queue = QUEUE_Current())) return 0; - return queue->GetMessageTimeVal; -} - - -/*********************************************************************** - * GetMessageExtraInfo (USER.288) - * GetMessageExtraInfo (USER32.@) - */ -LPARAM WINAPI GetMessageExtraInfo(void) -{ - MESSAGEQUEUE *queue; - - if (!(queue = QUEUE_Current())) return 0; - return queue->GetMessageExtraInfoVal; -} - - -/*********************************************************************** - * SetMessageExtraInfo (USER32.@) - */ -LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam) -{ - MESSAGEQUEUE *queue; - LONG old_value; - - if (!(queue = QUEUE_Current())) return 0; - old_value = queue->GetMessageExtraInfoVal; - queue->GetMessageExtraInfoVal = lParam; - return old_value; -}