xserver: Branch 'xwayland-1.12' - 2 commits

Kristian Høgsberg krh at kemper.freedesktop.org
Wed May 30 07:37:05 PDT 2012


 hw/xfree86/xwayland/xwayland-input.c   |   43 ++++++++++++++-------------------
 hw/xfree86/xwayland/xwayland-private.h |    2 -
 2 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit a35853eab6002b9edeec887424d5e49eee04920c
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Wed May 30 10:37:42 2012 -0400

    xwayland: Drop unused modifier tracking code

diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
index e01cd8a..38a34e0 100644
--- a/hw/xfree86/xwayland/xwayland-input.c
+++ b/hw/xfree86/xwayland/xwayland-input.c
@@ -373,21 +373,6 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,
 
     xwl_seat->xwl_screen->serial = serial;
 
-    switch (key) {
-    case KEY_LEFTMETA:
-    case KEY_RIGHTMETA:
-	modifier = MODIFIER_META;
-	break;
-    default:
-	modifier = 0;
-	break;
-    }
-
-    if (state)
-	xwl_seat->modifiers |= modifier;
-    else
-	xwl_seat->modifiers &= ~modifier;
-
     end = xwl_seat->keys.data + xwl_seat->keys.size;
     for (k = xwl_seat->keys.data; k < end; k++) {
 	if (*k == key)
@@ -412,17 +397,9 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
 
     xwl_seat->xwl_screen->serial = serial;
 
-    xwl_seat->modifiers = 0;
     wl_array_copy(&xwl_seat->keys, keys);
-    wl_array_for_each(k, &xwl_seat->keys) {
-	switch (*k) {
-	case KEY_LEFTMETA:
-	case KEY_RIGHTMETA:
-	    xwl_seat->modifiers |= MODIFIER_META;
-	    break;
-	}
+    wl_array_for_each(k, &xwl_seat->keys)
 	xf86PostKeyboardEvent(xwl_seat->keyboard, *k + 8, 1);
-    }
 }
 
 static void
diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h
index 89ba8d1..4dd5673 100644
--- a/hw/xfree86/xwayland/xwayland-private.h
+++ b/hw/xfree86/xwayland/xwayland-private.h
@@ -99,7 +99,6 @@ struct xwl_seat {
     struct xwl_window		*focus_window;
     int32_t			 grab_x, grab_y;
     uint32_t			 id;
-    uint32_t			 modifiers;
     uint32_t			 pointer_enter_serial;
     struct xorg_list		 link;
 };
commit 3a2c142c7b48f5f21c3ed259675ad63e7cfd2b9d
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Wed May 30 10:36:54 2012 -0400

    xwayland: Track keyboard state, reset on keyboard enter/leave

diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
index 706623a..e01cd8a 100644
--- a/hw/xfree86/xwayland/xwayland-input.c
+++ b/hw/xfree86/xwayland/xwayland-input.c
@@ -369,6 +369,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,
 {
     struct xwl_seat *xwl_seat = data;
     uint32_t modifier;
+    uint32_t *k, *end;
 
     xwl_seat->xwl_screen->serial = serial;
 
@@ -387,6 +388,17 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,
     else
 	xwl_seat->modifiers &= ~modifier;
 
+    end = xwl_seat->keys.data + xwl_seat->keys.size;
+    for (k = xwl_seat->keys.data; k < end; k++) {
+	if (*k == key)
+	    *k = *--end;
+    }
+    xwl_seat->keys.size = (void *) end - xwl_seat->keys.data;
+    if (state) {
+	k = wl_array_add(&xwl_seat->keys, sizeof *k);
+	*k = key;
+    }
+
     xf86PostKeyboardEvent(xwl_seat->keyboard, key + 8, state);
 }
 
@@ -396,19 +408,20 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
 		      struct wl_surface *surface, struct wl_array *keys)
 {
     struct xwl_seat *xwl_seat = data;
-    uint32_t *k, *end;
+    uint32_t *k;
 
     xwl_seat->xwl_screen->serial = serial;
 
     xwl_seat->modifiers = 0;
-    end = (uint32_t *) ((char *) keys->data + keys->size);
-    for (k = keys->data; k < end; k++) {
+    wl_array_copy(&xwl_seat->keys, keys);
+    wl_array_for_each(k, &xwl_seat->keys) {
 	switch (*k) {
 	case KEY_LEFTMETA:
 	case KEY_RIGHTMETA:
 	    xwl_seat->modifiers |= MODIFIER_META;
 	    break;
 	}
+	xf86PostKeyboardEvent(xwl_seat->keyboard, *k + 8, 1);
     }
 }
 
@@ -417,8 +430,12 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
 		      uint32_t serial, struct wl_surface *surface)
 {
     struct xwl_seat *xwl_seat = data;
+    uint32_t *k;
 
     xwl_seat->xwl_screen->serial = serial;
+
+    wl_array_for_each(k, &xwl_seat->keys)
+	xf86PostKeyboardEvent(xwl_seat->keyboard, *k + 8, 0);
 }
 
 static const struct wl_keyboard_listener keyboard_listener = {
@@ -472,6 +489,7 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id,
     xwl_seat->id = id;
 
     wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat);
+    wl_array_init(&xwl_seat->keys);
 }
 
 static void
diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h
index f1fec23..89ba8d1 100644
--- a/hw/xfree86/xwayland/xwayland-private.h
+++ b/hw/xfree86/xwayland/xwayland-private.h
@@ -94,6 +94,7 @@ struct xwl_seat {
     struct wl_seat		*seat;
     struct wl_pointer		*wl_pointer;
     struct wl_keyboard		*wl_keyboard;
+    struct wl_array		 keys;
     int				 grab;
     struct xwl_window		*focus_window;
     int32_t			 grab_x, grab_y;


More information about the xorg-commit mailing list