Commit 838d65ae authored by Alexandre Julliard's avatar Alexandre Julliard

Moved hardware message queue handling to the server.

parent 4b29d669
...@@ -197,7 +197,6 @@ static void tweak_init(void) ...@@ -197,7 +197,6 @@ static void tweak_init(void)
static BOOL process_attach(void) static BOOL process_attach(void)
{ {
HINSTANCE16 instance; HINSTANCE16 instance;
int queueSize;
/* Create USER heap */ /* Create USER heap */
if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE; if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE;
...@@ -232,10 +231,6 @@ static BOOL process_attach(void) ...@@ -232,10 +231,6 @@ static BOOL process_attach(void)
/* Initialize message spying */ /* Initialize message spying */
if (!SPY_Init()) return FALSE; if (!SPY_Init()) return FALSE;
/* Create system message queue */
queueSize = GetProfileIntA( "windows", "TypeAhead", 120 );
if (!QUEUE_CreateSysMsgQueue( queueSize )) return FALSE;
/* Set double click time */ /* Set double click time */
SetDoubleClickTime( GetProfileIntA("windows","DoubleClickSpeed",452) ); SetDoubleClickTime( GetProfileIntA("windows","DoubleClickSpeed",452) );
......
...@@ -897,7 +897,8 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -897,7 +897,8 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
if (!ret) if (!ret)
{ {
WIN_UnlinkWindow( hwnd ); WIN_UnlinkWindow( hwnd );
goto failed; X11DRV_DestroyWindow( hwnd );
return FALSE;
} }
/* Send the size messages */ /* Send the size messages */
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/* Message as stored in the queue (contains the extraInfo field) */ /* Message as stored in the queue (contains the extraInfo field) */
typedef struct tagQMSG typedef struct tagQMSG
{ {
int kind; /* message kind (sent,posted,hardware) */
int type; int type;
MSG msg; MSG msg;
DWORD extraInfo; /* Only in 3.1 */ DWORD extraInfo; /* Only in 3.1 */
...@@ -98,22 +99,16 @@ extern void QUEUE_Unlock( MESSAGEQUEUE *queue ); ...@@ -98,22 +99,16 @@ extern void QUEUE_Unlock( MESSAGEQUEUE *queue );
extern void QUEUE_DumpQueue( HQUEUE16 hQueue ); extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
extern BOOL QUEUE_IsExitingQueue( HQUEUE16 hQueue ); extern BOOL QUEUE_IsExitingQueue( HQUEUE16 hQueue );
extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue ); extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD set, WORD clear ); extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD set, WORD clear );
extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit ); extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern WORD QUEUE_TestWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern int QUEUE_WaitBits( WORD bits, DWORD timeout ); extern int QUEUE_WaitBits( WORD bits, DWORD timeout );
extern void QUEUE_IncPaintCount( HQUEUE16 hQueue ); extern void QUEUE_IncPaintCount( HQUEUE16 hQueue );
extern void QUEUE_DecPaintCount( HQUEUE16 hQueue ); extern void QUEUE_DecPaintCount( HQUEUE16 hQueue );
extern BOOL QUEUE_CreateSysMsgQueue( int size );
extern BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ); extern BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue ); extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
extern BOOL QUEUE_FindMsg( HWND hwnd, UINT first, UINT last, BOOL remove, extern BOOL QUEUE_FindMsg( HWND hwnd, UINT first, UINT last, BOOL remove, QMSG *msg );
BOOL sent_only, QMSG *msg );
extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, QMSG *qmsg ); extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, QMSG *qmsg );
extern void QUEUE_CleanupWindow( HWND hwnd ); extern void QUEUE_CleanupWindow( HWND hwnd );
extern void hardware_event( UINT message, WPARAM wParam, LPARAM lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo );
extern HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags ); extern HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags );
......
...@@ -1345,34 +1345,43 @@ struct wait_input_idle_request ...@@ -1345,34 +1345,43 @@ struct wait_input_idle_request
struct send_message_request struct send_message_request
{ {
REQUEST_HEADER; /* request header */ REQUEST_HEADER; /* request header */
IN int posted; /* posted instead of sent message? */ IN int kind; /* message kind (see below) */
IN void* id; /* thread id */ IN void* id; /* thread id */
IN int type; /* message type */ IN int type; /* message type */
IN handle_t win; /* window handle */ IN handle_t win; /* window handle */
IN unsigned int msg; /* message code */ IN unsigned int msg; /* message code */
IN unsigned int wparam; /* parameters */ IN unsigned int wparam; /* parameters */
IN unsigned int lparam; /* parameters */ IN unsigned int lparam; /* parameters */
IN unsigned short x; /* x position */
IN unsigned short y; /* y position */
IN unsigned int time; /* message time */
IN unsigned int info; /* extra info */ IN unsigned int info; /* extra info */
}; };
enum message_kind { SEND_MESSAGE, POST_MESSAGE, COOKED_HW_MESSAGE, RAW_HW_MESSAGE };
#define NB_MSG_KINDS (RAW_HW_MESSAGE+1)
/* Get a message from the current queue */ /* Get a message from the current queue */
struct get_message_request struct get_message_request
{ {
REQUEST_HEADER; /* request header */ REQUEST_HEADER; /* request header */
IN int remove; /* remove it? */ IN int flags; /* see below */
IN int posted; /* check posted messages too? */
IN handle_t get_win; /* window handle to get */ IN handle_t get_win; /* window handle to get */
IN unsigned int get_first; /* first message code to get */ IN unsigned int get_first; /* first message code to get */
IN unsigned int get_last; /* last message code to get */ IN unsigned int get_last; /* last message code to get */
OUT int sent; /* it is a sent message */ OUT int kind; /* message kind */
OUT int type; /* message type */ OUT int type; /* message type */
OUT handle_t win; /* window handle */ OUT handle_t win; /* window handle */
OUT unsigned int msg; /* message code */ OUT unsigned int msg; /* message code */
OUT unsigned int wparam; /* parameters */ OUT unsigned int wparam; /* parameters */
OUT unsigned int lparam; /* parameters */ OUT unsigned int lparam; /* parameters */
OUT unsigned short x; /* x position */
OUT unsigned short y; /* y position */
OUT unsigned int time; /* message time */
OUT unsigned int info; /* extra info */ OUT unsigned int info; /* extra info */
}; };
#define GET_MSG_REMOVE 1 /* remove the message */
#define GET_MSG_SENT_ONLY 2 /* only get sent messages */
/* Reply to a sent message */ /* Reply to a sent message */
...@@ -1734,7 +1743,7 @@ union generic_request ...@@ -1734,7 +1743,7 @@ union generic_request
struct create_async_request create_async; struct create_async_request create_async;
}; };
#define SERVER_PROTOCOL_VERSION 45 #define SERVER_PROTOCOL_VERSION 46
/* ### make_requests end ### */ /* ### make_requests end ### */
/* Everything above this line is generated automatically by tools/make_requests */ /* Everything above this line is generated automatically by tools/make_requests */
......
...@@ -1464,20 +1464,22 @@ static void dump_wait_input_idle_reply( const struct wait_input_idle_request *re ...@@ -1464,20 +1464,22 @@ static void dump_wait_input_idle_reply( const struct wait_input_idle_request *re
static void dump_send_message_request( const struct send_message_request *req ) static void dump_send_message_request( const struct send_message_request *req )
{ {
fprintf( stderr, " posted=%d,", req->posted ); fprintf( stderr, " kind=%d,", req->kind );
fprintf( stderr, " id=%p,", req->id ); fprintf( stderr, " id=%p,", req->id );
fprintf( stderr, " type=%d,", req->type ); fprintf( stderr, " type=%d,", req->type );
fprintf( stderr, " win=%d,", req->win ); fprintf( stderr, " win=%d,", req->win );
fprintf( stderr, " msg=%08x,", req->msg ); fprintf( stderr, " msg=%08x,", req->msg );
fprintf( stderr, " wparam=%08x,", req->wparam ); fprintf( stderr, " wparam=%08x,", req->wparam );
fprintf( stderr, " lparam=%08x,", req->lparam ); fprintf( stderr, " lparam=%08x,", req->lparam );
fprintf( stderr, " x=%04x,", req->x );
fprintf( stderr, " y=%04x,", req->y );
fprintf( stderr, " time=%08x,", req->time );
fprintf( stderr, " info=%08x", req->info ); fprintf( stderr, " info=%08x", req->info );
} }
static void dump_get_message_request( const struct get_message_request *req ) static void dump_get_message_request( const struct get_message_request *req )
{ {
fprintf( stderr, " remove=%d,", req->remove ); fprintf( stderr, " flags=%d,", req->flags );
fprintf( stderr, " posted=%d,", req->posted );
fprintf( stderr, " get_win=%d,", req->get_win ); fprintf( stderr, " get_win=%d,", req->get_win );
fprintf( stderr, " get_first=%08x,", req->get_first ); fprintf( stderr, " get_first=%08x,", req->get_first );
fprintf( stderr, " get_last=%08x", req->get_last ); fprintf( stderr, " get_last=%08x", req->get_last );
...@@ -1485,12 +1487,15 @@ static void dump_get_message_request( const struct get_message_request *req ) ...@@ -1485,12 +1487,15 @@ static void dump_get_message_request( const struct get_message_request *req )
static void dump_get_message_reply( const struct get_message_request *req ) static void dump_get_message_reply( const struct get_message_request *req )
{ {
fprintf( stderr, " sent=%d,", req->sent ); fprintf( stderr, " kind=%d,", req->kind );
fprintf( stderr, " type=%d,", req->type ); fprintf( stderr, " type=%d,", req->type );
fprintf( stderr, " win=%d,", req->win ); fprintf( stderr, " win=%d,", req->win );
fprintf( stderr, " msg=%08x,", req->msg ); fprintf( stderr, " msg=%08x,", req->msg );
fprintf( stderr, " wparam=%08x,", req->wparam ); fprintf( stderr, " wparam=%08x,", req->wparam );
fprintf( stderr, " lparam=%08x,", req->lparam ); fprintf( stderr, " lparam=%08x,", req->lparam );
fprintf( stderr, " x=%04x,", req->x );
fprintf( stderr, " y=%04x,", req->y );
fprintf( stderr, " time=%08x,", req->time );
fprintf( stderr, " info=%08x", req->info ); fprintf( stderr, " info=%08x", req->info );
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"int" => "%d", "int" => "%d",
"char" => "%c", "char" => "%c",
"unsigned char" => "%02x", "unsigned char" => "%02x",
"unsigned short"=> "%04x",
"unsigned int" => "%08x", "unsigned int" => "%08x",
"void*" => "%p", "void*" => "%p",
"time_t" => "%ld", "time_t" => "%ld",
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "wine/keyboard16.h" #include "wine/keyboard16.h"
#include "server.h"
#include "win.h" #include "win.h"
#include "heap.h" #include "heap.h"
#include "input.h" #include "input.h"
...@@ -33,10 +34,10 @@ ...@@ -33,10 +34,10 @@
#include "debugtools.h" #include "debugtools.h"
#include "winerror.h" #include "winerror.h"
DECLARE_DEBUG_CHANNEL(event);
DECLARE_DEBUG_CHANNEL(key); DECLARE_DEBUG_CHANNEL(key);
DECLARE_DEBUG_CHANNEL(keyboard); DECLARE_DEBUG_CHANNEL(keyboard);
DECLARE_DEBUG_CHANNEL(win); DECLARE_DEBUG_CHANNEL(win);
DEFAULT_DEBUG_CHANNEL(event);
static BOOL InputEnabled = TRUE; static BOOL InputEnabled = TRUE;
static BOOL SwappedButtons; static BOOL SwappedButtons;
...@@ -73,6 +74,35 @@ typedef union ...@@ -73,6 +74,35 @@ typedef union
unsigned long lp2; unsigned long lp2;
} KEYLP; } KEYLP;
/***********************************************************************
* queue_raw_hardware_message
*
* Add a message to the raw hardware queue.
* Note: the position is relative to the desktop window.
*/
static void queue_raw_hardware_message( UINT message, WPARAM wParam, LPARAM lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo )
{
SERVER_START_REQ( send_message )
{
req->kind = RAW_HW_MESSAGE;
req->id = (void *)GetCurrentThreadId();
req->type = QMSG_HARDWARE;
req->win = 0;
req->msg = message;
req->wparam = wParam;
req->lparam = lParam;
req->x = xPos;
req->y = yPos;
req->time = time;
req->info = extraInfo;
SERVER_CALL();
}
SERVER_END_REQ;
}
/*********************************************************************** /***********************************************************************
* keybd_event (USER32.@) * keybd_event (USER32.@)
*/ */
...@@ -147,7 +177,7 @@ void WINAPI keybd_event( BYTE bVk, BYTE bScan, ...@@ -147,7 +177,7 @@ void WINAPI keybd_event( BYTE bVk, BYTE bScan,
TRACE_(key)(" wParam=%04X, lParam=%08lX\n", bVk, keylp.lp2 ); TRACE_(key)(" wParam=%04X, lParam=%08lX\n", bVk, keylp.lp2 );
TRACE_(key)(" InputKeyState=%X\n", InputKeyStateTable[bVk] ); TRACE_(key)(" InputKeyState=%X\n", InputKeyStateTable[bVk] );
hardware_event( message, bVk, keylp.lp2, PosX, PosY, time, extra ); queue_raw_hardware_message( message, bVk, keylp.lp2, PosX, PosY, time, extra );
} }
/*********************************************************************** /***********************************************************************
...@@ -242,49 +272,41 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, ...@@ -242,49 +272,41 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
if ( dwFlags & MOUSEEVENTF_MOVE ) if ( dwFlags & MOUSEEVENTF_MOVE )
{ {
hardware_event( WM_MOUSEMOVE, queue_raw_hardware_message( WM_MOUSEMOVE, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN) ) if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN) )
{ {
MouseButtonsStates[0] = AsyncMouseButtonsStates[0] = TRUE; MouseButtonsStates[0] = AsyncMouseButtonsStates[0] = TRUE;
hardware_event( WM_LBUTTONDOWN, queue_raw_hardware_message( WM_LBUTTONDOWN, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP) ) if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP) )
{ {
MouseButtonsStates[0] = FALSE; MouseButtonsStates[0] = FALSE;
hardware_event( WM_LBUTTONUP, queue_raw_hardware_message( WM_LBUTTONUP, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_LEFTDOWN) ) if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_LEFTDOWN) )
{ {
MouseButtonsStates[2] = AsyncMouseButtonsStates[2] = TRUE; MouseButtonsStates[2] = AsyncMouseButtonsStates[2] = TRUE;
hardware_event( WM_RBUTTONDOWN, queue_raw_hardware_message( WM_RBUTTONDOWN, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTUP : MOUSEEVENTF_LEFTUP) ) if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTUP : MOUSEEVENTF_LEFTUP) )
{ {
MouseButtonsStates[2] = FALSE; MouseButtonsStates[2] = FALSE;
hardware_event( WM_RBUTTONUP, queue_raw_hardware_message( WM_RBUTTONUP, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
if ( dwFlags & MOUSEEVENTF_MIDDLEDOWN ) if ( dwFlags & MOUSEEVENTF_MIDDLEDOWN )
{ {
MouseButtonsStates[1] = AsyncMouseButtonsStates[1] = TRUE; MouseButtonsStates[1] = AsyncMouseButtonsStates[1] = TRUE;
hardware_event( WM_MBUTTONDOWN, queue_raw_hardware_message( WM_MBUTTONDOWN, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
if ( dwFlags & MOUSEEVENTF_MIDDLEUP ) if ( dwFlags & MOUSEEVENTF_MIDDLEUP )
{ {
MouseButtonsStates[1] = FALSE; MouseButtonsStates[1] = FALSE;
hardware_event( WM_MBUTTONUP, queue_raw_hardware_message( WM_MBUTTONUP, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
if ( dwFlags & MOUSEEVENTF_WHEEL ) if ( dwFlags & MOUSEEVENTF_WHEEL )
{ {
hardware_event( WM_MOUSEWHEEL, queue_raw_hardware_message( WM_MOUSEWHEEL, keyState, 0, PosX, PosY, time, extra );
keyState, 0L, PosX, PosY, time, extra );
} }
} }
......
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