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

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Wed Oct 31 08:55:46 PDT 2012


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.


 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



More information about the wayland-devel mailing list