wayland/feedback-actor: Use float for position and anchor

To be correct with fractional scaling. Furthermore, we currently
use it only with ClutterPoint values, which are floats already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/684
This commit is contained in:
Robert Mader 2019-08-26 14:14:18 +03:00
parent acbefa5263
commit 7275cf60bd
3 changed files with 33 additions and 33 deletions

View File

@ -206,7 +206,7 @@ meta_dnd_actor_drag_finish (MetaDnDActor *self,
if (CLUTTER_ACTOR_IS_VISIBLE (self->drag_origin)) if (CLUTTER_ACTOR_IS_VISIBLE (self->drag_origin))
{ {
int anchor_x, anchor_y; float anchor_x, anchor_y;
ClutterPoint dest; ClutterPoint dest;
clutter_actor_get_transformed_position (self->drag_origin, clutter_actor_get_transformed_position (self->drag_origin,

View File

@ -45,19 +45,19 @@ struct _MetaFeedbackActorClass
}; };
ClutterActor *meta_feedback_actor_new (int anchor_x, ClutterActor *meta_feedback_actor_new (float anchor_x,
int anchor_y); float anchor_y);
void meta_feedback_actor_set_anchor (MetaFeedbackActor *actor, void meta_feedback_actor_set_anchor (MetaFeedbackActor *actor,
int anchor_x, float anchor_x,
int anchor_y); float anchor_y);
void meta_feedback_actor_get_anchor (MetaFeedbackActor *actor, void meta_feedback_actor_get_anchor (MetaFeedbackActor *actor,
int *anchor_x, float *anchor_x,
int *anchor_y); float *anchor_y);
void meta_feedback_actor_set_position (MetaFeedbackActor *self, void meta_feedback_actor_set_position (MetaFeedbackActor *self,
int x, float x,
int y); float y);
void meta_feedback_actor_update (MetaFeedbackActor *self, void meta_feedback_actor_update (MetaFeedbackActor *self,
const ClutterEvent *event); const ClutterEvent *event);

View File

@ -40,10 +40,10 @@ typedef struct _MetaFeedbackActorPrivate MetaFeedbackActorPrivate;
struct _MetaFeedbackActorPrivate struct _MetaFeedbackActorPrivate
{ {
int anchor_x; float anchor_x;
int anchor_y; float anchor_y;
int pos_x; float pos_x;
int pos_y; float pos_y;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (MetaFeedbackActor, meta_feedback_actor, CLUTTER_TYPE_ACTOR) G_DEFINE_TYPE_WITH_PRIVATE (MetaFeedbackActor, meta_feedback_actor, CLUTTER_TYPE_ACTOR)
@ -106,10 +106,10 @@ meta_feedback_actor_get_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_ANCHOR_X: case PROP_ANCHOR_X:
g_value_set_int (value, priv->anchor_x); g_value_set_float (value, priv->anchor_x);
break; break;
case PROP_ANCHOR_Y: case PROP_ANCHOR_Y:
g_value_set_int (value, priv->anchor_y); g_value_set_float (value, priv->anchor_y);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -127,21 +127,21 @@ meta_feedback_actor_class_init (MetaFeedbackActorClass *klass)
object_class->set_property = meta_feedback_actor_set_property; object_class->set_property = meta_feedback_actor_set_property;
object_class->get_property = meta_feedback_actor_get_property; object_class->get_property = meta_feedback_actor_get_property;
pspec = g_param_spec_int ("anchor-x", pspec = g_param_spec_float ("anchor-x",
"Anchor X", "Anchor X",
"The X axis of the anchor point", "The X axis of the anchor point",
0, G_MAXINT, 0, 0, G_MAXFLOAT, 0,
G_PARAM_READWRITE); G_PARAM_READWRITE);
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_ANCHOR_X, PROP_ANCHOR_X,
pspec); pspec);
pspec = g_param_spec_int ("anchor-y", pspec = g_param_spec_float ("anchor-y",
"Anchor Y", "Anchor Y",
"The Y axis of the anchor point", "The Y axis of the anchor point",
0, G_MAXINT, 0, 0, G_MAXFLOAT, 0,
G_PARAM_READWRITE); G_PARAM_READWRITE);
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_ANCHOR_Y, PROP_ANCHOR_Y,
@ -162,8 +162,8 @@ meta_feedback_actor_init (MetaFeedbackActor *self)
* Return value: the newly created background actor * Return value: the newly created background actor
*/ */
ClutterActor * ClutterActor *
meta_feedback_actor_new (int anchor_x, meta_feedback_actor_new (float anchor_x,
int anchor_y) float anchor_y)
{ {
MetaFeedbackActor *self; MetaFeedbackActor *self;
@ -177,8 +177,8 @@ meta_feedback_actor_new (int anchor_x,
void void
meta_feedback_actor_set_anchor (MetaFeedbackActor *self, meta_feedback_actor_set_anchor (MetaFeedbackActor *self,
int anchor_x, float anchor_x,
int anchor_y) float anchor_y)
{ {
MetaFeedbackActorPrivate *priv; MetaFeedbackActorPrivate *priv;
@ -206,8 +206,8 @@ meta_feedback_actor_set_anchor (MetaFeedbackActor *self,
void void
meta_feedback_actor_get_anchor (MetaFeedbackActor *self, meta_feedback_actor_get_anchor (MetaFeedbackActor *self,
int *anchor_x, float *anchor_x,
int *anchor_y) float *anchor_y)
{ {
MetaFeedbackActorPrivate *priv; MetaFeedbackActorPrivate *priv;
@ -223,8 +223,8 @@ meta_feedback_actor_get_anchor (MetaFeedbackActor *self,
void void
meta_feedback_actor_set_position (MetaFeedbackActor *self, meta_feedback_actor_set_position (MetaFeedbackActor *self,
int x, float x,
int y) float y)
{ {
MetaFeedbackActorPrivate *priv; MetaFeedbackActorPrivate *priv;