[PATCH 2/2] exposay: properly go away when the modifier is pressed
Kristian Høgsberg
hoegsberg at gmail.com
Wed Nov 27 14:20:33 PST 2013
On Wed, Nov 27, 2013 at 10:34:33AM +0100, pochu27 at gmail.com wrote:
> From: Emilio Pozuelo Monfort <emilio.pozuelo at collabora.co.uk>
>
> We no longer receive an exposay_binding() call while exposay
> is in-flight as we have grabbed the keyboard, so we need to
> listen on the modifiers callback for the modifier press and
> release.
That's a much better way to handle it anyway.
> ---
> src/shell.c | 31 +++++++++++++++++++++++++++----
> 1 file changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/src/shell.c b/src/shell.c
> index 6ba1f10..2e0e44d 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -220,6 +220,9 @@ struct desktop_shell {
>
> int row_current;
> int column_current;
> +
> + bool mod_pressed;
> + bool mod_invalid;
> } exposay;
>
> uint32_t binding_modifier;
> @@ -5367,6 +5370,29 @@ exposay_modifier(struct weston_keyboard_grab *grab, uint32_t serial,
> uint32_t mods_depressed, uint32_t mods_latched,
> uint32_t mods_locked, uint32_t group)
> {
> + struct desktop_shell *shell =
> + container_of(grab, struct desktop_shell, exposay.grab_kbd);
> + struct weston_seat *seat = (struct weston_seat *) grab->keyboard->seat;
> +
> + /* We want to know when mod has been pressed and released.
> + * FIXME: There is a problem here: if mod is pressed, then a key
> + * is pressed and released, then mod is released, we will treat that
> + * as if only mod had been pressed and released. */
This sounds like we just swallow regular key presses while mod is
pressed? That doesn't sounds like a problem to me.
Both patches applied.
Kristian
> + if (seat->modifier_state) {
> + if (seat->modifier_state == shell->binding_modifier)
> + shell->exposay.mod_pressed = true;
> + } else {
> + shell->exposay.mod_invalid = true;
> + }
> + } else {
> + if (shell->exposay.mod_pressed && !shell->exposay.mod_invalid)
> + exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, seat);
> +
> + shell->exposay.mod_invalid = false;
> + shell->exposay.mod_pressed = false;
> + }
> +
> + return;
> }
>
> static void
> @@ -5512,10 +5538,7 @@ exposay_binding(struct weston_seat *seat, enum weston_keyboard_modifier modifier
> {
> struct desktop_shell *shell = data;
>
> - if (shell->exposay.state_target == EXPOSAY_TARGET_OVERVIEW)
> - exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, seat);
> - else
> - exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat);
> + exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat);
> }
>
> static void
> --
> 1.8.4.rc3
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list