summaryrefslogtreecommitdiff
path: root/geyes/src/geyes.c
diff options
context:
space:
mode:
Diffstat (limited to 'geyes/src/geyes.c')
-rw-r--r--geyes/src/geyes.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/geyes/src/geyes.c b/geyes/src/geyes.c
index 5fdecf38..76c86d65 100644
--- a/geyes/src/geyes.c
+++ b/geyes/src/geyes.c
@@ -132,23 +132,41 @@ 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);
- for (i = 0; i < eyes_applet->num_eyes; i++) {
- if (gtk_widget_get_realized (eyes_applet->eyes[i])) {
+ for (i = 0; i < eyes_applet->num_eyes; i++)
+ {
+ if (gtk_widget_get_realized (eyes_applet->eyes[i]))
+ {
gdk_window_get_device_position (gtk_widget_get_window (eyes_applet->eyes[i]),
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
+ 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
gtk_widget_translate_coordinates (eyes_applet->eyes[i],
gtk_widget_get_toplevel(eyes_applet->eyes[i]),
0, 0, &dx, &dy);
x -= dx;
y -= dy;
+#endif
if ((x != eyes_applet->pointer_last_x[i]) ||
(y != eyes_applet->pointer_last_y[i])) {
@@ -258,8 +276,6 @@ setup_eyes (EyesApplet *eyes_applet)
gtk_widget_set_valign (eyes_applet->eyes[i], GTK_ALIGN_CENTER);
}
- gtk_widget_realize (eyes_applet->eyes[i]);
-
eyes_applet->pointer_last_x[i] = G_MAXINT;
eyes_applet->pointer_last_y[i] = G_MAXINT;
@@ -398,7 +414,9 @@ geyes_applet_fill (MatePanelApplet *applet)
GtkActionGroup *action_group;
gboolean result;
+#ifndef ENABLE_IN_PROCESS
g_set_application_name (_("Eyes"));
+#endif
gtk_window_set_default_icon_name ("mate-eyes-applet");
mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
@@ -466,8 +484,8 @@ geyes_applet_factory (MatePanelApplet *applet,
return retval;
}
-MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("GeyesAppletFactory",
- PANEL_TYPE_APPLET,
- "geyes",
- geyes_applet_factory,
- NULL)
+PANEL_APPLET_FACTORY ("GeyesAppletFactory",
+ PANEL_TYPE_APPLET,
+ "geyes",
+ geyes_applet_factory,
+ NULL)