summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-10-08 12:11:51 -0700
committerEmmanuele Bassi <ebassi@gnome.org>2015-04-23 20:29:28 +0100
commitc3004bbf42f5c046355e5d35a618af51494d15da (patch)
treea75722cde10fcdb72f398954354fde9ebd4be3e8
parent4e3a8fc049a94d7a1ca42886d7e30026fbed70ab (diff)
downloadclutter-c3004bbf42f5c046355e5d35a618af51494d15da.tar.gz
input-device: Reset the focused actor when it becomes unreactive
https://bugzilla.gnome.org/show_bug.cgi?id=743865 (cherry picked from commit 6c057e3171607d3cbfa61ec57c1fff6c5d72b14c) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--clutter/clutter-input-device.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/clutter/clutter-input-device.c b/clutter/clutter-input-device.c
index b7de58630..49bcfae2f 100644
--- a/clutter/clutter-input-device.c
+++ b/clutter/clutter-input-device.c
@@ -551,6 +551,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,
@@ -576,6 +579,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);
}
@@ -610,6 +616,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);
}
}
@@ -621,6 +630,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