aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Events.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c181
1 files changed, 181 insertions, 0 deletions
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