diff options
author | Pekka Paalanen <pq@iki.fi> | 2014-08-06 19:36:51 +0300 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-12-08 14:20:20 +0200 |
commit | 8274d901f119b9c7df107fe511114b1b317da59f (patch) | |
tree | cd3630e54b13c4e4a27d7030107fbc5b49e0729f /src/data-device.c | |
parent | 0038b738abf6e61b1aacaf1a9026886acd0171f6 (diff) | |
download | weston-8274d901f119b9c7df107fe511114b1b317da59f.tar.gz |
compositor: add weston_surface_set_label_func()
When printing out logs from Weston's actions, mainly for debugging, it
can be very difficult to identify the different surfaces. Inspecting
the configure function pointer is not useful, as the configure functions
may live in modules.
Add vfunc get_label to weston_surface, which will produce a short,
human-readable description of the surface, which allows identifying it
better, rather than just looking at the surface size, for instance.
Set the label function from most parts of Weston, to identify cursors and
drag icons, and panels, backgrounds, screensavers and lock surfaces, and
the desktop shell's application surfaces.
v2: renamed 'description' to 'label', so we get
weston_surface_set_label_func().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'src/data-device.c')
-rw-r--r-- | src/data-device.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/data-device.c b/src/data-device.c index d28325dc..a0913a24 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -214,6 +214,13 @@ drag_surface_configure(struct weston_drag *drag, weston_view_set_position(drag->icon, fx, fy); } +static int +pointer_drag_surface_get_label(struct weston_surface *surface, + char *buf, size_t len) +{ + return snprintf(buf, len, "pointer drag icon"); +} + static void pointer_drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy) @@ -226,6 +233,13 @@ pointer_drag_surface_configure(struct weston_surface *es, drag_surface_configure(&drag->base, pointer, NULL, es, sx, sy); } +static int +touch_drag_surface_get_label(struct weston_surface *surface, + char *buf, size_t len) +{ + return snprintf(buf, len, "touch drag icon"); +} + static void touch_drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy) { @@ -351,6 +365,7 @@ data_device_end_drag_grab(struct weston_drag *drag, weston_view_unmap(drag->icon); drag->icon->surface->configure = NULL; + weston_surface_set_label_func(drag->icon->surface, NULL); pixman_region32_clear(&drag->icon->surface->pending.input); wl_list_remove(&drag->icon_destroy_listener.link); weston_view_destroy(drag->icon); @@ -560,6 +575,8 @@ weston_pointer_start_drag(struct weston_pointer *pointer, icon->configure = pointer_drag_surface_configure; icon->configure_private = drag; + weston_surface_set_label_func(icon, + pointer_drag_surface_get_label); } else { drag->base.icon = NULL; } @@ -615,6 +632,8 @@ weston_touch_start_drag(struct weston_touch *touch, icon->configure = touch_drag_surface_configure; icon->configure_private = drag; + weston_surface_set_label_func(icon, + touch_drag_surface_get_label); } else { drag->base.icon = NULL; } |