From 0cc80dfb513c3986659c41bdf0edf06c7702f77b Mon Sep 17 00:00:00 2001 From: Franco Tortoriello Date: Thu, 29 Dec 2016 21:22:37 -0300 Subject: Fix cursor on single-click navigation mode. On this mode, after opening a folder, the hand cursor was used until the user moved the cursor over a file or folder. Based on Nautilus commit https://git.gnome.org/browse/nautilus/commit/?id=2644c6ef4e7839e976d4861d6c86e16e34d46a13 --- libcaja-private/caja-icon-canvas-item.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c index 13e59bfd..14bd2db3 100644 --- a/libcaja-private/caja-icon-canvas-item.c +++ b/libcaja-private/caja-icon-canvas-item.c @@ -149,6 +149,8 @@ struct CajaIconCanvasItemDetails EelIRect bounds_cache_for_layout; EelIRect bounds_cache_for_entire_item; + GdkWindow *cursor_window; + /* Accessibility bits */ GailTextUtil *text_util; }; @@ -275,6 +277,12 @@ caja_icon_canvas_item_finalize (GObject *object) details = CAJA_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); @@ -2571,8 +2579,10 @@ caja_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event) { CajaIconCanvasItem *icon_item; GdkCursor *cursor; + GdkWindow *cursor_window; icon_item = CAJA_ICON_CANVAS_ITEM (item); + cursor_window = ((GdkEventAny *) event)->window; switch (event->type) { @@ -2590,12 +2600,13 @@ caja_icon_canvas_item_event (EelCanvasItem *item, GdkEvent *event) { 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); #if GTK_CHECK_VERSION(3,0,0) g_object_unref (cursor); #else gdk_cursor_unref (cursor); #endif + icon_item->details->cursor_window = g_object_ref (cursor_window); } /* FIXME bugzilla.gnome.org 42473: @@ -2642,7 +2653,8 @@ caja_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; -- cgit v1.2.1