Exemple #1
0
/* Unset focus from actor */
static void _xfdashboard_viewpad_focusable_unset_focus(XfdashboardFocusable *inFocusable)
{
	XfdashboardViewpad				*self;
	XfdashboardViewpadPrivate		*priv;
	XfdashboardFocusableInterface	*selfIface;
	XfdashboardFocusableInterface	*parentIface;

	g_return_if_fail(XFDASHBOARD_IS_FOCUSABLE(inFocusable));
	g_return_if_fail(XFDASHBOARD_IS_VIEWPAD(inFocusable));

	self=XFDASHBOARD_VIEWPAD(inFocusable);
	priv=self->priv;

	/* Viewpad is just a proxy for the current active view.
	 * So check if current active view is focusable and call its
	 * virtual function.
	 */
	if(priv->activeView &&
		XFDASHBOARD_IS_FOCUSABLE(priv->activeView))
	{
		/* Call virtual function of view to unset focus */
		xfdashboard_focusable_unset_focus(XFDASHBOARD_FOCUSABLE(priv->activeView));

		/* Call parent class interface function of this actor */
		selfIface=XFDASHBOARD_FOCUSABLE_GET_IFACE(inFocusable);
		parentIface=g_type_interface_peek_parent(selfIface);

		if(parentIface && parentIface->unset_focus)
		{
			parentIface->unset_focus(inFocusable);
		}
	}
}
Exemple #2
0
/* Unset focus from actor */
static void _xfdashboard_text_box_focusable_unset_focus(XfdashboardFocusable *inFocusable)
{
	ClutterActor					*self;
	XfdashboardFocusableInterface	*selfIface;
	XfdashboardFocusableInterface	*parentIface;
	ClutterStage					*stage;

	g_return_if_fail(XFDASHBOARD_IS_FOCUSABLE(inFocusable));
	g_return_if_fail(XFDASHBOARD_IS_ACTOR(inFocusable));

	self=CLUTTER_ACTOR(inFocusable);

	/* Call parent class interface function */
	selfIface=XFDASHBOARD_FOCUSABLE_GET_IFACE(inFocusable);
	parentIface=g_type_interface_peek_parent(selfIface);

	if(parentIface && parentIface->unset_focus)
	{
		parentIface->unset_focus(inFocusable);
	}

	/* Get stage of actor to tell it where the keyboard focus to set to */
	stage=CLUTTER_STAGE(clutter_actor_get_stage(self));
	if(!stage)
	{
		g_warning(_("Focusable actor %s is not on a stage"),
					G_OBJECT_TYPE_NAME(self));
		return;
	}

	clutter_stage_set_key_focus(stage, NULL);
}
Exemple #3
0
/* Call virtual function "unset_focus" */
void xfdashboard_focusable_unset_focus(XfdashboardFocusable *self)
{
	XfdashboardFocusableInterface		*iface;
	ClutterActor						*selection;

	g_return_if_fail(XFDASHBOARD_IS_FOCUSABLE(self));

	iface=XFDASHBOARD_FOCUSABLE_GET_IFACE(self);

	/* Call virtual function */
	if(iface->unset_focus)
	{
		iface->unset_focus(self);
	}

	/* Remove style from unfocused actor */
	if(XFDASHBOARD_IS_STYLABLE(self))
	{
		xfdashboard_stylable_remove_class(XFDASHBOARD_STYLABLE(self), "focus");
	}

	/* If actor supports selection get current selection and unstyle it */
	if(xfdashboard_focusable_supports_selection(self))
	{
		/* Get current selection */
		selection=xfdashboard_focusable_get_selection(self);

		/* unstyle selection if available */
		if(selection &&
			XFDASHBOARD_IS_STYLABLE(selection))
		{
			xfdashboard_stylable_remove_pseudo_class(XFDASHBOARD_STYLABLE(selection), "selected");
		}

		g_debug("Unstyled selection %s for focus loosing actor %s",
				G_OBJECT_TYPE_NAME(self),
				selection ? G_OBJECT_TYPE_NAME(selection) : "<nil>");
	}

	/* Emit signal */
	g_signal_emit(self, XfdashboardFocusableSignals[SIGNAL_FOCUS_LOST], 0, self);
	g_debug("Emitted signal 'focus-lost' for focused actor %s", G_OBJECT_TYPE_NAME(self));
}