stage: Add :key-focus property
ClutterStage has both set_key_focus() and get_key_focus() methods, but there is no :key-focus property. This means that it is not possible to get notifications when the key-focus has changes except by connecting to both the ::key-focus-in and ::key-focus-out signals and do additional bookkeeping. http://bugzilla.openedhand.com/show_bug.cgi?id=1956 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
95712f9897
commit
579a9a2665
@ -113,7 +113,8 @@ enum
|
||||
PROP_USER_RESIZE,
|
||||
PROP_USE_FOG,
|
||||
PROP_FOG,
|
||||
PROP_USE_ALPHA
|
||||
PROP_USE_ALPHA,
|
||||
PROP_KEY_FOCUS
|
||||
};
|
||||
|
||||
enum
|
||||
@ -694,6 +695,10 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_set_use_alpha (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_KEY_FOCUS:
|
||||
clutter_stage_set_key_focus (stage, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -750,6 +755,10 @@ clutter_stage_get_property (GObject *gobject,
|
||||
g_value_set_boolean (value, priv->use_alpha);
|
||||
break;
|
||||
|
||||
case PROP_KEY_FOCUS:
|
||||
g_value_set_object (value, priv->key_focused_actor);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -994,6 +1003,23 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_USE_ALPHA, pspec);
|
||||
|
||||
/**
|
||||
* ClutterStage:key-focus:
|
||||
*
|
||||
* The #ClutterActor that will receive key events from the underlying
|
||||
* windowing system.
|
||||
*
|
||||
* If %NULL, the #ClutterStage will receive the events.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
pspec = g_param_spec_object ("key-focus",
|
||||
"Key Focus",
|
||||
"The currently key focused actor",
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_KEY_FOCUS, pspec);
|
||||
|
||||
/**
|
||||
* ClutterStage::fullscreen
|
||||
* @stage: the stage which was fullscreened
|
||||
@ -1749,6 +1775,8 @@ clutter_stage_set_key_focus (ClutterStage *stage,
|
||||
}
|
||||
else
|
||||
g_signal_emit_by_name (stage, "key-focus-in");
|
||||
|
||||
g_object_notify (G_OBJECT (stage), "key-focus");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user