wacom: Fix ~100 pixel offset when calibrating

The calibration gui code moved the targets to x,y, instead of
placing the centre of the target at x,y, leading to a 47 pixel
(half the target's size) offset in both directions (thus 67 pixels
deviation as Pythagorus would tell us).
This commit is contained in:
Bastien Nocera 2013-10-09 12:55:29 +02:00
parent bf68dfb62d
commit 95f613bee1
3 changed files with 19 additions and 16 deletions

View file

@ -131,9 +131,9 @@ resize_display(CalibArea *calib_area)
{
gint i = calib_area->calibrator.num_clicks;
set_display_size(calib_area, width, height);
cc_target_actor_move (CC_TARGET_ACTOR (calib_area->target),
calib_area->X[i],
calib_area->Y[i]);
cc_target_actor_move_center (CC_TARGET_ACTOR (calib_area->target),
calib_area->X[i],
calib_area->Y[i]);
}
}
@ -346,10 +346,9 @@ on_button_press_event(ClutterActor *actor,
return FALSE;
}
cc_target_actor_move (CC_TARGET_ACTOR (area->target),
area->X[num_clicks],
area->Y[num_clicks]);
cc_target_actor_move_center (CC_TARGET_ACTOR (area->target),
area->X[num_clicks],
area->Y[num_clicks]);
return FALSE;
}

View file

@ -24,6 +24,7 @@
#define CC_TARGET_ACTOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TARGET_ACTOR_TYPE, CcTargetActorPrivate))
#define CROSS_LINES 47
#define TARGET_DIMENSION (CROSS_LINES * 2)
#define CROSS_CIRCLE 7
#define CROSS_CIRCLE2 27
#define TARGET_SHOW_ANIMATION_DURATION 500
@ -185,8 +186,10 @@ cc_target_actor_class_init (CcTargetActorClass *klass)
g_type_class_add_private (klass, sizeof (CcTargetActorPrivate));
}
/* Move the _center_ of the target to be at (x,y) */
void
cc_target_actor_move (CcTargetActor *self, gdouble x, gdouble y)
cc_target_actor_move_center (CcTargetActor *self, gdouble x, gdouble y)
{
g_return_if_fail (CC_IS_TARGET_ACTOR (self));
@ -195,8 +198,9 @@ cc_target_actor_move (CcTargetActor *self, gdouble x, gdouble y)
gboolean target_visible;
priv = CC_TARGET_ACTOR_GET_PRIVATE (self);
priv->pos_x = x;
priv->pos_y = y;
priv->pos_x = x - (TARGET_DIMENSION / 2);
priv->pos_y = y - (TARGET_DIMENSION / 2);
g_object_get (self, "visible", &target_visible, NULL);
@ -216,7 +220,7 @@ cc_target_actor_move (CcTargetActor *self, gdouble x, gdouble y)
{
clutter_actor_show (CLUTTER_ACTOR (self));
clutter_actor_set_position (CLUTTER_ACTOR (self), x, y);
clutter_actor_set_position (CLUTTER_ACTOR (self), priv->pos_x, priv->pos_y);
show_target (self);
}

View file

@ -50,11 +50,11 @@ struct _CcTargetActorClass
ClutterActorClass parent_class;
};
ClutterActor * cc_target_actor_new (void);
void cc_target_actor_move (CcTargetActor *target,
gdouble x,
gdouble y);
ClutterActor * cc_target_actor_new (void);
void cc_target_actor_move_center (CcTargetActor *target,
gdouble x,
gdouble y);
GType cc_target_actor_get_type (void);
GType cc_target_actor_get_type (void);
#endif /* __CC_TARGET_ACTOR_H__ */