mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
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
This commit is contained in:
parent
a47b2efd9b
commit
2644c6ef4e
1 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue