Call mouse driver callback also if windows are not registered with X

(if using native USER.EXE).
This commit is contained in:
Ulrich Weigand 1998-11-01 18:00:56 +00:00 committed by Alexandre Julliard
parent 9e29021223
commit 718cbaea16
1 changed files with 52 additions and 27 deletions

View File

@ -165,17 +165,18 @@ void EVENT_ProcessEvent( XEvent *event )
if (TSXFindContext( display, child, winContext, (char **)&pWnd ) != 0) if (TSXFindContext( display, child, winContext, (char **)&pWnd ) != 0)
return; return;
} else { } else {
return; /* Not for a registered window */ pWnd = NULL; /* Not for a registered window */
} }
} }
TRACE(event, "Got event %s for hwnd %04x\n", TRACE(event, "Got event %s for hwnd %04x\n",
event_names[event->type], pWnd->hwndSelf ); event_names[event->type], pWnd? pWnd->hwndSelf : 0 );
switch(event->type) switch(event->type)
{ {
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
if (!pWnd) return;
if (InputEnabled) EVENT_Key( pWnd, (XKeyEvent*)event ); if (InputEnabled) EVENT_Key( pWnd, (XKeyEvent*)event );
break; break;
@ -207,38 +208,47 @@ void EVENT_ProcessEvent( XEvent *event )
break; break;
case FocusIn: case FocusIn:
if (!pWnd) return;
EVENT_FocusIn( pWnd, (XFocusChangeEvent*)event ); EVENT_FocusIn( pWnd, (XFocusChangeEvent*)event );
break; break;
case FocusOut: case FocusOut:
if (!pWnd) return;
EVENT_FocusOut( pWnd, (XFocusChangeEvent*)event ); EVENT_FocusOut( pWnd, (XFocusChangeEvent*)event );
break; break;
case Expose: case Expose:
if (!pWnd) return;
EVENT_Expose( pWnd, (XExposeEvent *)event ); EVENT_Expose( pWnd, (XExposeEvent *)event );
break; break;
case GraphicsExpose: case GraphicsExpose:
if (!pWnd) return;
EVENT_GraphicsExpose( pWnd, (XGraphicsExposeEvent *)event ); EVENT_GraphicsExpose( pWnd, (XGraphicsExposeEvent *)event );
break; break;
case ConfigureNotify: case ConfigureNotify:
if (!pWnd) return;
EVENT_ConfigureNotify( pWnd, (XConfigureEvent*)event ); EVENT_ConfigureNotify( pWnd, (XConfigureEvent*)event );
break; break;
case SelectionRequest: case SelectionRequest:
if (!pWnd) return;
EVENT_SelectionRequest( pWnd, (XSelectionRequestEvent *)event ); EVENT_SelectionRequest( pWnd, (XSelectionRequestEvent *)event );
break; break;
case SelectionNotify: case SelectionNotify:
if (!pWnd) return;
EVENT_SelectionNotify( (XSelectionEvent *)event ); EVENT_SelectionNotify( (XSelectionEvent *)event );
break; break;
case SelectionClear: case SelectionClear:
if (!pWnd) return;
EVENT_SelectionClear( pWnd, (XSelectionClearEvent*) event ); EVENT_SelectionClear( pWnd, (XSelectionClearEvent*) event );
break; break;
case ClientMessage: case ClientMessage:
if (!pWnd) return;
EVENT_ClientMessage( pWnd, (XClientMessageEvent *) event ); EVENT_ClientMessage( pWnd, (XClientMessageEvent *) event );
break; break;
@ -259,12 +269,13 @@ void EVENT_ProcessEvent( XEvent *event )
break; break;
case MapNotify: case MapNotify:
if (!pWnd) return;
EVENT_MapNotify( pWnd->hwndSelf, (XMapEvent *)event ); EVENT_MapNotify( pWnd->hwndSelf, (XMapEvent *)event );
break; break;
default: default:
WARN(event, "Unprocessed event %s for hwnd %04x\n", WARN(event, "Unprocessed event %s for hwnd %04x\n",
event_names[event->type], pWnd->hwndSelf ); event_names[event->type], pWnd? pWnd->hwndSelf : 0 );
break; break;
} }
} }
@ -443,7 +454,7 @@ BOOL32 EVENT_WaitNetEvent( BOOL32 sleep, BOOL32 peek )
if (TSXFindContext( display, ((XAnyEvent *)&event)->window, winContext, if (TSXFindContext( display, ((XAnyEvent *)&event)->window, winContext,
(char **)&pWnd ) || (event.type == NoExpose)) (char **)&pWnd ) || (event.type == NoExpose))
continue; pWnd = NULL;
if( pWnd ) if( pWnd )
{ {
@ -669,14 +680,18 @@ static void EVENT_Key( WND *pWnd, XKeyEvent *event )
*/ */
static void EVENT_MotionNotify( WND *pWnd, XMotionEvent *event ) static void EVENT_MotionNotify( WND *pWnd, XMotionEvent *event )
{ {
hardware_event( WM_MOUSEMOVE, EVENT_XStateToKeyState( event->state ), 0L, int xOffset = pWnd? pWnd->rectWindow.left : 0;
pWnd->rectWindow.left + event->x, int yOffset = pWnd? pWnd->rectWindow.top : 0;
pWnd->rectWindow.top + event->y,
event->time - MSG_WineStartTicks, pWnd->hwndSelf ); if (pWnd)
hardware_event( WM_MOUSEMOVE, EVENT_XStateToKeyState( event->state ), 0L,
xOffset + event->x,
yOffset + event->y,
event->time - MSG_WineStartTicks, pWnd->hwndSelf );
EVENT_SendMouseEvent( ME_MOVE, EVENT_SendMouseEvent( ME_MOVE,
pWnd->rectWindow.left + event->x, xOffset + event->x,
pWnd->rectWindow.top + event->y, yOffset + event->y,
0, 0 ); 0, 0 );
} }
@ -712,19 +727,24 @@ static void EVENT_ButtonPress( WND *pWnd, XButtonEvent *event )
{ ME_LDOWN, 0, ME_RDOWN }; { ME_LDOWN, 0, ME_RDOWN };
int buttonNum = event->button - 1; int buttonNum = event->button - 1;
int xOffset = pWnd? pWnd->rectWindow.left : 0;
int yOffset = pWnd? pWnd->rectWindow.top : 0;
if (buttonNum >= NB_BUTTONS) return; if (buttonNum >= NB_BUTTONS) return;
if (SwappedButtons) buttonNum = NB_BUTTONS - 1 - buttonNum; if (SwappedButtons) buttonNum = NB_BUTTONS - 1 - buttonNum;
MouseButtonsStates[buttonNum] = TRUE; MouseButtonsStates[buttonNum] = TRUE;
AsyncMouseButtonsStates[buttonNum] = TRUE; AsyncMouseButtonsStates[buttonNum] = TRUE;
hardware_event( messages[buttonNum],
EVENT_XStateToKeyState( event->state ), 0L, if (pWnd)
pWnd->rectWindow.left + event->x, hardware_event( messages[buttonNum],
pWnd->rectWindow.top + event->y, EVENT_XStateToKeyState( event->state ), 0L,
event->time - MSG_WineStartTicks, pWnd->hwndSelf ); xOffset + event->x,
yOffset + event->y,
event->time - MSG_WineStartTicks, pWnd->hwndSelf );
EVENT_SendMouseEvent( statusCodes[buttonNum], EVENT_SendMouseEvent( statusCodes[buttonNum],
pWnd->rectWindow.left + event->x, xOffset + event->x,
pWnd->rectWindow.top + event->y, yOffset + event->y,
0, 0 ); 0, 0 );
} }
@ -740,18 +760,23 @@ static void EVENT_ButtonRelease( WND *pWnd, XButtonEvent *event )
{ ME_LUP, 0, ME_RUP }; { ME_LUP, 0, ME_RUP };
int buttonNum = event->button - 1; int buttonNum = event->button - 1;
int xOffset = pWnd? pWnd->rectWindow.left : 0;
int yOffset = pWnd? pWnd->rectWindow.top : 0;
if (buttonNum >= NB_BUTTONS) return; if (buttonNum >= NB_BUTTONS) return;
if (SwappedButtons) buttonNum = NB_BUTTONS - 1 - buttonNum; if (SwappedButtons) buttonNum = NB_BUTTONS - 1 - buttonNum;
MouseButtonsStates[buttonNum] = FALSE; MouseButtonsStates[buttonNum] = FALSE;
hardware_event( messages[buttonNum],
EVENT_XStateToKeyState( event->state ), 0L, if (pWnd)
pWnd->rectWindow.left + event->x, hardware_event( messages[buttonNum],
pWnd->rectWindow.top + event->y, EVENT_XStateToKeyState( event->state ), 0L,
event->time - MSG_WineStartTicks, pWnd->hwndSelf ); xOffset + event->x,
yOffset + event->y,
event->time - MSG_WineStartTicks, pWnd->hwndSelf );
EVENT_SendMouseEvent( statusCodes[buttonNum], EVENT_SendMouseEvent( statusCodes[buttonNum],
pWnd->rectWindow.left + event->x, xOffset + event->x,
pWnd->rectWindow.top + event->y, yOffset + event->y,
0, 0 ); 0, 0 );
} }
@ -1500,11 +1525,11 @@ static void EVENT_SendMouseEvent( WORD mouseStatus, WORD deltaX, WORD deltaY,
if ( !MouseEventProc ) return; if ( !MouseEventProc ) return;
TRACE( keyboard, "(%04X,%d,%d,%d,%ld)\n", mouseStatus, deltaX, deltaY, buttonCount, extraInfo ); TRACE( event, "(%04X,%d,%d,%d,%ld)\n", mouseStatus, deltaX, deltaY, buttonCount, extraInfo );
mouseStatus |= 0x8000; mouseStatus |= 0x8000;
deltaX = (((long)deltaX << 16) + screenWidth/2) / screenWidth; deltaX = (((long)deltaX << 16) + screenWidth-1) / screenWidth;
deltaY = (((long)deltaY << 16) + screenHeight/2) / screenHeight; deltaY = (((long)deltaY << 16) + screenHeight-1) / screenHeight;
memset( &context, 0, sizeof(context) ); memset( &context, 0, sizeof(context) );
CS_reg(&context) = SELECTOROF( MouseEventProc ); CS_reg(&context) = SELECTOROF( MouseEventProc );