[X2Go-Commits] [nx-libs] 182/219: Events.c: add more comments and TEST output

git-admin at x2go.org git-admin at x2go.org
Sat Sep 28 12:10:53 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit bcbf255104a1214c83e31a4266e38eb3c6369def
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Fri Jun 28 22:09:23 2019 +0200

    Events.c: add more comments and TEST output
---
 nx-X11/programs/Xserver/hw/nxagent/Events.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index c93842305..89030b1b0 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -1110,8 +1110,8 @@ FIXME: If we don't flush the queue here, it could happen
 /*
 FIXME: Don't enqueue the KeyRelease event if the key was
        not already pressed. This workaround avoids a fake
-       KeyPress is enqueued by the XKEYBOARD extension.
-       Another solution would be to let the events are
+       KeyPress being enqueued by the XKEYBOARD extension.
+       Another solution would be to let the events
        enqueued and to remove the KeyPress afterwards.
 */
         if (BitIsOn(inputInfo.keyboard -> key -> down,
@@ -1150,6 +1150,9 @@ FIXME: Don't enqueue the KeyRelease event if the key was
           nxagentXkbNumTrap = 0;
         }
 
+	/* Calculate the time elapsed between this and the last event we
+	   received. Add this delta to time we recorded for the last
+	   KeyPress event we passed on to our clients.  */
         memset(&x, 0, sizeof(xEvent));
         x.u.u.type = KeyRelease;
         x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode);
@@ -1165,8 +1168,14 @@ FIXME: Don't enqueue the KeyRelease event if the key was
           x.u.keyButtonPointer.time = nxagentLastEventTime;
         }
 
-        if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && sendKey == 1)
+        /* do not send a KeyRelease for a special keystroke since we
+           also did not send a KeyPress event in that case */
+        if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && (sendKey == 1))
         {
+          #ifdef TEST
+          fprintf(stderr, "%s: passing KeyRelease event to clients\n", __func__);
+          #endif
+
           mieqEnqueue(&x);
 
           CriticalOutputPending = 1;
@@ -1178,6 +1187,12 @@ FIXME: Don't enqueue the KeyRelease event if the key was
             NXShadowEvent(nxagentDisplay, X);
           }
         }
+        else
+        {
+          #ifdef TEST
+          fprintf(stderr, "%s: NOT passing KeyRelease event to clients\n", __func__);
+          #endif
+        }
 
         break;
       }
@@ -2241,6 +2256,9 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
 
   if (nxagentCheckSpecialKeystroke(&X -> xkey, result))
   {
+    #ifdef TEST
+    fprintf(stderr, "%s: NOT passing KeyPress event to clients\n", __func__);
+    #endif
     return 1;
   }
 
@@ -2262,6 +2280,10 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
   x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode);
   x.u.keyButtonPointer.time = nxagentLastKeyPressTime;
 
+  #ifdef TEST
+  fprintf(stderr, "%s: passing KeyPress event to clients\n", __func__);
+  #endif
+
   mieqEnqueue(&x);
 
   CriticalOutputPending = 1;

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list