From c7cd626bcfdc61385ffb7ccb065c5c815641a3b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 28 Jun 2012 13:46:09 -0400 Subject: [PATCH] compositor: Update xkb state with key releases on focus out This happens when vt-switching away from the compositor (drm) or giving keyboard focus to a different X window. Release the modifiers so we don't get stuck modifiers. We'll update with the new keys down when we come back. --- src/compositor.c | 15 +++++++++------ src/shell.c | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index b4e430b..8cf66bb 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1936,15 +1936,14 @@ notify_keyboard_focus_in(struct wl_seat *seat, struct wl_array *keys, struct weston_seat *ws = (struct weston_seat *) seat; struct weston_compositor *compositor = ws->compositor; struct wl_surface *surface; - uint32_t *k; + uint32_t *k, serial; + serial = wl_display_next_serial(compositor->wl_display); wl_array_copy(&seat->keyboard->keys, keys); wl_array_for_each(k, &seat->keyboard->keys) { weston_compositor_idle_inhibit(compositor); if (update_state == STATE_UPDATE_AUTOMATIC) - update_modifier_state(ws, - wl_display_next_serial(compositor->wl_display), - *k, + update_modifier_state(ws, serial, *k, WL_KEYBOARD_KEY_STATE_PRESSED); } @@ -1969,10 +1968,14 @@ notify_keyboard_focus_out(struct wl_seat *seat) struct weston_seat *ws = (struct weston_seat *) seat; struct weston_compositor *compositor = ws->compositor; struct wl_surface *surface; - uint32_t *k; + uint32_t *k, serial; - wl_array_for_each(k, &seat->keyboard->keys) + serial = wl_display_next_serial(compositor->wl_display); + wl_array_for_each(k, &seat->keyboard->keys) { weston_compositor_idle_release(compositor); + update_modifier_state(ws, serial, *k, + WL_KEYBOARD_KEY_STATE_RELEASED); + } ws->modifier_state = 0; diff --git a/src/shell.c b/src/shell.c index 5d79e2e..2e1e22a 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1852,7 +1852,7 @@ configure_static_surface(struct weston_surface *es, struct weston_layer *layer) if (wl_list_empty(&es->layer_link)) { wl_list_insert(&layer->surface_list, &es->layer_link); - weston_surface_assign_output(es); + weston_compositor_schedule_repaint(es->compositor); } } -- 2.7.4