[PATCH weston 2/2] compositor-drm: Add key binding for hidding overlays

Kristian Høgsberg hoegsberg at gmail.com
Wed Oct 31 10:32:19 PDT 2012


On Wed, Oct 31, 2012 at 05:55:46PM +0200, Ander Conselvan de Oliveira wrote:
> Pressing ctrl-alt-o will cause the overlays to be hidden, but surfaces
> will still be assigned to different planes. This helps with debugging
> of repaint culling below surfaces in other planes.
> ---
> 
> This was useful for testing the previous patch. I could not figure out
> a way for not having a hardcoded shortcut, since the configurable
> modifier is setup in desktop-shell.

Yeah, makes sense, I committed it.  I've been thinking about a generic
way to install debug shortcuts, something like shift-mod-space as a
prefix and then a letter to trigger various debug modes.  Right now we
have the repaint debug on mod-alt-space, but that could move to

  shift-mod-space r

and then we could install this one as shift-mod-space o, for example.
The shell installs the binding to listen for shift-mod-space and then
waits for another key press, then looks up a debug binding for that.
That also provides on point for disable all debug bindings.

Kristian

>  src/compositor-drm.c |   19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 1133281..fac0f56 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -97,6 +97,7 @@ struct drm_compositor {
>  
>  	struct wl_list sprite_list;
>  	int sprites_are_broken;
> +	int sprites_hidden;
>  
>  	int cursors_are_broken;
>  
> @@ -396,7 +397,10 @@ drm_output_repaint(struct weston_output *output_base,
>  			continue;
>  
>  		ret = drmModeSetPlane(compositor->drm.fd, s->plane_id,
> -				      output->crtc_id, s->pending_fb_id, flags,
> +				      output->crtc_id,
> +				      compositor->sprites_hidden ?
> +				      0 : s->pending_fb_id,
> +				      flags,
>  				      s->dest_x, s->dest_y,
>  				      s->dest_w, s->dest_h,
>  				      s->src_x, s->src_y,
> @@ -2220,6 +2224,15 @@ find_primary_gpu(struct drm_compositor *ec, const char *seat)
>  	return drm_device;
>  }
>  
> +static void
> +hide_sprites_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
> +		     void *data)
> +{
> +	struct drm_compositor *c = data;
> +
> +	c->sprites_hidden ^= 1;
> +}
> +
>  static struct weston_compositor *
>  drm_compositor_create(struct wl_display *display,
>  		      int connector, const char *seat, int tty,
> @@ -2321,6 +2334,10 @@ drm_compositor_create(struct wl_display *display,
>  
>  	udev_device_unref(drm_device);
>  
> +	weston_compositor_add_key_binding(&ec->base, KEY_O,
> +					  MODIFIER_CTRL | MODIFIER_ALT,
> +					  hide_sprites_binding, ec);
> +
>  	return &ec->base;
>  
>  err_udev_monitor:
> -- 
> 1.7.10.4
> 
> _______________________________________________
> 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