summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffredo Baroncelli <[email protected]>2022-01-03 15:45:22 +0100
committerraveit65 <[email protected]>2022-01-29 17:20:09 +0100
commitc0d0f06e1021fd16b6f8a3e8315968cca1a76d28 (patch)
tree95115560226808a549399c8de0f2378211e1a27b
parent478b4c6316063c47a62b23ee434ea30efa907a17 (diff)
downloadmate-applets-c0d0f06e1021fd16b6f8a3e8315968cca1a76d28.tar.bz2
mate-applets-c0d0f06e1021fd16b6f8a3e8315968cca1a76d28.tar.xz
geyes: consider the offset widget <-> window
To compute the correct pupil position, we should consider the offset between the eye widget and their parent window. Signed-off-by: Goffredo Baroncelli <[email protected]>
-rw-r--r--geyes/src/geyes.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/geyes/src/geyes.c b/geyes/src/geyes.c
index 7fca8539..5fdecf38 100644
--- a/geyes/src/geyes.c
+++ b/geyes/src/geyes.c
@@ -132,7 +132,7 @@ timer_cb (EyesApplet *eyes_applet)
{
GdkDisplay *display;
GdkSeat *seat;
- gint x, y;
+ gint x, y, dx, dy;
gint pupil_x, pupil_y;
gsize i;
@@ -144,6 +144,11 @@ timer_cb (EyesApplet *eyes_applet)
gdk_window_get_device_position (gtk_widget_get_window (eyes_applet->eyes[i]),
gdk_seat_get_pointer (seat),
&x, &y, NULL);
+ gtk_widget_translate_coordinates (eyes_applet->eyes[i],
+ gtk_widget_get_toplevel(eyes_applet->eyes[i]),
+ 0, 0, &dx, &dy);
+ x -= dx;
+ y -= dy;
if ((x != eyes_applet->pointer_last_x[i]) ||
(y != eyes_applet->pointer_last_y[i])) {