input-device: Reset the focused actor when it becomes unreactive

https://bugzilla.gnome.org/show_bug.cgi?id=743865
This commit is contained in:
Jasper St. Pierre 2014-10-08 12:11:51 -07:00
parent b192ad1300
commit 6c057e3171

View File

@ -600,6 +600,9 @@ _clutter_input_device_get_actor (ClutterInputDevice *device,
static void on_cursor_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device);
static void on_cursor_actor_reactive_changed (ClutterActor *actor,
GParamSpec *pspec,
ClutterInputDevice *device);
static void
_clutter_input_device_associate_actor (ClutterInputDevice *device,
@ -625,6 +628,9 @@ _clutter_input_device_associate_actor (ClutterInputDevice *device,
g_signal_connect (actor,
"destroy", G_CALLBACK (on_cursor_actor_destroy),
device);
g_signal_connect (actor,
"notify::reactive", G_CALLBACK (on_cursor_actor_reactive_changed),
device);
_clutter_actor_set_has_pointer (actor, TRUE);
}
@ -659,6 +665,9 @@ _clutter_input_device_unassociate_actor (ClutterInputDevice *device,
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (on_cursor_actor_destroy),
device);
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (on_cursor_actor_reactive_changed),
device);
_clutter_actor_set_has_pointer (actor, FALSE);
}
}
@ -670,6 +679,15 @@ on_cursor_actor_destroy (ClutterActor *actor,
_clutter_input_device_unassociate_actor (device, actor, TRUE);
}
static void
on_cursor_actor_reactive_changed (ClutterActor *actor,
GParamSpec *pspec,
ClutterInputDevice *device)
{
if (!clutter_actor_get_reactive (actor))
_clutter_input_device_unassociate_actor (device, actor, FALSE);
}
/*< private >
* clutter_input_device_set_actor:
* @device: a #ClutterInputDevice