[nautilus/gnome-3-0] icon-canvas-item: make sure to reset the default cursor ond destruction
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-0] icon-canvas-item: make sure to reset the default cursor ond destruction
- Date: Mon, 25 Apr 2011 17:50:10 +0000 (UTC)
commit c17ac0277f9816c8e9b38bae5ada916d78d58b5d
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Mar 31 14:11:19 2011 -0400
icon-canvas-item: make sure to reset the default cursor ond destruction
We might be destroyed while hovering while in single-click mode, so make
sure the default cursor is always cleared when finalizing, if we didn't
get a leave event.
https://bugzilla.gnome.org/show_bug.cgi?id=315023
libnautilus-private/nautilus-icon-canvas-item.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index 4f71146..673b673 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -142,6 +142,8 @@ struct NautilusIconCanvasItemDetails {
EelIRect bounds_cache_for_layout;
EelIRect bounds_cache_for_entire_item;
+ GdkWindow *cursor_window;
+
/* Accessibility bits */
GailTextUtil *text_util;
};
@@ -219,6 +221,11 @@ nautilus_icon_canvas_item_finalize (GObject *object)
details = NAUTILUS_ICON_CANVAS_ITEM (object)->details;
+ if (details->cursor_window != NULL) {
+ gdk_window_set_cursor (details->cursor_window, NULL);
+ g_object_unref (details->cursor_window);
+ }
+
if (details->pixbuf != NULL) {
g_object_unref (details->pixbuf);
}
@@ -1667,8 +1674,10 @@ nautilus_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event)
{
NautilusIconCanvasItem *icon_item;
GdkCursor *cursor;
+ GdkWindow *cursor_window;
icon_item = NAUTILUS_ICON_CANVAS_ITEM (item);
+ cursor_window = ((GdkEventAny *)event)->window;
switch (event->type) {
case GDK_ENTER_NOTIFY:
@@ -1683,8 +1692,10 @@ nautilus_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event)
if (in_single_click_mode ()) {
cursor = gdk_cursor_new_for_display (gdk_display_get_default(),
GDK_HAND2);
- gdk_window_set_cursor (((GdkEventAny *)event)->window, cursor);
+ gdk_window_set_cursor (cursor_window, cursor);
g_object_unref (cursor);
+
+ icon_item->details->cursor_window = g_object_ref (cursor_window);
}
/* FIXME bugzilla.gnome.org 42473:
@@ -1730,7 +1741,8 @@ nautilus_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event)
eel_canvas_item_request_update (item);
/* show default cursor */
- gdk_window_set_cursor (((GdkEventAny *)event)->window, NULL);
+ gdk_window_set_cursor (cursor_window, NULL);
+ g_clear_object (&icon_item->details->cursor_window);
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]