notify_key: Add update_state argument
If update_state is true, then notify_key will continue to call xkb_key_update_state to update the local state mask, as before this commit. Otherwise, it will rely on the compositor to manually update the state itself, for nested compositors. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
3ee91e1879
commit
1b4e11f38e
@ -666,7 +666,8 @@ input_handle_key(void *data, struct wl_keyboard *keyboard,
|
|||||||
|
|
||||||
notify_key(&c->base.seat->seat, time, key,
|
notify_key(&c->base.seat->seat, time, key,
|
||||||
state ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
state ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
STATE_UPDATE_AUTOMATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -710,7 +710,8 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
|||||||
notify_key(&c->base.seat->seat,
|
notify_key(&c->base.seat->seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_release->detail - 8,
|
key_release->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
STATE_UPDATE_AUTOMATIC);
|
||||||
free(prev);
|
free(prev);
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
break;
|
break;
|
||||||
@ -753,7 +754,8 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
|||||||
notify_key(&c->base.seat->seat,
|
notify_key(&c->base.seat->seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_press->detail - 8,
|
key_press->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_PRESSED);
|
WL_KEYBOARD_KEY_STATE_PRESSED,
|
||||||
|
STATE_UPDATE_AUTOMATIC);
|
||||||
break;
|
break;
|
||||||
case XCB_KEY_RELEASE:
|
case XCB_KEY_RELEASE:
|
||||||
/* If we don't have XKB, we need to use the lame
|
/* If we don't have XKB, we need to use the lame
|
||||||
@ -766,7 +768,8 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
|||||||
notify_key(&c->base.seat->seat,
|
notify_key(&c->base.seat->seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_release->detail - 8,
|
key_release->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
STATE_UPDATE_AUTOMATIC);
|
||||||
break;
|
break;
|
||||||
case XCB_BUTTON_PRESS:
|
case XCB_BUTTON_PRESS:
|
||||||
x11_compositor_deliver_button_event(c, event, 1);
|
x11_compositor_deliver_button_event(c, event, 1);
|
||||||
@ -848,7 +851,8 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
|||||||
notify_key(&c->base.seat->seat,
|
notify_key(&c->base.seat->seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_release->detail - 8,
|
key_release->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
STATE_UPDATE_AUTOMATIC);
|
||||||
free(prev);
|
free(prev);
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -1833,7 +1833,8 @@ update_modifier_state(struct weston_seat *seat, uint32_t key,
|
|||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||||
enum wl_keyboard_key_state state)
|
enum wl_keyboard_key_state state,
|
||||||
|
enum weston_key_state_update update_state)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_seat *ws = (struct weston_seat *) seat;
|
||||||
struct weston_compositor *compositor = ws->compositor;
|
struct weston_compositor *compositor = ws->compositor;
|
||||||
@ -1842,7 +1843,7 @@ notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
|||||||
struct wl_keyboard_grab *grab = seat->keyboard->grab;
|
struct wl_keyboard_grab *grab = seat->keyboard->grab;
|
||||||
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
||||||
uint32_t *k, *end;
|
uint32_t *k, *end;
|
||||||
int mods;
|
int mods = 0;
|
||||||
|
|
||||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
if (compositor->ping_handler && focus)
|
if (compositor->ping_handler && focus)
|
||||||
@ -1855,6 +1856,7 @@ notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
|||||||
weston_compositor_idle_release(compositor);
|
weston_compositor_idle_release(compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (update_state == STATE_UPDATE_AUTOMATIC)
|
||||||
mods = update_modifier_state(ws, key, state);
|
mods = update_modifier_state(ws, key, state);
|
||||||
end = seat->keyboard->keys.data + seat->keyboard->keys.size;
|
end = seat->keyboard->keys.data + seat->keyboard->keys.size;
|
||||||
for (k = seat->keyboard->keys.data; k < end; k++) {
|
for (k = seat->keyboard->keys.data; k < end; k++) {
|
||||||
|
@ -509,7 +509,8 @@ notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis,
|
|||||||
wl_fixed_t value);
|
wl_fixed_t value);
|
||||||
void
|
void
|
||||||
notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||||
enum wl_keyboard_key_state state);
|
enum wl_keyboard_key_state state,
|
||||||
|
enum weston_key_state_update update_state);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_pointer_focus(struct wl_seat *seat, struct weston_output *output,
|
notify_pointer_focus(struct wl_seat *seat, struct weston_output *output,
|
||||||
|
@ -88,7 +88,8 @@ evdev_process_key(struct evdev_input_device *device,
|
|||||||
notify_key(&device->master->base.seat,
|
notify_key(&device->master->base.seat,
|
||||||
time, e->code,
|
time, e->code,
|
||||||
e->value ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
e->value ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
STATE_UPDATE_AUTOMATIC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user