This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch wl-input-inject
in repository enlightenment.
View the commit online.
commit d7302d35d17821a51e635254773bc09d836dfcd9
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Dec 1 19:06:05 2026 -0600
e_comp_wl_input - let a module inject input as a backend would
A remote-desktop server running inside E has pointer, key and touch
input to feed in, and it must behave as if it came from a device:
grabs, key and mouse bindings, pointer constraints, relative motion,
popup grab dismissal and the idle timer all listen on the ecore side
of the event, so feeding evas directly would skip them. wl_test already
had the recipe for this, posting Ecore_Event_* on the canvas window; it
moves here, comments included, and wl_test calls it, so the existing
input tests cover the pointer and touch injectors.
The position of a motion that is posted but not yet dispatched, which
lets a button right after a motion click at the new place, and the
last position of each touch point now live with the injectors, since
any caller has the same problem. Once dispatched, the position is the
one of the last motion on the canvas, whoever posted it, as evas does
not see a motion a popup grab takes. A touch id has to be positive: 0
is the pointer's device number.
Keys are given as evdev codes and read through E's current keymap.
They are posted as ecore key events with the key name, the key, the
string and the modifiers held before the key, as ecore_wl2 and
ecore_x report them, so they go through the bindings before the
focused client, and a bound key is not delivered. This differs from
e_comp_wl_key_inject(), which the virtual keyboard uses to deliver a
key to the client and deliberately bypasses grabs, and from
e_comp_wl_input_keyboard_event_generate(), which names a key of the us
layout.
The modifiers come from a private xkb state of the injected keys, as
E's own state only follows once a posted key is dispatched, which is
too late for a Shift posted just before an A. That state covers the
keys that are posted and not yet dispatched: whenever none is queued,
it takes the locks and the layout from E's state again, which other
devices may have changed. A press of a key that is down and a release
of one that is not are dropped, as E drops a repeated press and the
xkb state would otherwise keep the modifier of a key after its
release. E holds a key until it is released, so a caller must release
every key it pressed, for instance when its remote peer goes away.
A code that is not a key of the keymap is dropped with a warning.
The test interface gets a key_code request (wl_test version 14) to
drive e_comp_wl_input_inject_key().
Co-Authored-By: Claude Fable 5.2 <[email protected]>
---
src/bin/e_comp_wl_input.c | 434 ++++++++++++++++++++++++++++++++++
src/bin/e_comp_wl_input.h | 47 ++++
src/modules/wl_test/e_mod_main.c | 221 ++---------------
src/protocol/wl-test.xml | 13 +-
src/tests/wayland/meson.build | 1 +
src/tests/wayland/test_input_inject.c | 270 +++++++++++++++++++++
6 files changed, 784 insertions(+), 202 deletions(-)
diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c
index 822b38d6d..1ca241c17 100644
--- a/src/bin/e_comp_wl_input.c
+++ b/src/bin/e_comp_wl_input.c
@@ -10,6 +10,9 @@
E_API int E_EVENT_TEXT_INPUT_PANEL_VISIBILITY_CHANGE = -1;
static xkb_keycode_t (*_xkb_keymap_key_by_name)(void *, const char *);
static void _e_comp_wl_input_context_keymap_set(struct xkb_keymap *keymap, struct xkb_context *context);
+static void _e_comp_wl_input_inject_init(void);
+static void _e_comp_wl_input_inject_shutdown(void);
+static void _e_comp_wl_input_inject_motion_free(void *data, void *ev);
static Eina_Hash *input_gen_modifiers;
@@ -514,6 +517,8 @@ e_comp_wl_input_init(void)
_xkb_keymap_key_by_name = dlsym(NULL, "xkb_keymap_key_by_name");
+ _e_comp_wl_input_inject_init();
+
if (cached_keymap)
_e_comp_wl_input_context_keymap_set(cached_keymap, cached_context);
else
@@ -535,6 +540,7 @@ e_comp_wl_input_shutdown(void)
struct wl_resource *res;
E_FREE_FUNC(input_gen_modifiers, eina_hash_free);
+ _e_comp_wl_input_inject_shutdown();
/* destroy pointer resources */
EINA_LIST_FREE(e_comp_wl->ptr.resources, res)
@@ -1021,3 +1027,431 @@ e_comp_wl_input_keyboard_event_generate(const char *key, int mods, Eina_Bool up)
if (up)
_event_generate_mods(mods, up);
}
+
+/* Input is posted as ecore events, the way a backend delivers it, rather than
+ * fed to evas directly. Wayland clients are reached through evas callbacks
+ * on their frame, but a good part of E listens on the ecore side of the same
+ * event: wl_keyboard.key and key bindings, relative pointer motion, pointer
+ * constraints, popup grab dismissal and the idle timer. Feeding evas would
+ * skip all of it. The buffer canvas is registered with ecore_input_evas,
+ * which carries the event on to evas after E's own handlers have run. */
+
+typedef struct
+{
+ int id, x, y;
+} E_Comp_Wl_Input_Touch;
+
+/* The last pointer position posted and how many posted motions are still
+ * queued. */
+static int _inject_x = 0, _inject_y = 0;
+static int _inject_motions_queued = 0;
+
+/* The position of the last pointer motion dispatched, whoever posted it. */
+static int _dispatched_x = 0, _dispatched_y = 0;
+static Eina_Bool _dispatched_seen = EINA_FALSE;
+
+static Eina_List *_inject_handlers = NULL;
+
+/* Touch points that are down, so a touch lifts where it last was. */
+static Eina_List *_inject_touches = NULL;
+
+/* What the keys injected so far add up to. E's own state only follows once
+ * a posted key is dispatched, and a key posted right after a modifier must
+ * already see it. So this state exists for the keys posted and not yet
+ * dispatched: while none is queued, it takes the locks and the layout from
+ * E's state again, which other devices may have changed. The keymap is held
+ * so that it is told from a new one. */
+static struct xkb_keymap *_inject_keymap = NULL;
+static struct xkb_state *_inject_state = NULL;
+static int _inject_keys_queued = 0;
+
+/* The evdev codes of the injected keys that are down, as a key is down once
+ * however often a remote peer repeats its press. */
+static Eina_List *_inject_held = NULL;
+
+static void
+_e_comp_wl_input_inject_mouse_post(int type, int device, int button,
+ int x, int y, unsigned int timestamp)
+{
+ Ecore_Event_Mouse_Button *ev;
+
+ ev = calloc(1, sizeof(*ev));
+ if (!ev) return;
+
+ ev->window = e_comp->ee_win;
+ ev->event_window = e_comp->ee_win;
+ ev->root_window = e_comp->ee_win;
+ ev->timestamp = timestamp;
+ ev->same_screen = 1;
+ ev->buttons = button;
+ ev->x = ev->root.x = x;
+ ev->y = ev->root.y = y;
+ ev->multi.device = device;
+ ev->multi.x = ev->multi.root.x = x;
+ ev->multi.y = ev->multi.root.y = y;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+
+ ecore_event_add(type, ev, NULL, NULL);
+}
+
+/* Called once the event has been dispatched, whatever became of it. */
+static void
+_e_comp_wl_input_inject_motion_free(void *data EINA_UNUSED, void *ev)
+{
+ _inject_motions_queued--;
+ free(ev);
+}
+
+static void
+_e_comp_wl_input_inject_move_post(int device, int x, int y, unsigned int timestamp)
+{
+ Ecore_Event_Mouse_Move *ev;
+
+ ev = calloc(1, sizeof(*ev));
+ if (!ev) return;
+
+ ev->window = e_comp->ee_win;
+ ev->event_window = e_comp->ee_win;
+ ev->root_window = e_comp->ee_win;
+ ev->timestamp = timestamp;
+ ev->same_screen = 1;
+ ev->x = ev->root.x = x;
+ ev->y = ev->root.y = y;
+ ev->multi.device = device;
+ ev->multi.x = ev->multi.root.x = x;
+ ev->multi.y = ev->multi.root.y = y;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+
+ if (device)
+ {
+ ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
+ return;
+ }
+ _inject_motions_queued++;
+ ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev,
+ _e_comp_wl_input_inject_motion_free, NULL);
+}
+
+static Eina_Bool
+_e_comp_wl_input_inject_cb_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ Ecore_Event_Mouse_Move *ev = event;
+
+ if ((ev->window == e_comp->ee_win) && (!ev->multi.device))
+ {
+ _dispatched_x = ev->x;
+ _dispatched_y = ev->y;
+ _dispatched_seen = EINA_TRUE;
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_e_comp_wl_input_inject_init(void)
+{
+ /* Before E's own handler, which cancels a motion a pointer constraint
+ * swallowed: this one must still see it to know where the pointer is. */
+ E_LIST_HANDLER_APPEND_PRE(_inject_handlers, ECORE_EVENT_MOUSE_MOVE,
+ _e_comp_wl_input_inject_cb_mouse_move, NULL);
+}
+
+static void
+_e_comp_wl_input_inject_shutdown(void)
+{
+ E_FREE_LIST(_inject_handlers, ecore_event_handler_del);
+ E_FREE_LIST(_inject_touches, free);
+ _inject_held = eina_list_free(_inject_held);
+ _dispatched_seen = EINA_FALSE;
+ E_FREE_FUNC(_inject_state, xkb_state_unref);
+ E_FREE_FUNC(_inject_keymap, xkb_keymap_unref);
+}
+
+/* ecore_event_add queues, so until a posted motion has been dispatched evas
+ * still reports the position from before it. A button pressed in between
+ * must use the posted position, or it clicks where the pointer used to be.
+ * Once dispatched, the position is the one of the last motion, not evas's,
+ * as e_comp_wl_grab_client_mouse_move() moves the pointer during a popup
+ * grab without telling evas, as only the popup may see it. */
+E_API void
+e_comp_wl_input_pointer_xy_get(int *x, int *y)
+{
+ if (_inject_motions_queued)
+ {
+ if (x) *x = _inject_x;
+ if (y) *y = _inject_y;
+ }
+ else if (_dispatched_seen)
+ {
+ if (x) *x = _dispatched_x;
+ if (y) *y = _dispatched_y;
+ }
+ else
+ evas_pointer_canvas_xy_get(e_comp->evas, x, y);
+}
+
+E_API void
+e_comp_wl_input_inject_pointer_motion(int x, int y, unsigned int timestamp)
+{
+ _inject_x = x;
+ _inject_y = y;
+ _e_comp_wl_input_inject_move_post(0, x, y, timestamp);
+}
+
+E_API void
+e_comp_wl_input_inject_pointer_button(unsigned int button, Eina_Bool pressed, unsigned int timestamp)
+{
+ int b, x, y;
+
+ /* evas numbers buttons from 1 in X11 order, where right and middle are
+ * the other way round from linux/input.h. */
+ switch (button)
+ {
+ case BTN_LEFT: b = 1; break;
+ case BTN_MIDDLE: b = 2; break;
+ case BTN_RIGHT: b = 3; break;
+ default: b = (int)(button - BTN_LEFT) + 1; break;
+ }
+
+ e_comp_wl_input_pointer_xy_get(&x, &y);
+ _e_comp_wl_input_inject_mouse_post(pressed ? ECORE_EVENT_MOUSE_BUTTON_DOWN
+ : ECORE_EVENT_MOUSE_BUTTON_UP, 0, b, x, y, timestamp);
+}
+
+E_API void
+e_comp_wl_input_inject_pointer_axis(Eina_Bool horizontal, int steps, unsigned int timestamp)
+{
+ Ecore_Event_Mouse_Wheel *ev;
+ int x, y;
+
+ ev = calloc(1, sizeof(*ev));
+ if (!ev) return;
+
+ e_comp_wl_input_pointer_xy_get(&x, &y);
+ ev->window = e_comp->ee_win;
+ ev->event_window = e_comp->ee_win;
+ ev->root_window = e_comp->ee_win;
+ ev->timestamp = timestamp;
+ ev->same_screen = 1;
+ ev->direction = horizontal ? 1 : 0;
+ ev->z = steps;
+ ev->x = ev->root.x = x;
+ ev->y = ev->root.y = y;
+
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
+}
+
+static E_Comp_Wl_Input_Touch *
+_e_comp_wl_input_inject_touch_find(int id)
+{
+ E_Comp_Wl_Input_Touch *t;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(_inject_touches, l, t)
+ {
+ if (t->id == id) return t;
+ }
+ return NULL;
+}
+
+/* ecore_input_evas turns an event with a non-zero multi.device into an evas
+ * multi event, and E forwards that device number as the wl_touch id. Device
+ * 0 is the pointer, which is why a touch id has to be positive. */
+E_API void
+e_comp_wl_input_inject_touch(int id, int x, int y, E_Comp_Wl_Touch_Phase phase,
+ unsigned int timestamp)
+{
+ E_Comp_Wl_Input_Touch *t;
+
+ EINA_SAFETY_ON_TRUE_RETURN(id <= 0);
+
+ t = _e_comp_wl_input_inject_touch_find(id);
+ switch (phase)
+ {
+ case E_COMP_WL_TOUCH_DOWN:
+ if (!t)
+ {
+ t = calloc(1, sizeof(*t));
+ if (!t) return;
+ t->id = id;
+ _inject_touches = eina_list_append(_inject_touches, t);
+ }
+ t->x = x;
+ t->y = y;
+ _e_comp_wl_input_inject_mouse_post(ECORE_EVENT_MOUSE_BUTTON_DOWN, id, 1, x, y, timestamp);
+ break;
+
+ case E_COMP_WL_TOUCH_MOVE:
+ if (!t) return;
+ t->x = x;
+ t->y = y;
+ _e_comp_wl_input_inject_move_post(id, x, y, timestamp);
+ break;
+
+ case E_COMP_WL_TOUCH_UP:
+ if (!t) return;
+ _inject_touches = eina_list_remove(_inject_touches, t);
+ _e_comp_wl_input_inject_mouse_post(ECORE_EVENT_MOUSE_BUTTON_UP, id, 1, t->x, t->y,
+ timestamp);
+ free(t);
+ break;
+ }
+}
+
+/* An Ecore_Event_Key modifier for each xkb modifier a key event reports.
+ * The lock bits are set when the modifier is locked rather than held. AltGr
+ * is the level three modifier, which the ISO_Level3_Shift key sets. */
+static const struct
+{
+ const char *name;
+ unsigned int modifier;
+ unsigned int lock;
+} _inject_modifiers[] =
+{
+ { XKB_MOD_NAME_CTRL, ECORE_EVENT_MODIFIER_CTRL, 0 },
+ { XKB_MOD_NAME_ALT, ECORE_EVENT_MODIFIER_ALT, 0 },
+ { XKB_MOD_NAME_SHIFT, ECORE_EVENT_MODIFIER_SHIFT, 0 },
+ { XKB_MOD_NAME_LOGO, ECORE_EVENT_MODIFIER_WIN, 0 },
+ { "LevelThree", ECORE_EVENT_MODIFIER_ALTGR, 0 },
+ { XKB_MOD_NAME_NUM, ECORE_EVENT_MODIFIER_NUM, ECORE_EVENT_LOCK_NUM },
+ { XKB_MOD_NAME_CAPS, ECORE_EVENT_MODIFIER_CAPS, ECORE_EVENT_LOCK_CAPS },
+};
+
+static struct xkb_state *
+_e_comp_wl_input_inject_key_state_get(void)
+{
+ struct xkb_state *state = _inject_state;
+
+ if (!e_comp_wl->xkb.keymap) return NULL;
+ if (_inject_keymap != e_comp_wl->xkb.keymap)
+ {
+ E_FREE_FUNC(_inject_state, xkb_state_unref);
+ E_FREE_FUNC(_inject_keymap, xkb_keymap_unref);
+ _inject_held = eina_list_free(_inject_held);
+ _inject_keymap = xkb_keymap_ref(e_comp_wl->xkb.keymap);
+ state = _inject_state = xkb_state_new(_inject_keymap);
+ if (!state) return NULL;
+ }
+
+ if ((!_inject_keys_queued) && e_comp_wl->xkb.state)
+ xkb_state_update_mask(state,
+ xkb_state_serialize_mods(state, XKB_STATE_MODS_DEPRESSED),
+ xkb_state_serialize_mods(e_comp_wl->xkb.state,
+ XKB_STATE_MODS_LATCHED),
+ xkb_state_serialize_mods(e_comp_wl->xkb.state,
+ XKB_STATE_MODS_LOCKED),
+ 0, 0,
+ xkb_state_serialize_layout(e_comp_wl->xkb.state,
+ XKB_STATE_LAYOUT_EFFECTIVE));
+ return state;
+}
+
+static void
+_e_comp_wl_input_inject_keysym_name_get(xkb_keysym_t sym, xkb_keycode_t code, char *buf, int size)
+{
+ if (xkb_keysym_get_name(sym, buf, size) > 0) return;
+ snprintf(buf, size, "Keycode-%u", code);
+}
+
+/* Called once the event has been dispatched, whatever became of it. */
+static void
+_e_comp_wl_input_inject_key_free(void *data EINA_UNUSED, void *ev)
+{
+ _inject_keys_queued--;
+ free(ev);
+}
+
+E_API void
+e_comp_wl_input_inject_key(unsigned int keycode, Eina_Bool pressed, unsigned int timestamp)
+{
+ Ecore_Event_Key *ev;
+ Eina_List *held;
+ struct xkb_state *state;
+ const xkb_keysym_t *syms;
+ xkb_keycode_t code;
+ xkb_keysym_t sym;
+ xkb_layout_index_t layout;
+ char key[64], keyname[64], string[16] = "";
+ unsigned int modifiers = 0, i;
+ int key_len, name_len, string_len;
+
+ EINA_SAFETY_ON_NULL_RETURN(e_comp_wl);
+ state = _e_comp_wl_input_inject_key_state_get();
+ EINA_SAFETY_ON_NULL_RETURN(state);
+
+ /* A code that is not a key of the keymap is dropped here, before it
+ * could be taken for one by the bindings or the client. Evdev codes
+ * are 8 below the xkb ones. */
+ if (keycode > (XKB_KEYCODE_MAX - 8))
+ {
+ WRN("key code %u is out of range", keycode);
+ return;
+ }
+ code = keycode + 8;
+ layout = xkb_state_key_get_layout(state, code);
+ if ((layout == XKB_LAYOUT_INVALID) ||
+ (xkb_keymap_key_get_syms_by_level(_inject_keymap, code, layout, 0, &syms) < 1))
+ {
+ WRN("key code %u is not in the keymap", keycode);
+ return;
+ }
+
+ /* A press of a key that is down is a repeat, and a release of one that is
+ * not down is nothing: E drops the first, and the xkb state would count
+ * the press twice and keep the key's modifier after its release. */
+ held = eina_list_data_find_list(_inject_held, (void *)(uintptr_t)keycode);
+ if (pressed == !!held) return;
+ if (pressed)
+ _inject_held = eina_list_append(_inject_held, (void *)(uintptr_t)keycode);
+ else
+ _inject_held = eina_list_remove_list(_inject_held, held);
+
+ /* As ecore_wl2 and ecore_x report it: the name is the key without
+ * modifiers, the key what the held modifiers make of it, and the
+ * modifiers are those held before this key. */
+ sym = xkb_state_key_get_one_sym(state, code);
+ _e_comp_wl_input_inject_keysym_name_get(syms[0], code, keyname, sizeof(keyname));
+ _e_comp_wl_input_inject_keysym_name_get(sym, code, key, sizeof(key));
+ if (xkb_state_key_get_utf8(state, code, string, sizeof(string)) < 1)
+ string[0] = '\0';
+ for (i = 0; i < EINA_C_ARRAY_LENGTH(_inject_modifiers); i++)
+ {
+ if (xkb_state_mod_name_is_active(state, _inject_modifiers[i].name,
+ XKB_STATE_MODS_DEPRESSED |
+ XKB_STATE_MODS_LATCHED) > 0)
+ modifiers |= _inject_modifiers[i].modifier;
+ if (_inject_modifiers[i].lock &&
+ (xkb_state_mod_name_is_active(state, _inject_modifiers[i].name,
+ XKB_STATE_MODS_LOCKED) > 0))
+ modifiers |= _inject_modifiers[i].lock;
+ }
+ xkb_state_update_key(state, code, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
+
+ name_len = strlen(keyname);
+ key_len = strlen(key);
+ string_len = strlen(string);
+ ev = calloc(1, sizeof(*ev) + name_len + key_len + string_len + 3);
+ if (!ev) return;
+
+ ev->keyname = (char *)(ev + 1);
+ ev->key = ev->keyname + name_len + 1;
+ ev->compose = string_len ? ev->key + key_len + 1 : NULL;
+ ev->string = ev->compose;
+ strcpy((char *)ev->keyname, keyname);
+ strcpy((char *)ev->key, key);
+ if (string_len) strcpy((char *)ev->compose, string);
+
+ ev->window = e_comp->ee_win;
+ ev->event_window = e_comp->ee_win;
+ ev->timestamp = timestamp;
+ ev->modifiers = modifiers;
+ ev->keycode = code;
+ _inject_keys_queued++;
+ ecore_event_add(pressed ? ECORE_EVENT_KEY_DOWN : ECORE_EVENT_KEY_UP, ev,
+ _e_comp_wl_input_inject_key_free, NULL);
+}
diff --git a/src/bin/e_comp_wl_input.h b/src/bin/e_comp_wl_input.h
index 2989d5b75..a978ceacc 100644
--- a/src/bin/e_comp_wl_input.h
+++ b/src/bin/e_comp_wl_input.h
@@ -37,6 +37,53 @@ E_API void e_comp_wl_input_keymap_set(const char *rules, const char *model, cons
E_API void e_comp_wl_input_keyboard_event_generate(const char *key, int mods, Eina_Bool up);
+typedef enum
+{
+ E_COMP_WL_TOUCH_DOWN,
+ E_COMP_WL_TOUCH_MOVE,
+ E_COMP_WL_TOUCH_UP
+} E_Comp_Wl_Touch_Phase;
+
+/* Input injected below is posted as an ecore event on the canvas, so it takes
+ * the path hardware input takes: key and mouse bindings, grabs, pointer
+ * constraints, relative motion, popup dismissal and the idle timer. A
+ * motion, a button or a key is not acted on before the call returns, but
+ * on the next main loop iteration. The timestamp of each is in milliseconds,
+ * from the caller. */
+
+/** The pointer position in canvas coordinates, with a posted motion counted. */
+E_API void e_comp_wl_input_pointer_xy_get(int *x, int *y);
+
+/** Move the pointer to a position in canvas coordinates. */
+E_API void e_comp_wl_input_inject_pointer_motion(int x, int y,
+ unsigned int timestamp);
+
+/** Press or release a pointer button, BTN_* of linux/input.h, where the
+ * pointer is, a motion posted just before included. */
+E_API void e_comp_wl_input_inject_pointer_button(unsigned int button, Eina_Bool pressed,
+ unsigned int timestamp);
+
+/** Turn a wheel by steps, a click for each, negative for up or left. */
+E_API void e_comp_wl_input_inject_pointer_axis(Eina_Bool horizontal, int steps, unsigned int timestamp);
+
+/** Press or release a key by its evdev code, KEY_* of linux/input.h,
+ * read through E's current keymap. It is dealt with as a key of a keyboard
+ * is: by the bindings first, then sent to the focused client. A code the
+ * keymap has no key for is dropped, and so is a press of a key already
+ * down or a release of one that is not.
+ *
+ * E keeps a key down until it is released, as it does for a device. The
+ * caller must release every key it pressed, for instance when the remote
+ * peer that sent the presses goes away. */
+E_API void e_comp_wl_input_inject_key(unsigned int keycode, Eina_Bool pressed, unsigned int timestamp);
+
+/** Put a touch point down, move it or lift it. The id is positive, as 0 is
+ * the pointer, and is kept while the point is down. A move or a lift of an
+ * id that is not down is ignored, and a lift ignores x and y: the point
+ * lifts where it last was. */
+E_API void e_comp_wl_input_inject_touch(int id, int x, int y, E_Comp_Wl_Touch_Phase phase,
+ unsigned int timestamp);
+
EINTERN int _e_comp_wl_input_keymap_fd_get(void);
# endif
diff --git a/src/modules/wl_test/e_mod_main.c b/src/modules/wl_test/e_mod_main.c
index 9dbff24ae..fa573043d 100644
--- a/src/modules/wl_test/e_mod_main.c
+++ b/src/modules/wl_test/e_mod_main.c
@@ -14,7 +14,6 @@
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Test" };
typedef struct _Wl_Test_Client Wl_Test_Client;
-typedef struct _Wl_Test_Touch Wl_Test_Touch;
struct _Wl_Test_Client
{
@@ -22,11 +21,6 @@ struct _Wl_Test_Client
unsigned int serial;
};
-struct _Wl_Test_Touch
-{
- int id, x, y;
-};
-
static struct wl_global *_wl_test_global = NULL;
static struct wl_listener _client_created_listener;
static Eina_List *_clients = NULL;
@@ -43,15 +37,6 @@ static E_Client_Hook *_client_del_hook = NULL;
static Eina_List *_pending_syncs = NULL;
static Ecore_Job *_sync_job = NULL;
-static Eina_List *_input_handlers = NULL;
-
-/* Touch points that are down, so touch_up lifts each where it last was. */
-static Eina_List *_touches = NULL;
-
-/* The last pointer position posted, while that motion is still queued. */
-static int _posted_x = 0, _posted_y = 0;
-static Eina_Bool _posted_pending = EINA_FALSE;
-
static void
_wl_test_cb_client_destroy(struct wl_listener *listener, void *data EINA_UNUSED)
{
@@ -440,114 +425,18 @@ _wl_test_cb_get_screensaver(struct wl_client *client EINA_UNUSED, struct wl_reso
wl_test_send_screensaver(resource, e_screensaver_on_get());
}
-/* Input is posted as ecore events, the way a backend delivers it, rather than
- * fed to evas directly. Wayland clients are reached through evas callbacks
- * on their frame, but a good part of E listens on the ecore side of the same
- * event: wl_keyboard.key and key bindings, relative pointer motion, pointer
- * constraints, popup grab dismissal and the idle timer. Feeding evas would
- * skip all of it. The buffer canvas is registered with ecore_input_evas,
- * which carries the event on to evas after E's own handlers have run. */
+/* The input requests go through the injectors a module would use, which
+ * post it as a backend delivers it. */
static unsigned int
_input_timestamp(void)
{
return (unsigned int)(ecore_time_get() * 1000.0);
}
-static void
-_input_mouse_post(int type, int device, int button, int x, int y)
-{
- Ecore_Event_Mouse_Button *ev;
-
- ev = calloc(1, sizeof(*ev));
- if (!ev) return;
-
- ev->window = e_comp->ee_win;
- ev->event_window = e_comp->ee_win;
- ev->root_window = e_comp->ee_win;
- ev->timestamp = _input_timestamp();
- ev->same_screen = 1;
- ev->buttons = button;
- ev->x = ev->root.x = x;
- ev->y = ev->root.y = y;
- ev->multi.device = device;
- ev->multi.x = ev->multi.root.x = x;
- ev->multi.y = ev->multi.root.y = y;
- ev->multi.radius = 1;
- ev->multi.radius_x = 1;
- ev->multi.radius_y = 1;
- ev->multi.pressure = 1.0;
-
- ecore_event_add(type, ev, NULL, NULL);
-}
-
-static void
-_input_move_post(int device, int x, int y)
-{
- Ecore_Event_Mouse_Move *ev;
-
- ev = calloc(1, sizeof(*ev));
- if (!ev) return;
-
- ev->window = e_comp->ee_win;
- ev->event_window = e_comp->ee_win;
- ev->root_window = e_comp->ee_win;
- ev->timestamp = _input_timestamp();
- ev->same_screen = 1;
- ev->x = ev->root.x = x;
- ev->y = ev->root.y = y;
- ev->multi.device = device;
- ev->multi.x = ev->multi.root.x = x;
- ev->multi.y = ev->multi.root.y = y;
- ev->multi.radius = 1;
- ev->multi.radius_x = 1;
- ev->multi.radius_y = 1;
- ev->multi.pressure = 1.0;
-
- ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
-}
-
-/* ecore_event_add queues, so until a posted motion has been dispatched evas
- * still reports the position from before it. A button pressed in between
- * must use the posted position, or it clicks where the pointer used to be.
- * So must one during a popup grab: e_comp_wl_grab_client_mouse_move()
- * moves the pointer without telling evas, as only the popup may see it. */
-static void
-_pointer_xy_get(int *x, int *y)
-{
- E_Client *ec = e_client_focused_get();
-
- if (_posted_pending || (ec && e_comp_wl_client_is_grabbed(ec)))
- {
- *x = _posted_x;
- *y = _posted_y;
- return;
- }
- evas_pointer_canvas_xy_get(e_comp->evas, x, y);
-}
-
-static Eina_Bool
-_input_cb_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- Ecore_Event_Mouse_Move *ev = event;
-
- if ((ev->window == e_comp->ee_win) && (!ev->multi.device))
- _posted_pending = EINA_FALSE;
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_pointer_motion(int x, int y)
-{
- _posted_x = x;
- _posted_y = y;
- _posted_pending = EINA_TRUE;
- _input_move_post(0, x, y);
-}
-
static void
_wl_test_cb_pointer_warp(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, int32_t x, int32_t y)
{
- _pointer_motion(x, y);
+ e_comp_wl_input_inject_pointer_motion(x, y, _input_timestamp());
}
static void
@@ -555,56 +444,24 @@ _wl_test_cb_pointer_move(struct wl_client *client EINA_UNUSED, struct wl_resourc
{
int px, py;
- _pointer_xy_get(&px, &py);
- _pointer_motion(px + dx, py + dy);
+ e_comp_wl_input_pointer_xy_get(&px, &py);
+ e_comp_wl_input_inject_pointer_motion(px + dx, py + dy, _input_timestamp());
}
static void
_wl_test_cb_pointer_button(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, uint32_t button, uint32_t pressed)
{
- int b, x, y;
-
- /* evas numbers buttons from 1 in X11 order, where right and middle are
- * the other way round from linux/input.h. */
- switch (button)
- {
- case BTN_LEFT: b = 1; break;
- case BTN_MIDDLE: b = 2; break;
- case BTN_RIGHT: b = 3; break;
- default: b = (int)(button - BTN_LEFT) + 1; break;
- }
-
- _pointer_xy_get(&x, &y);
- _input_mouse_post(pressed ? ECORE_EVENT_MOUSE_BUTTON_DOWN
- : ECORE_EVENT_MOUSE_BUTTON_UP, 0, b, x, y);
+ e_comp_wl_input_inject_pointer_button(button, !!pressed, _input_timestamp());
}
static void
_wl_test_cb_pointer_axis(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, uint32_t direction, int32_t steps)
{
- Ecore_Event_Mouse_Wheel *ev;
- int x, y;
-
- ev = calloc(1, sizeof(*ev));
- if (!ev) return;
-
- _pointer_xy_get(&x, &y);
- ev->window = e_comp->ee_win;
- ev->event_window = e_comp->ee_win;
- ev->root_window = e_comp->ee_win;
- ev->timestamp = _input_timestamp();
- ev->same_screen = 1;
- ev->direction = direction ? 1 : 0;
- ev->z = steps;
- ev->x = ev->root.x = x;
- ev->y = ev->root.y = y;
-
- ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
+ e_comp_wl_input_inject_pointer_axis(!!direction, steps, _input_timestamp());
}
-/* ecore_input_evas turns an event with a non-zero multi.device into an evas
- * multi event, and E forwards that device number as the wl_touch id. Device
- * 0 is the pointer, which is why the protocol rejects touch id 0. */
+/* The device number of a touch point is the wl_touch id E sends, and 0 is
+ * the pointer's, which is why the protocol rejects touch id 0. */
static Eina_Bool
_wl_test_touch_id_check(struct wl_resource *resource, int32_t id)
{
@@ -614,62 +471,25 @@ _wl_test_touch_id_check(struct wl_resource *resource, int32_t id)
return EINA_FALSE;
}
-static Wl_Test_Touch *
-_wl_test_touch_find(int32_t id)
-{
- Wl_Test_Touch *t;
- Eina_List *l;
-
- EINA_LIST_FOREACH(_touches, l, t)
- {
- if (t->id == id) return t;
- }
- return NULL;
-}
-
static void
_wl_test_cb_touch_down(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t id, int32_t x, int32_t y)
{
- Wl_Test_Touch *t;
-
if (!_wl_test_touch_id_check(resource, id)) return;
- t = _wl_test_touch_find(id);
- if (!t)
- {
- t = calloc(1, sizeof(*t));
- if (!t) return;
- t->id = id;
- _touches = eina_list_append(_touches, t);
- }
- t->x = x;
- t->y = y;
- _input_mouse_post(ECORE_EVENT_MOUSE_BUTTON_DOWN, id, 1, x, y);
+ e_comp_wl_input_inject_touch(id, x, y, E_COMP_WL_TOUCH_DOWN, _input_timestamp());
}
static void
_wl_test_cb_touch_move(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t id, int32_t x, int32_t y)
{
- Wl_Test_Touch *t;
-
if (!_wl_test_touch_id_check(resource, id)) return;
- t = _wl_test_touch_find(id);
- if (!t) return;
- t->x = x;
- t->y = y;
- _input_move_post(id, x, y);
+ e_comp_wl_input_inject_touch(id, x, y, E_COMP_WL_TOUCH_MOVE, _input_timestamp());
}
static void
_wl_test_cb_touch_up(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t id)
{
- Wl_Test_Touch *t;
-
if (!_wl_test_touch_id_check(resource, id)) return;
- t = _wl_test_touch_find(id);
- if (!t) return;
- _touches = eina_list_remove(_touches, t);
- _input_mouse_post(ECORE_EVENT_MOUSE_BUTTON_UP, id, 1, t->x, t->y);
- free(t);
+ e_comp_wl_input_inject_touch(id, 0, 0, E_COMP_WL_TOUCH_UP, _input_timestamp());
}
/* E's own generator, the one behind the keyboard_send action: it maps the
@@ -715,6 +535,12 @@ _wl_test_cb_virtual_output_set(struct wl_client *client EINA_UNUSED, struct wl_r
e_comp_wl_virtual_output_set(id, w, h, scale));
}
+static void
+_wl_test_cb_key_code(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, uint32_t keycode, uint32_t pressed)
+{
+ e_comp_wl_input_inject_key(keycode, !!pressed, _input_timestamp());
+}
+
static const struct wl_test_interface _wl_test_implementation =
{
_wl_test_cb_destroy,
@@ -743,6 +569,7 @@ static const struct wl_test_interface _wl_test_implementation =
_wl_test_cb_output_remove,
_wl_test_cb_get_format_alpha,
_wl_test_cb_virtual_output_set,
+ _wl_test_cb_key_code,
};
static void
@@ -776,7 +603,7 @@ e_modapi_init(E_Module *m)
return NULL;
}
- _wl_test_global = wl_global_create(e_comp_wl->wl.disp, &wl_test_interface, 13,
+ _wl_test_global = wl_global_create(e_comp_wl->wl.disp, &wl_test_interface, 14,
NULL, _wl_test_cb_bind);
if (!_wl_test_global)
{
@@ -792,11 +619,6 @@ e_modapi_init(E_Module *m)
wl_display_add_client_created_listener(e_comp_wl->wl.disp,
&_client_created_listener);
- /* Before E's own handler, which cancels a motion a pointer constraint
- * swallowed: this one must still see it to clear the posted position. */
- E_LIST_HANDLER_APPEND_PRE(_input_handlers, ECORE_EVENT_MOUSE_MOVE,
- _input_cb_mouse_move, NULL);
-
INF("wl_test: test interface active - this build is not for production");
return m;
@@ -807,9 +629,6 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
{
Wl_Test_Client *tc;
- E_FREE_LIST(_input_handlers, ecore_event_handler_del);
- E_FREE_LIST(_touches, free);
-
if (_sync_job)
{
ecore_job_del(_sync_job);
diff --git a/src/protocol/wl-test.xml b/src/protocol/wl-test.xml
index a9f295d3d..40d10c88f 100644
--- a/src/protocol/wl-test.xml
+++ b/src/protocol/wl-test.xml
@@ -23,7 +23,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>
- <interface name="wl_test" version="13">
+ <interface name="wl_test" version="14">
<description summary="private interface for the compositor test suite">
A back door into the compositor for its own test suite. It exposes
internal state and synthesises input, so it is only built with
@@ -411,5 +411,16 @@
<event name="virtual_output_result" since="13">
<arg name="ok" type="uint" summary="1 if E resized the output, 0 if it refused"/>
</event>
+
+ <request name="key_code" since="14">
+ <description summary="inject a key by its evdev key code">
+ Calls e_comp_wl_input_inject_key(). Unlike key and key_modified,
+ which name a key of the us layout, this takes the code a backend
+ reads from a device, and the modifiers follow from the keys
+ injected before.
+ </description>
+ <arg name="keycode" type="uint" summary="KEY_* of linux/input-event-codes.h"/>
+ <arg name="pressed" type="uint" summary="1 for a press, 0 for a release"/>
+ </request>
</interface>
</protocol>
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index 662bb10f1..82540fd65 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -126,6 +126,7 @@ wl_protocol_tests = [
['content-type', 'test_content_type.c'],
['virtual-output', 'test_virtual_output.c'],
['virtual-output-zones', 'test_virtual_output_zones.c'],
+ ['input-inject', 'test_input_inject.c'],
]
tk_src = files('e_wl_testkit.c')
diff --git a/src/tests/wayland/test_input_inject.c b/src/tests/wayland/test_input_inject.c
new file mode 100644
index 000000000..aeaf39b1b
--- /dev/null
+++ b/src/tests/wayland/test_input_inject.c
@@ -0,0 +1,270 @@
+/* e_comp_wl_input_inject_key(): a key code injected as a backend would
+ * deliver it reaches the focused client and E's key bindings. The test
+ * profile binds Super+i to window_maximized_toggle. */
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <linux/input-event-codes.h>
+
+#include "e_wl_testkit.h"
+
+#define PROG "test-input-inject"
+#define APP "e.test.input.inject"
+#define FOCUS WL_TEST_CLIENT_STATE_FOCUSED
+#define MAX (WL_TEST_CLIENT_STATE_MAXIMIZED_H | WL_TEST_CLIENT_STATE_MAXIMIZED_V)
+#define LOG_MAX 64
+
+typedef struct
+{
+ uint32_t key, state;
+ uint32_t depressed;
+} Key_Event;
+
+static Tk *tk;
+static struct wl_test *tester;
+static Key_Event events[LOG_MAX];
+static int event_count;
+static uint32_t depressed;
+
+static void
+_keymap(void *d __attribute__((unused)), struct wl_keyboard *k __attribute__((unused)),
+ uint32_t format __attribute__((unused)), int32_t fd, uint32_t size __attribute__((unused)))
+{
+ close(fd);
+}
+
+static void
+_enter(void *d __attribute__((unused)), struct wl_keyboard *k __attribute__((unused)),
+ uint32_t serial __attribute__((unused)), struct wl_surface *s __attribute__((unused)),
+ struct wl_array *keys __attribute__((unused)))
+{
+}
+
+static void
+_leave(void *d __attribute__((unused)), struct wl_keyboard *k __attribute__((unused)),
+ uint32_t serial __attribute__((unused)), struct wl_surface *s __attribute__((unused)))
+{
+}
+
+static void
+_key(void *d __attribute__((unused)), struct wl_keyboard *k __attribute__((unused)),
+ uint32_t serial __attribute__((unused)), uint32_t time __attribute__((unused)),
+ uint32_t key, uint32_t state)
+{
+ if (event_count == LOG_MAX) tk_fail(tk, "too many key events");
+ events[event_count].key = key;
+ events[event_count].state = state;
+ events[event_count].depressed = depressed;
+ event_count++;
+}
+
+static void
+_modifiers(void *d __attribute__((unused)), struct wl_keyboard *k __attribute__((unused)),
+ uint32_t serial __attribute__((unused)), uint32_t dep,
+ uint32_t lat __attribute__((unused)), uint32_t lock __attribute__((unused)),
+ uint32_t group __attribute__((unused)))
+{
+ depressed = dep;
+}
+
+static const struct wl_keyboard_listener _keyboard_listener =
+{
+ _keymap, _enter, _leave, _key, _modifiers
+};
+
+/* The answer to a sync comes after what was posted has been dispatched. */
+static void
+_flush(void)
+{
+ tk_sync(tk);
+ tk_settle(tk);
+}
+
+/* Requests sent together are all handled before the first key they post is
+ * dispatched: the keys are queued behind one another. */
+static void
+_post(uint32_t keycode, int pressed)
+{
+ wl_test_key_code(tester, keycode, pressed);
+}
+
+static void
+_inject(uint32_t keycode, int pressed)
+{
+ _post(keycode, pressed);
+ _flush();
+}
+
+static void
+_expect_event(int i, uint32_t key, uint32_t state, const char *what)
+{
+ if (i >= event_count) tk_fail(tk, "%s: no event %d", what, i);
+ if ((events[i].key != key) || (events[i].state != state))
+ tk_fail(tk, "%s: event %d is key %u state %u, not key %u state %u", what, i,
+ events[i].key, events[i].state, key, state);
+}
+
+static void
+_test_shifted_key(void)
+{
+ event_count = 0;
+ _inject(KEY_LEFTSHIFT, 1);
+ if (!depressed) tk_fail(tk, "shift down did not change the modifiers");
+ _inject(KEY_A, 1);
+ _inject(KEY_A, 0);
+ _inject(KEY_LEFTSHIFT, 0);
+ if (depressed) tk_fail(tk, "shift up left a modifier depressed");
+
+ if (event_count != 4) tk_fail(tk, "%d key events, not 4", event_count);
+ _expect_event(0, KEY_LEFTSHIFT, WL_KEYBOARD_KEY_STATE_PRESSED, "shifted key");
+ _expect_event(1, KEY_A, WL_KEYBOARD_KEY_STATE_PRESSED, "shifted key");
+ _expect_event(2, KEY_A, WL_KEYBOARD_KEY_STATE_RELEASED, "shifted key");
+ _expect_event(3, KEY_LEFTSHIFT, WL_KEYBOARD_KEY_STATE_RELEASED, "shifted key");
+ if (!events[1].depressed) tk_fail(tk, "the client got key a with no shift held");
+ if (events[1].depressed != events[2].depressed)
+ tk_fail(tk, "the modifiers changed between a down and a up");
+}
+
+static void
+_expect_no_key(uint32_t key, const char *what)
+{
+ int i;
+
+ for (i = 0; i < event_count; i++)
+ {
+ if (events[i].key == key) tk_fail(tk, "%s: the client got key %u", what, key);
+ }
+}
+
+/* Super+i, the keys of the binding injected one after the other, sent
+ * with a sync between each or all together. The modifier is not consumed,
+ * the key it binds is. */
+static void
+_toggle_maximized(int together, int maximized, const char *what)
+{
+ event_count = 0;
+ _post(KEY_LEFTMETA, 1);
+ if (!together) _flush();
+ _post(KEY_I, 1);
+ if (!together) _flush();
+ _post(KEY_I, 0);
+ if (!together) _flush();
+ _post(KEY_LEFTMETA, 0);
+ _flush();
+ tk_wait_states(tk, APP, MAX, maximized ? MAX : 0, what);
+ _expect_no_key(KEY_I, what);
+}
+
+static void
+_test_binding(void)
+{
+ _toggle_maximized(0, 1, "an injected binding ran");
+ _toggle_maximized(0, 0, "an injected binding ran again");
+}
+
+/* The modifiers of a key are the keys injected before it, even when they
+ * have not been dispatched yet: E's own state does not have them. */
+static void
+_test_queued_keys(void)
+{
+ event_count = 0;
+ _post(KEY_LEFTSHIFT, 1);
+ _post(KEY_A, 1);
+ _post(KEY_A, 0);
+ _post(KEY_LEFTSHIFT, 0);
+ _flush();
+ if (event_count != 4) tk_fail(tk, "%d key events, not 4", event_count);
+ if (!events[1].depressed) tk_fail(tk, "queued keys: key a without shift held");
+ if (events[1].depressed != events[2].depressed)
+ tk_fail(tk, "queued keys: the modifiers changed between a down and a up");
+ if (depressed) tk_fail(tk, "queued keys: shift is still held");
+
+ _toggle_maximized(1, 1, "queued keys of a binding");
+ _toggle_maximized(1, 0, "queued keys of a binding, again");
+}
+
+/* A remote peer repeats the press of a key it holds. That is not a second
+ * press: the release that follows must leave no modifier behind, or the
+ * bindings would see a Shift nobody holds. */
+static void
+_test_repeated_press(void)
+{
+ event_count = 0;
+ _inject(KEY_LEFTSHIFT, 1);
+ _inject(KEY_LEFTSHIFT, 1);
+ _inject(KEY_LEFTSHIFT, 0);
+ _inject(KEY_LEFTSHIFT, 0);
+ if (event_count != 2) tk_fail(tk, "%d events for a repeated press, not 2", event_count);
+ _expect_event(0, KEY_LEFTSHIFT, WL_KEYBOARD_KEY_STATE_PRESSED, "repeated press");
+ _expect_event(1, KEY_LEFTSHIFT, WL_KEYBOARD_KEY_STATE_RELEASED, "repeated press");
+ if (depressed) tk_fail(tk, "a repeated press left a modifier depressed");
+
+ _toggle_maximized(0, 1, "a binding after a repeated press");
+ _toggle_maximized(0, 0, "a binding after a repeated press, again");
+}
+
+/* The locks come from other devices as well: Caps Lock turned on by a key of
+ * the name-based generator must not keep the binding from running. */
+static void
+_test_lock_from_another_path(void)
+{
+ wl_test_key(tester, "Caps_Lock", 1);
+ wl_test_key(tester, "Caps_Lock", 0);
+ _flush();
+ _toggle_maximized(0, 1, "a binding with caps lock on");
+ _toggle_maximized(0, 0, "a binding with caps lock on, again");
+ wl_test_key(tester, "Caps_Lock", 1);
+ wl_test_key(tester, "Caps_Lock", 0);
+ _flush();
+}
+
+/* A key the keymap does not have is dropped: it reaches neither the
+ * bindings nor the client, and the keyboard keeps working. */
+static void
+_test_unknown_keycode(void)
+{
+ static const uint32_t unknown[] = { 1000, 0xffffffff };
+ unsigned int i;
+
+ event_count = 0;
+ for (i = 0; i < sizeof(unknown) / sizeof(unknown[0]); i++)
+ {
+ _inject(unknown[i], 1);
+ _inject(unknown[i], 0);
+ }
+ if (event_count) tk_fail(tk, "the client got a key that is not in the keymap");
+ if (depressed) tk_fail(tk, "a key that is not in the keymap set a modifier");
+
+ _inject(KEY_B, 1);
+ _inject(KEY_B, 0);
+ if (event_count != 2) tk_fail(tk, "the keyboard did not survive an unknown key");
+ _expect_event(0, KEY_B, WL_KEYBOARD_KEY_STATE_PRESSED, "after unknown keys");
+ _expect_event(1, KEY_B, WL_KEYBOARD_KEY_STATE_RELEASED, "after unknown keys");
+}
+
+int
+main(void)
+{
+ struct wl_seat *seat;
+ Tk_Toplevel *top;
+
+ tk = tk_connect(PROG);
+ seat = tk_bind(tk, &wl_seat_interface, 1);
+ tester = tk_bind(tk, &wl_test_interface, 14);
+ if ((!seat) || (!tester)) tk_fail(tk, "missing global, wl_test needs version 14");
+ wl_keyboard_add_listener(wl_seat_get_keyboard(seat), &_keyboard_listener, NULL);
+ top = tk_toplevel_new(tk, APP, APP, 200, 150);
+ tk_wait_states(tk, APP, FOCUS, FOCUS, "a new window has the focus");
+
+ _test_shifted_key();
+ _test_binding();
+ _test_queued_keys();
+ _test_repeated_press();
+ _test_lock_from_another_path();
+ _test_unknown_keycode();
+
+ tk_toplevel_del(top);
+ tk_disconnect(tk);
+ printf(PROG ": ok\n");
+ return 0;
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.