mirror of
https://github.com/brl/mutter.git
synced 2025-02-17 05:44:08 +00:00
actor: Use GParamSpecUint for :opacity
The :opacity property is defined using a GParamSpecUchar. This usually leads to issues with language bindings that don't have an 'unsigned char' type and that need to explicitly handle the conversion between G_TYPE_UCHAR and G_TYPE_INT or G_TYPE_UINT. The property definition already specifies an interval size of [0, 255] on the values; more importantly, GObject already implicitly transforms between G_TYPE_UCHAR and G_TYPE_UINT (the GValue transformation functions are registered at type system initialization time) so switching between a GParamSpecUchar and a GParamSpecUint should not be an ABI break. I have tested a simple program using the opacity property before and after the change and I cannot see any run-time warnings related to this issue.
This commit is contained in:
parent
d0f7debfba
commit
8fc07c51a9
@ -2581,7 +2581,7 @@ clutter_actor_set_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OPACITY:
|
case PROP_OPACITY:
|
||||||
clutter_actor_set_opacity (actor, g_value_get_uchar (value));
|
clutter_actor_set_opacity (actor, g_value_get_uint (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NAME:
|
case PROP_NAME:
|
||||||
@ -2864,7 +2864,7 @@ clutter_actor_get_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OPACITY:
|
case PROP_OPACITY:
|
||||||
g_value_set_uchar (value, priv->opacity);
|
g_value_set_uint (value, priv->opacity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NAME:
|
case PROP_NAME:
|
||||||
@ -3462,12 +3462,12 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
|||||||
/**
|
/**
|
||||||
* ClutterActor:opacity:
|
* ClutterActor:opacity:
|
||||||
*
|
*
|
||||||
* Opacity of the actor, between 0 (fully transparent) and
|
* Opacity of an actor, between 0 (fully transparent) and
|
||||||
* 255 (fully opaque)
|
* 255 (fully opaque)
|
||||||
*/
|
*/
|
||||||
pspec = g_param_spec_uchar ("opacity",
|
pspec = g_param_spec_uint ("opacity",
|
||||||
"Opacity",
|
"Opacity",
|
||||||
"Opacity of actor",
|
"Opacity of an actor",
|
||||||
0, 255,
|
0, 255,
|
||||||
255,
|
255,
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user