On 15/03/16 08:14 AM, Jonas Ådahl wrote:
> Activate a view even though it effectively may already be active.
> Without this, in later patches, it won't be possibe to track what view
> was activated by clicking last, as a view which surface already had
> keyboard focus, won't be activated.
> 
> To keep avoiding sending xdg_surface.configure events, only change the
> keyboard focus if the focus actually changed.
> 
> Signed-off-by: Jonas Ådahl <jad...@gmail.com>
> ---
> 
> The patch that introduced the early-out if the surface already had keyboard
> focus broke activated-view tracking later used by pointer constraints. I 
> partly
> reverted that but added a guard for changing the keyboard focus to the same
> focus, which was the reason xdg_surface.configure was sent twice per click.
> 
> We still do various other unnecessary things on the redundant activation, but
> I left that for the future.
> 
> 
>  desktop-shell/shell.c | 7 -------
>  src/input.c           | 2 +-
>  2 files changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index e1fefae..56bb62e 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -5169,13 +5169,6 @@ activate_binding(struct weston_seat *seat,
>       if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
>               return;
>  
> -     state = ensure_focus_state(shell, seat);

state is no longer used and generates a warning at build time?

> -     if (state == NULL)
> -             return;
> -
> -     if (state->keyboard_focus == focus)
> -             return;
> -
>       activate(shell, focus, seat, true);
>  }
>  
> diff --git a/src/input.c b/src/input.c
> index 8c106dd..cc7e088 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -1299,7 +1299,7 @@ weston_surface_activate(struct weston_surface *surface,
>       struct weston_compositor *compositor = seat->compositor;
>       struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
>  
> -     if (keyboard) {
> +     if (keyboard && keyboard->focus != surface) {

This avoids re-introducing the problem the original patch solved, so I'm
happy. :)

With the warning squashed,
Reviewed-by: Derek Foreman <der...@osg.samsung.com>

and I suppose
Tested-by: Derek Foreman <der...@osg.samsung.com>

if that matters.

>               weston_keyboard_set_focus(keyboard, surface);
>               wl_data_device_set_keyboard_focus(seat);
>       }
> 

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to