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.
dev
Kristian Høgsberg 13 years ago
parent 061c425331
commit c7cd626bcf
  1. 15
      src/compositor.c
  2. 2
      src/shell.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_seat *ws = (struct weston_seat *) seat;
struct weston_compositor *compositor = ws->compositor; struct weston_compositor *compositor = ws->compositor;
struct wl_surface *surface; 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_copy(&seat->keyboard->keys, keys);
wl_array_for_each(k, &seat->keyboard->keys) { wl_array_for_each(k, &seat->keyboard->keys) {
weston_compositor_idle_inhibit(compositor); weston_compositor_idle_inhibit(compositor);
if (update_state == STATE_UPDATE_AUTOMATIC) if (update_state == STATE_UPDATE_AUTOMATIC)
update_modifier_state(ws, update_modifier_state(ws, serial, *k,
wl_display_next_serial(compositor->wl_display),
*k,
WL_KEYBOARD_KEY_STATE_PRESSED); 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_seat *ws = (struct weston_seat *) seat;
struct weston_compositor *compositor = ws->compositor; struct weston_compositor *compositor = ws->compositor;
struct wl_surface *surface; 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); weston_compositor_idle_release(compositor);
update_modifier_state(ws, serial, *k,
WL_KEYBOARD_KEY_STATE_RELEASED);
}
ws->modifier_state = 0; ws->modifier_state = 0;

@ -1852,7 +1852,7 @@ configure_static_surface(struct weston_surface *es, struct weston_layer *layer)
if (wl_list_empty(&es->layer_link)) { if (wl_list_empty(&es->layer_link)) {
wl_list_insert(&layer->surface_list, &es->layer_link); wl_list_insert(&layer->surface_list, &es->layer_link);
weston_surface_assign_output(es); weston_compositor_schedule_repaint(es->compositor);
} }
} }

Loading…
Cancel
Save