[PATCH weston] shell: Add a lock binding

Kristian Høgsberg hoegsberg at gmail.com
Mon May 13 14:29:30 PDT 2013


On Sun, May 12, 2013 at 10:58:04AM +0200, Quentin Glidic wrote:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>

It's a good idea, but there are a couple of issues with the patch.

> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
>  src/shell.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/shell.c b/src/shell.c
> index 5da649d..135eaa5 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -2705,6 +2705,15 @@ zoom_axis_binding(struct weston_seat *seat, uint32_t time, uint32_t axis,
>  }
>  
>  static void
> +lock_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
> +		 void *data)
> +{
> +	struct desktop_shell *shell = data;
> +
> +	shell_fade(shell, FADE_OUT);

We need to put the compositor into the idle state at this point.  The
wake signal only fires on input activity when the compositor is idle.
If you just fade out without setting idle, the compositor won't fire
the wakeup signal until after the idle timeout, and you wont be able
to get out of the black screen until then.

We should add a weston_compositor_idle() to go with the other state
transition functions (weston_compositor_wake/offscreen/sleep), which
just sets state to IDLE and cancels the timer.

The problem then is that the key release of the binding will now count
as activity and undo the lock.  I think we'll need a custom grab (see
weston_compositor_run_key_binding()) that triggers the lock on release
of the last key in the binding.  Or maybe add a "virtual modifier",
say MODIFIER_RELEASE, to make the binding code trigger the binding on
release instead.

Kristian

> +}
> +
> +static void
>  zoom_key_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
>  		 void *data)
>  {
> @@ -4235,6 +4244,8 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
>  
>  	/* configurable bindings */
>  	mod = shell->binding_modifier;
> +	weston_compositor_add_key_binding(ec, KEY_L, mod,
> +					  lock_binding, shell);
>  	weston_compositor_add_key_binding(ec, KEY_PAGEUP, mod,
>  					  zoom_key_binding, NULL);
>  	weston_compositor_add_key_binding(ec, KEY_PAGEDOWN, mod,
> -- 
> 1.8.2.1
> 
> _______________________________________________
> 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