summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffredo Baroncelli <[email protected]>2022-01-03 15:45:22 +0100
committerraveit65 <[email protected]>2022-01-29 17:22:29 +0100
commit2354716a4224982e51c580b172580814fbd362f7 (patch)
treec343328e871d50ac05e71e7fa1e087968d979d5f
parent98b8cd14a802dc1a728c0880eaf83905a783db5b (diff)
downloadmate-applets-2354716a4224982e51c580b172580814fbd362f7.tar.bz2
mate-applets-2354716a4224982e51c580b172580814fbd362f7.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])) {