Updating branch refs/heads/master to c5f5e0484d8fbcb68ed28732dc240935be336782 (commit) from 64c5b6460a7efddf2a1829be72430b9dddca1456 (commit)
commit c5f5e0484d8fbcb68ed28732dc240935be336782 Author: Harald Judt <h.j...@gmx.at> Date: Wed Feb 27 13:53:16 2013 +0100 Make eye movement independent, like in xeyes (bug #9036). Clean up formatting of this function and make the eye movement independent. The actual change is subtracting GTK_WIDGET(widget)->allocation.x from nx and GTK_WIDGET(widget)->allocation.y from ny. panel-plugin/eyes.c | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 deletions(-) diff --git a/panel-plugin/eyes.c b/panel-plugin/eyes.c index a6be752..11a286a 100644 --- a/panel-plugin/eyes.c +++ b/panel-plugin/eyes.c @@ -56,8 +56,11 @@ static void eyes_write_rc_file (XfcePanelPlugin *plugin, *****************************/ static void calculate_pupil_xy (EyesPlugin *eyes_applet, - gint x, gint y, - gint *pupil_x, gint *pupil_y, GtkWidget* widget) + gint x, + gint y, + gint *pupil_x, + gint *pupil_y, + GtkWidget *widget) { double sina; double cosa; @@ -70,18 +73,25 @@ calculate_pupil_xy (EyesPlugin *eyes_applet, width = GTK_WIDGET(widget)->allocation.width; height = GTK_WIDGET(widget)->allocation.height; - gtk_misc_get_alignment(GTK_MISC(widget), &xalign, &yalign); + gtk_misc_get_alignment(GTK_MISC(widget), &xalign, &yalign); - nx = x - MAX(width - eyes_applet->eye_width, 0) * xalign - eyes_applet->eye_width / 2; - ny = y - MAX(height- eyes_applet->eye_height, 0) * yalign - eyes_applet->eye_height / 2; + nx = x - (MAX(width - eyes_applet->eye_width, 0) + * xalign - eyes_applet->eye_width / 2) + - GTK_WIDGET(widget)->allocation.x; + ny = y - (MAX(height - eyes_applet->eye_height, 0) + * yalign - eyes_applet->eye_height / 2) + - GTK_WIDGET(widget)->allocation.y; h = hypot (nx, ny); - if (h < 0.5 || abs (h) - < (abs (hypot (eyes_applet->eye_height / 2, eyes_applet->eye_width / 2)) - eyes_applet->wall_thickness - eyes_applet->pupil_height)) + if (h < 0.5 || + abs (h) < (abs (hypot (eyes_applet->eye_height / 2, + eyes_applet->eye_width / 2)) + - eyes_applet->wall_thickness + - eyes_applet->pupil_height)) { - *pupil_x = nx + eyes_applet->eye_width / 2; - *pupil_y = ny + eyes_applet->eye_height / 2; - return; + *pupil_x = nx + eyes_applet->eye_width / 2; + *pupil_y = ny + eyes_applet->eye_height / 2; + return; } sina = nx / h; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits