summaryrefslogtreecommitdiff
path: root/geyes/src/geyes.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2025-01-22 14:30:26 -0500
committerlukefromdc <[email protected]>2025-01-23 02:22:24 -0500
commitb2311542e2562d8b08c24a1820f9f54074ec23f0 (patch)
tree09d5c21935d8971d7802e02f5a725687a5646bdf /geyes/src/geyes.c
parentb489d1eace12d805eae609ab97ffe68d5a145a68 (diff)
downloadmate-applets-b2311542e2562d8b08c24a1820f9f54074ec23f0.tar.bz2
mate-applets-b2311542e2562d8b08c24a1820f9f54074ec23f0.tar.xz
Geyes in-process: follow the mouse properly no matter where the applet isgeyes-in-process
Diffstat (limited to 'geyes/src/geyes.c')
-rw-r--r--geyes/src/geyes.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/geyes/src/geyes.c b/geyes/src/geyes.c
index a8337447..76c86d65 100644
--- a/geyes/src/geyes.c
+++ b/geyes/src/geyes.c
@@ -132,10 +132,15 @@ timer_cb (EyesApplet *eyes_applet)
{
GdkDisplay *display;
GdkSeat *seat;
- gint x, y, dx, dy;
+ gint x, y;
gint pupil_x, pupil_y;
gsize i;
+#ifdef ENABLE_IN_PROCESS
+ GtkAllocation allocation;
+#else
int applet_x,applet_y;
+ gint dx, dy;
+#endif
display = gtk_widget_get_display (GTK_WIDGET (eyes_applet->applet));
seat = gdk_display_get_default_seat (display);
@@ -148,18 +153,20 @@ timer_cb (EyesApplet *eyes_applet)
gdk_seat_get_pointer (seat),
&x, &y, NULL);
+ /*correct for the positon of each eye, this is done differently in-process or out*/
#ifdef ENABLE_IN_PROCESS
- gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET(eyes_applet->applet)),
- &applet_x, &applet_y);
+ gtk_widget_get_allocation(GTK_WIDGET(eyes_applet->eyes[i]), &allocation);
+ x -= i * allocation.width;
+ /*eyes are always drawn in a horizontal row
+ *so we don't need to correct anything in the value of y
+ */
#else
- applet_x = 0;
- applet_y = 0;
-#endif
gtk_widget_translate_coordinates (eyes_applet->eyes[i],
gtk_widget_get_toplevel(eyes_applet->eyes[i]),
- -applet_x, -applet_y, &dx, &dy);
+ 0, 0, &dx, &dy);
x -= dx;
y -= dy;
+#endif
if ((x != eyes_applet->pointer_last_x[i]) ||
(y != eyes_applet->pointer_last_y[i])) {