[PATCH weston 1/5] input: add a motion signal to weston_pointer

Giulio Camuffo giuliocamuffo at gmail.com
Thu Nov 14 14:42:50 PST 2013


The signal will be emitted after the pointer is moved. A shell plugin
can listen to the signal and activate certain effects when the pointer
touches the screen corners, for instance.
---
 src/compositor.h | 1 +
 src/input.c      | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/compositor.h b/src/compositor.h
index c2de99f..624d475 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -307,6 +307,7 @@ struct weston_pointer {
 	struct weston_view *focus;
 	uint32_t focus_serial;
 	struct wl_signal focus_signal;
+	struct wl_signal motion_signal;
 
 	struct weston_view *sprite;
 	struct wl_listener sprite_destroy_listener;
diff --git a/src/input.c b/src/input.c
index 153bcb6..e6b070d 100644
--- a/src/input.c
+++ b/src/input.c
@@ -392,6 +392,7 @@ weston_pointer_create(void)
 	pointer->default_grab.pointer = pointer;
 	pointer->grab = &pointer->default_grab;
 	wl_signal_init(&pointer->focus_signal);
+	wl_signal_init(&pointer->motion_signal);
 
 	pointer->sprite_destroy_listener.notify = pointer_handle_sprite_destroy;
 
@@ -736,6 +737,8 @@ move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
 					 iy - pointer->hotspot_y);
 		weston_view_schedule_repaint(pointer->sprite);
 	}
+
+	wl_signal_emit(&pointer->motion_signal, pointer);
 }
 
 WL_EXPORT void
-- 
1.8.4.2



More information about the wayland-devel mailing list