[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    [xserver PATCH] dix: Send KeyPress and KeyRelease events to the XACE_KEY_AVAIL hook
From:       Andrew Eikum <aeikum () codeweavers ! com>
Date:       2015-04-22 15:48:59
Message-ID: 20150422154859.GU20764 () foghorn ! codeweavers ! com
[Download RAW message or body]

While it's documented in the XACE spec, the XACE_KEY_AVAIL hook is
currently never actually invoked by the xserver.

This hook was added in 13c6713c82 (25 Aug 2006), but as the keyboard
processing was moved into XKB, the hook was forgotten and silently
dropped. The code calling this hook was removed by 7af53799c (4 Jan
2009), but it was probably already unused before that.

This patch re-adds support for this hook. The "count" hook parameter is
unused.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
---

I'm not intimately familiar with the xserver input code, but this seems
like a logical place to invoke this XACE hook. The various keyboard
devices call QueueKeyboardEvents, which places the events into a generic
input queue for sending to clients. So, I think this makes a decent
bottleneck through which we can expect all keyboard input events to
flow.

Updates to the XACE spec documentation for the "count" parameter will
follow, pending acceptance.


 dix/getevents.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index d0a87f7..e18248f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -51,6 +51,7 @@
 #include "inpututils.h"
 #include "mi.h"
 #include "windowstr.h"
+#include "xace.h"
 
 #include <X11/extensions/XKBproto.h>
 #include "xkbsrv.h"
@@ -1058,9 +1059,24 @@ void
 QueueKeyboardEvents(DeviceIntPtr device, int type,
                     int keycode)
 {
-    int nevents;
+    int nevents, i;
 
     nevents = GetKeyboardEvents(InputEventList, device, type, keycode);
+
+    /* send KeyPress and KeyRelease events to XACE plugins */
+    for (i = 0; i < nevents; i++) {
+        if (InputEventList[i].any.type == ET_KeyPress ||
+                InputEventList[i].any.type == ET_KeyRelease) {
+            xEvent *core;
+            int count;
+
+            if (EventToCore(&InputEventList[i], &core, &count) == Success) {
+                XaceHook(XACE_KEY_AVAIL, core, device, 0);
+                free(core);
+            }
+        }
+    }
+
     queueEventList(device, InputEventList, nevents);
 }
 
-- 
2.3.5

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic