[gnome-shell] StEntry: reset the cursor when unmapped
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] StEntry: reset the cursor when unmapped
- Date: Mon, 18 Feb 2013 17:11:10 +0000 (UTC)
commit 5e87fea1ee30ad2146bb28d163a99d9117c1dd3c
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Feb 18 01:47:34 2013 +0100
StEntry: reset the cursor when unmapped
We cannot reset the cursor at the next leave event, as that might
happen on a NULL stage and cause a BadWindow error, so do it on
unmap (which is guaranteed to happen before the stage is cleared).
https://bugzilla.gnome.org/show_bug.cgi?id=694057
src/st/st-entry.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 4d0e024..103b8f5 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -109,6 +109,7 @@ struct _StEntryPrivate
gboolean hint_visible;
gboolean capslock_warning_shown;
+ gboolean has_ibeam;
};
static guint entry_signals[LAST_SIGNAL] = { 0, };
@@ -667,6 +668,13 @@ st_entry_set_cursor (StEntry *entry,
dpy = clutter_x11_get_default_display ();
stage = clutter_actor_get_stage (actor);
+
+ if (stage == NULL)
+ {
+ g_warn_if_fail (!entry->priv->has_ibeam);
+ return;
+ }
+
wid = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
if (ibeam == None)
@@ -676,6 +684,8 @@ st_entry_set_cursor (StEntry *entry,
XDefineCursor (dpy, wid, ibeam);
else
XUndefineCursor (dpy, wid);
+
+ entry->priv->has_ibeam = use_ibeam;
}
static gboolean
@@ -689,6 +699,15 @@ st_entry_crossing_event (ClutterActor *actor,
}
static void
+st_entry_unmap (ClutterActor *actor)
+{
+ if (ST_ENTRY (actor)->priv->has_ibeam)
+ st_entry_set_cursor (ST_ENTRY (actor), FALSE);
+
+ CLUTTER_ACTOR_CLASS (st_entry_parent_class)->unmap (actor);
+}
+
+static void
st_entry_class_init (StEntryClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -706,6 +725,7 @@ st_entry_class_init (StEntryClass *klass)
actor_class->get_preferred_width = st_entry_get_preferred_width;
actor_class->get_preferred_height = st_entry_get_preferred_height;
actor_class->allocate = st_entry_allocate;
+ actor_class->unmap = st_entry_unmap;
actor_class->key_press_event = st_entry_key_press_event;
actor_class->key_focus_in = st_entry_key_focus_in;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]