[PATCH kdrive/ephyr v2] ephyr: move SetNotifyFd()/RemoveNotifyFd() calls outside ephyr mouse driver

Laércio de Sousa laerciosousa at sme-mogidascruzes.sp.gov.br
Fri May 20 11:17:33 UTC 2016


When Xephyr is launched in multi-seat mode (i.e. with command-line option
"-seat seatXXXX"), ephyr virtual keyboard/mouse driver is not loaded.

Without this patch, Xephyr won't listen to any events in multi-seat mode,
including XCB_EXPOSE and XCB_CONFIGURE_NOTIFY, which may be needed even
for this mode.

v2: Don't register XCB input events when creating a new Xephyr window,
    if -seat option is passed.

Signed-off-by: Laércio de Sousa <laerciosousa at sme-mogidascruzes.sp.gov.br>
---
 hw/kdrive/ephyr/ephyr.c |  4 ++--
 hw/kdrive/ephyr/hostx.c | 33 ++++++++++++++++++---------------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index f6897cc..9eae0c7 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -709,6 +709,7 @@ ephyrPreserve(KdCardInfo * card)
 Bool
 ephyrEnable(ScreenPtr pScreen)
 {
+    SetNotifyFd(hostx_get_fd(), ephyrXcbNotify, X_NOTIFY_READ, NULL);
     return TRUE;
 }
 
@@ -721,6 +722,7 @@ ephyrDPMS(ScreenPtr pScreen, int mode)
 void
 ephyrDisable(ScreenPtr pScreen)
 {
+    RemoveNotifyFd(hostx_get_fd());
 }
 
 void
@@ -1257,7 +1259,6 @@ static Status
 MouseEnable(KdPointerInfo * pi)
 {
     ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = TRUE;
-    SetNotifyFd(hostx_get_fd(), ephyrXcbNotify, X_NOTIFY_READ, NULL);
     return Success;
 }
 
@@ -1265,7 +1266,6 @@ static void
 MouseDisable(KdPointerInfo * pi)
 {
     ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = FALSE;
-    RemoveNotifyFd(hostx_get_fd());
     return;
 }
 
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index cdb12b0..1ef8cec 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -430,16 +430,17 @@ hostx_init(void)
     xcb_screen_t *xscreen;
     xcb_rectangle_t rect = { 0, 0, 1, 1 };
 
-    attrs[0] =
-        XCB_EVENT_MASK_BUTTON_PRESS
-        | XCB_EVENT_MASK_BUTTON_RELEASE
-        | XCB_EVENT_MASK_POINTER_MOTION
-        | XCB_EVENT_MASK_KEY_PRESS
-        | XCB_EVENT_MASK_KEY_RELEASE
-        | XCB_EVENT_MASK_EXPOSURE
-        | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
+    attrs[0] = XCB_EVENT_MASK_EXPOSURE
+               | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
     attr_mask |= XCB_CW_EVENT_MASK;
 
+    if (!SeatId)
+        attrs[0] |= XCB_EVENT_MASK_BUTTON_PRESS
+                    | XCB_EVENT_MASK_BUTTON_RELEASE
+                    | XCB_EVENT_MASK_POINTER_MOTION
+                    | XCB_EVENT_MASK_KEY_PRESS
+                    | XCB_EVENT_MASK_KEY_RELEASE;
+
     EPHYR_DBG("mark");
 #ifdef GLAMOR
     if (ephyr_glamor)
@@ -1348,19 +1349,21 @@ hostx_create_window(int a_screen_number,
     depth = xcb_aux_get_depth_of_visual(screen, a_visual_id);
 
     winmask = XCB_CW_EVENT_MASK | XCB_CW_COLORMAP;
-    attrs[0] = XCB_EVENT_MASK_BUTTON_PRESS
-              |XCB_EVENT_MASK_BUTTON_RELEASE
-              |XCB_EVENT_MASK_POINTER_MOTION
-              |XCB_EVENT_MASK_KEY_PRESS
-              |XCB_EVENT_MASK_KEY_RELEASE
-              |XCB_EVENT_MASK_EXPOSURE;
+    attrs[0] = XCB_EVENT_MASK_EXPOSURE;
     attrs[1] = xcb_generate_id(HostX.conn);
+
+    if (!SeatId)
+        attrs[0] |= XCB_EVENT_MASK_BUTTON_PRESS
+                    | XCB_EVENT_MASK_BUTTON_RELEASE
+                    | XCB_EVENT_MASK_POINTER_MOTION
+                    | XCB_EVENT_MASK_KEY_PRESS
+                    | XCB_EVENT_MASK_KEY_RELEASE;
+
     xcb_create_colormap(HostX.conn,
                         XCB_COLORMAP_ALLOC_NONE,
                         attrs[1],
                         hostx_get_window(a_screen_number),
                         a_visual_id);
-
     win = xcb_generate_id(HostX.conn);
     xcb_create_window(HostX.conn,
                       depth,
-- 
2.7.4



More information about the xorg-devel mailing list