diff options
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/CHANGELOG | 24 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.c | 181 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 23 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 53 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Options.c | 5 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Options.h | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 8 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Screen.c | 21 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Screen.h | 3 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c | 4 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c.NX.original | 4 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c | 106 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c.NX.original | 106 |
14 files changed, 540 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG index 9e746bb78..90f4949ee 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG +++ b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG @@ -1,5 +1,29 @@ ChangeLog: +nxagent-3.3.0-13 + +- Handle the window unmap immediately. Don't add it to the configure + queue. + +nxagent-3.3.0-12 + +- Fixed TR03G02200. Timestamps could be in the future in KeyRelease + events sent to the X clients. + +- Added debug logging of input devices state Logging can be enabled + or disabled via the Ctrl+Alt+x shortcut. State info is dumped every + 5 seconds. + +- Added Ctrl+Alt+y shortcut used to deactivate input devices grab for + debug purposes. + +nxagent-3.3.0-11 + +- Changed the message logging the screen size changes, in order to + show the fullscreen state. + +- Handle the window unmapping in the nxagentConfigureWindow queue. + nxagent-3.3.0-10 - Fixed TR12F02146. Compare the drawable and the bitmap data before diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 3c1458cb7..e456989cd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -803,6 +803,11 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) nxagentLastEventTime = GetTimeInMillis(); + if (x.u.keyButtonPointer.time > nxagentLastEventTime) + { + x.u.keyButtonPointer.time = nxagentLastEventTime; + } + if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result))) { mieqEnqueue(&x); @@ -4022,4 +4027,180 @@ void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data) } } +void nxagentDeactivateInputDevicesGrabs() +{ + fprintf(stderr, "Info: Deactivating input devices grabs.\n"); + + if (inputInfo.pointer -> grab) + { + (*inputInfo.pointer -> DeactivateGrab)(inputInfo.pointer); + } + + if (inputInfo.keyboard -> grab) + { + (*inputInfo.keyboard -> DeactivateGrab)(inputInfo.keyboard); + } +} + +static const char *nxagentGrabStateToString(int state) +{ + switch (state) + { + case 0: + return "NOT_GRABBED"; + case 1: + return "THAWED"; + case 2: + return "THAWED_BOTH"; + case 3: + return "FREEZE_NEXT_EVENT"; + case 4: + return "FREEZE_BOTH_NEXT_EVENT"; + case 5: + return "FROZEN_NO_EVENT"; + case 6: + return "FROZEN_WITH_EVENT"; + case 7: + return "THAW_OTHERS"; + default: + return "unknown state"; + } +} + +void nxagentDumpInputDevicesState(void) +{ + int i, k; + int mask = 1; + CARD8 val; + DeviceIntPtr dev; + GrabPtr grab; + WindowPtr pWin = NULL; + + fprintf(stderr, "\n*** Dump input devices state: BEGIN ***" + "\nKeys down:"); + + dev = inputInfo.keyboard; + + for (i = 0; i < DOWN_LENGTH; i++) + { + val = dev -> key -> down[i]; + + if (val != 0) + { + for (k = 0; k < 8; k++) + { + if (val & (mask << k)) + { + fprintf(stderr, "\n\t[%d] [%s]", i * 8 + k, + XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0))); + } + } + } + } + + fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%lu]" + "\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]" + "\n\tfrom passive grab [%s]\n\tactivating key [%d]", dev, + dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes": "No", + nxagentGrabStateToString(dev -> sync.state), + dev -> sync.other, dev -> sync.evcount, + dev -> fromPassiveGrab ? "Yes" : "No", + dev -> activatingKey); + + grab = dev -> grab; + + if (grab) + { + fprintf(stderr, "\nKeyboard grab state: \n\twindow pointer [%p]" + "\n\towner events flag [%s]\n\tgrab mode [%s]", + grab -> window, grab -> ownerEvents ? "True" : "False", + grab -> keyboardMode ? "asynchronous" : "synchronous"); + + /* + * Passive grabs. + */ + + pWin = grab -> window; + grab = wPassiveGrabs(pWin); + + while (grab) + { + fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" + "\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]" + "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%lx]", + grab -> device, grab -> ownerEvents ? "True" : "False", + grab -> pointerMode ? "asynchronous" : "synchronous", + grab -> keyboardMode ? "asynchronous" : "synchronous", + grab -> type, grab -> modifiersDetail.exact, + grab -> detail.exact, grab -> eventMask); + + grab = grab -> next; + } + } + + fprintf(stderr, "\nButtons down:"); + + dev = inputInfo.pointer; + + for (i = 0; i < DOWN_LENGTH; i++) + { + val = dev -> button -> down[i]; + + if (val != 0) + { + for (k = 0; k < 8; k++) + { + if (val & (mask << k)) + { + fprintf(stderr, "\n\t[%d]", i * 8 + k); + } + } + } + } + + fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%lu]" + "\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]" + "\n\tfrom passive grab [%s]\n\tactivating button [%d]", dev, + dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes" : "No", + nxagentGrabStateToString(dev -> sync.state), + dev -> sync.other, dev -> sync.evcount, + dev -> fromPassiveGrab ? "Yes" : "No", + dev -> activatingKey); + + grab = dev -> grab; + + if (grab) + { + fprintf(stderr, "\nPointer grab state: \n\twindow pointer [%p]" + "\n\towner events flag [%s]\n\tgrab mode [%s]", + grab -> window, grab -> ownerEvents ? "True" : "False", + grab -> pointerMode ? "asynchronous" : "synchronous"); + + if (grab -> window != pWin) + { + /* + * Passive grabs. + */ + + grab = wPassiveGrabs(grab -> window); + + while (grab) + { + fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" + "\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]" + "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%lx]", + grab -> device, grab -> ownerEvents ? "True" : "False", + grab -> pointerMode ? "asynchronous" : "synchronous", + grab -> keyboardMode ? "asynchronous" : "synchronous", + grab -> type, grab -> modifiersDetail.exact, + grab -> detail.exact, grab -> eventMask); + + grab = grab -> next; + } + } + } + + fprintf(stderr, "\n*** Dump input devices state: FINISH ***\n"); +} + #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index 3abc3575f..3d94e63af 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -105,6 +105,13 @@ #define MINIMUM_DISPLAY_BUFFER 512 +#ifdef NX_DEBUG_INPUT +extern int nxagentDebugInputDevices; +extern unsigned long nxagentLastInputDevicesDumpTime; + +extern void nxagentDumpInputDevicesState(void); +#endif + /* * Used in the handling of the X desktop * manager protocol. @@ -186,6 +193,18 @@ void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask) now = GetTimeInMillis(); + #ifdef NX_DEBUG_INPUT + + if (nxagentDebugInputDevices == 1 && + now - nxagentLastInputDevicesDumpTime > 5000) + { + nxagentLastInputDevicesDumpTime = now; + + nxagentDumpInputDevicesState(); + } + + #endif + if (nxagentNeedConnectionChange() == 1) { #ifdef TEST @@ -540,6 +559,8 @@ void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask) #endif + nxagentPrintGeometry(); + #ifdef BLOCKS fprintf(stderr, "[End block]\n"); #endif @@ -820,6 +841,8 @@ FIXME: Must queue multiple writes and handle #endif + nxagentPrintGeometry(); + #ifdef BLOCKS fprintf(stderr, "[End block]\n"); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index ea06913f8..762ab79dc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -31,6 +31,12 @@ extern Bool nxagentWMIsRunning; extern Bool nxagentIpaq; +#ifdef NX_DEBUG_INPUT +int nxagentDebugInputDevices = 0; +unsigned long nxagentLastInputDevicesDumpTime = 0; +extern void nxagentDeactivateInputDevicesGrabs(); +#endif + /* * Set here the required log level. */ @@ -209,6 +215,53 @@ int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) } #endif + + #ifdef NX_DEBUG_INPUT + + case XK_X: + case XK_x: + { + /* + * Used to test the input devices state. + */ + + if (X -> type == KeyPress) + { + if (nxagentDebugInputDevices == 0) + { + fprintf(stderr, "Info: Turning input devices debug ON.\n"); + + nxagentDebugInputDevices = 1; + } + else + { + fprintf(stderr, "Info: Turning input devices debug OFF.\n"); + + nxagentDebugInputDevices = 0; + + nxagentLastInputDevicesDumpTime = 0; + } + } + + return 1; + } + + case XK_Y: + case XK_y: + { + /* + * Used to deactivate input devices grab. + */ + + if (X -> type == KeyPress) + { + nxagentDeactivateInputDevicesGrabs(); + } + + return 1; + } + + #endif } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c index 64dbe3b42..ca8cfc12f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c @@ -39,6 +39,11 @@ AgentOptionsRec nxagentOptionsBackup; AgentOptionsPtr nxagentOptionsPtr = &nxagentOptions; /* + * If this is set, print the geometry in the block handler. + */ + +unsigned int nxagentPrintGeometryFlags = 0; +/* * This must be called at startup to initialize * the options repository to the default values. */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h index aa78489b1..af437cd16 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h @@ -29,6 +29,8 @@ #define UNDEFINED -1 #define COPY_UNLIMITED -1 +extern unsigned int nxagentPrintGeometryFlags; + typedef enum _BackingStoreMode { BackingStoreUndefined = -1, diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 69b73a942..f73d4692c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -257,7 +257,11 @@ TODO: This should be reset only when if ((dispatchException & DE_TERMINATE) == 0) { + #ifdef NX_DEBUG_INPUT + fprintf(stderr, "Session: Session suspended at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); + #else fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString()); + #endif } nxagentResetDisplayHandlers(); @@ -609,7 +613,11 @@ Bool nxagentReconnectSession(void) goto nxagentReconnectError; } + #ifdef NX_DEBUG_INPUT + fprintf(stderr, "Session: Session resumed at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); + #else fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString()); + #endif nxagentRemoveSplashWindow(NULL); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 524bafd10..fa08e05b0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -2373,8 +2373,7 @@ FIXME: We should try to restore the previously nxagentPrintAgentGeometry("After Resize Screen", "nxagentResizeScreen:"); #endif - fprintf(stderr, "Info: Screen [%d] resized to geometry [%dx%d].\n", - pScreen -> myNum, width, height); + nxagentSetPrintGeometry(pScreen -> myNum); return 1; @@ -3903,6 +3902,24 @@ void nxagentShadowAdaptToRatio(void) REGION_UNINIT(pScreen, ®ion); } +void nxagentPrintGeometry() +{ + int i; + + for (i = 0; i < screenInfo.numScreens; i++) + { + if (nxagentPrintGeometryFlags && (1 << i)) + { + fprintf(stderr, "Info: Screen [%d] resized to geometry [%dx%d] " + "fullscreen [%d].\n", i, screenInfo.screens[i] -> width, + screenInfo.screens[i] -> height, + nxagentOption(Fullscreen)); + } + } + + nxagentPrintGeometryFlags = 0; +} + #ifdef DUMP void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h index 3550dd553..73af3cc50 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h @@ -36,6 +36,9 @@ is" without express or implied warranty. #define MIN_NXAGENT_HEIGHT 60 #define NXAGENT_FRAME_WIDTH 2000 +#define nxagentSetPrintGeometry(screen) \ + nxagentPrintGeometryFlags = (1 << (screen)); + extern int nxagentClients; extern int nxagentAutoDisconnectTimeout; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 8da5d8bd1..8c94b24b5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -908,6 +908,8 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, nxagentOption(Width), nxagentOption(Height)); + + nxagentSetPrintGeometry(pScreen -> myNum); } #ifdef VIEWPORT_FRAME diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c index f84ca0e03..d267adbc9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c @@ -515,7 +515,11 @@ Dispatch(void) if (serverGeneration > nxagentMaxAllowedResets) { + #ifdef NX_DEBUG_INPUT + fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); + #else fprintf(stderr, "Session: Session started at '%s'.\n", GetTimeAsString()); + #endif nxagentSessionState = SESSION_UP; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c.NX.original b/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c.NX.original index f84ca0e03..d267adbc9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c.NX.original +++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXdispatch.c.NX.original @@ -515,7 +515,11 @@ Dispatch(void) if (serverGeneration > nxagentMaxAllowedResets) { + #ifdef NX_DEBUG_INPUT + fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); + #else fprintf(stderr, "Session: Session started at '%s'.\n", GetTimeAsString()); + #endif nxagentSessionState = SESSION_UP; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c index a8a2a68bd..1c141c015 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c @@ -191,6 +191,7 @@ xEvent *xeviexE; #ifdef NX_DEBUG_INPUT extern int nxagentDebugInput; +extern int nxagentDebugInputDevices; #endif extern Display *nxagentDisplay; @@ -1865,6 +1866,12 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, tempGrab.pointerMode = GrabModeAsync; tempGrab.confineTo = NullWindow; tempGrab.cursor = NullCursor; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "DeliverEventsToWindow: Activating passive grab on pointer.\n"); + } + #endif (*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab, currentTime, TRUE); } @@ -2735,6 +2742,13 @@ CheckPassiveGrabsOnWindow( tempGrab.modifiersDetail.exact&(~0x1f00); } #endif + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "CheckPassiveGrabsOnWindow: Activating passive grab on %s.\n", + device == inputInfo.keyboard ? "keyboard" : "pointer"); + } + #endif (*device->ActivateGrab)(device, grab, currentTime, TRUE); FixUpEventFromWindow(xE, grab->window, None, TRUE); @@ -3093,7 +3107,17 @@ drawable.id:0; else DeliverFocusedEvent(keybd, xE, sprite.win, count); if (deactivateGrab) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcessKeyboardEvent: Deactivating grab on keyboard.\n"); + } + #endif (*keybd->DeactivateGrab)(keybd); + #ifdef NX_DEBUG_INPUT + } + #endif } #ifdef XKB @@ -3320,7 +3344,17 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count mouse, count); #endif if (deactivateGrab) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcessPointerEvent: Deactivating grab on pointer.\n"); + } + #endif (*mouse->DeactivateGrab)(mouse); + #ifdef NX_DEBUG_INPUT + } + #endif } #define AtMostOneClient \ @@ -4041,6 +4075,12 @@ ProcGrabPointer(ClientPtr client) pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcGrabPointer: pWin [%p] client [%d].\n", pWin, client -> index); + } + #endif if (stuff->confineTo == None) confineTo = NullWindow; else @@ -4100,6 +4140,12 @@ ProcGrabPointer(ClientPtr client) tempGrab.keyboardMode = stuff->keyboardMode; tempGrab.pointerMode = stuff->pointerMode; tempGrab.device = device; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcGrabPointer: Activating active grab on pointer.\n"); + } + #endif (*device->ActivateGrab)(device, &tempGrab, time, FALSE); if (oldCursor) FreeCursor (oldCursor, (Cursor)0); @@ -4163,6 +4209,12 @@ ProcUngrabPointer(ClientPtr client) TimeStamp time; REQUEST(xResourceReq); + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabPointer: client [%d].\n", client -> index); + } + #endif REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; @@ -4170,7 +4222,25 @@ ProcUngrabPointer(ClientPtr client) if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabPointer: Deactivating grab on pointer.\n"); + } + #endif (*device->DeactivateGrab)(device); + #ifdef NX_DEBUG_INPUT + } + else + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabPointer: current time [%lu] request time [%lu] grab time [%lu].\n", + currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds); + } + } + #endif return Success; } @@ -4225,6 +4295,12 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, tempGrab.pointerMode = other_mode; tempGrab.eventMask = mask; tempGrab.device = dev; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "GrabDevice: Activating active grab on keyboard.\n"); + } + #endif (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE); *status = GrabSuccess; } @@ -4238,6 +4314,12 @@ ProcGrabKeyboard(ClientPtr client) REQUEST(xGrabKeyboardReq); int result; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcGrabKeyboard: client [%d].\n", client -> index); + } + #endif REQUEST_SIZE_MATCH(xGrabKeyboardReq); #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) @@ -4268,6 +4350,12 @@ ProcUngrabKeyboard(ClientPtr client) TimeStamp time; REQUEST(xResourceReq); + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabKeyboard: client [%d].\n", client -> index); + } + #endif REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; @@ -4275,7 +4363,25 @@ ProcUngrabKeyboard(ClientPtr client) if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabKeyboard: Deactivating grab on keyboard.\n"); + } + #endif (*device->DeactivateGrab)(device); + #ifdef NX_DEBUG_INPUT + } + else + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabKeyboard: current time [%lu] request time [%lu] grab time [%lu].\n", + currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds); + } + } + #endif return Success; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c.NX.original b/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c.NX.original index a8a2a68bd..1c141c015 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c.NX.original +++ b/nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c.NX.original @@ -191,6 +191,7 @@ xEvent *xeviexE; #ifdef NX_DEBUG_INPUT extern int nxagentDebugInput; +extern int nxagentDebugInputDevices; #endif extern Display *nxagentDisplay; @@ -1865,6 +1866,12 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, tempGrab.pointerMode = GrabModeAsync; tempGrab.confineTo = NullWindow; tempGrab.cursor = NullCursor; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "DeliverEventsToWindow: Activating passive grab on pointer.\n"); + } + #endif (*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab, currentTime, TRUE); } @@ -2735,6 +2742,13 @@ CheckPassiveGrabsOnWindow( tempGrab.modifiersDetail.exact&(~0x1f00); } #endif + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "CheckPassiveGrabsOnWindow: Activating passive grab on %s.\n", + device == inputInfo.keyboard ? "keyboard" : "pointer"); + } + #endif (*device->ActivateGrab)(device, grab, currentTime, TRUE); FixUpEventFromWindow(xE, grab->window, None, TRUE); @@ -3093,7 +3107,17 @@ drawable.id:0; else DeliverFocusedEvent(keybd, xE, sprite.win, count); if (deactivateGrab) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcessKeyboardEvent: Deactivating grab on keyboard.\n"); + } + #endif (*keybd->DeactivateGrab)(keybd); + #ifdef NX_DEBUG_INPUT + } + #endif } #ifdef XKB @@ -3320,7 +3344,17 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count mouse, count); #endif if (deactivateGrab) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcessPointerEvent: Deactivating grab on pointer.\n"); + } + #endif (*mouse->DeactivateGrab)(mouse); + #ifdef NX_DEBUG_INPUT + } + #endif } #define AtMostOneClient \ @@ -4041,6 +4075,12 @@ ProcGrabPointer(ClientPtr client) pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcGrabPointer: pWin [%p] client [%d].\n", pWin, client -> index); + } + #endif if (stuff->confineTo == None) confineTo = NullWindow; else @@ -4100,6 +4140,12 @@ ProcGrabPointer(ClientPtr client) tempGrab.keyboardMode = stuff->keyboardMode; tempGrab.pointerMode = stuff->pointerMode; tempGrab.device = device; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcGrabPointer: Activating active grab on pointer.\n"); + } + #endif (*device->ActivateGrab)(device, &tempGrab, time, FALSE); if (oldCursor) FreeCursor (oldCursor, (Cursor)0); @@ -4163,6 +4209,12 @@ ProcUngrabPointer(ClientPtr client) TimeStamp time; REQUEST(xResourceReq); + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabPointer: client [%d].\n", client -> index); + } + #endif REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; @@ -4170,7 +4222,25 @@ ProcUngrabPointer(ClientPtr client) if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabPointer: Deactivating grab on pointer.\n"); + } + #endif (*device->DeactivateGrab)(device); + #ifdef NX_DEBUG_INPUT + } + else + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabPointer: current time [%lu] request time [%lu] grab time [%lu].\n", + currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds); + } + } + #endif return Success; } @@ -4225,6 +4295,12 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, tempGrab.pointerMode = other_mode; tempGrab.eventMask = mask; tempGrab.device = dev; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "GrabDevice: Activating active grab on keyboard.\n"); + } + #endif (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE); *status = GrabSuccess; } @@ -4238,6 +4314,12 @@ ProcGrabKeyboard(ClientPtr client) REQUEST(xGrabKeyboardReq); int result; + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcGrabKeyboard: client [%d].\n", client -> index); + } + #endif REQUEST_SIZE_MATCH(xGrabKeyboardReq); #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) @@ -4268,6 +4350,12 @@ ProcUngrabKeyboard(ClientPtr client) TimeStamp time; REQUEST(xResourceReq); + #ifdef NX_DEBUG_INPUT + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabKeyboard: client [%d].\n", client -> index); + } + #endif REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; @@ -4275,7 +4363,25 @@ ProcUngrabKeyboard(ClientPtr client) if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) + #ifdef NX_DEBUG_INPUT + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabKeyboard: Deactivating grab on keyboard.\n"); + } + #endif (*device->DeactivateGrab)(device); + #ifdef NX_DEBUG_INPUT + } + else + { + if (nxagentDebugInputDevices == 1) + { + fprintf(stderr, "ProcUngrabKeyboard: current time [%lu] request time [%lu] grab time [%lu].\n", + currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds); + } + } + #endif return Success; } |