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.
This commit is contained in:
Kristian Høgsberg 2012-06-28 13:46:09 -04:00
parent 061c425331
commit c7cd626bcf
2 changed files with 10 additions and 7 deletions

View File

@ -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;

View File

@ -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);
}
}