--- main_window.c 2019-09-02 22:45:26.477041485 -0500 +++ ../../ristretto/src/main_window.c 2019-09-02 20:17:00.229241540 -0500 @@ -79,6 +79,7 @@ GDBusProxy *filemanager_proxy; guint show_fs_toolbar_timeout_id; + guint show_mouse_cursor_timeout_id; gint window_save_geometry_timer_id; gboolean fs_toolbar_sticky; @@ -183,6 +184,8 @@ static gboolean cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data); static gboolean +cb_rstto_main_window_show_mouse_cursor_timeout (RsttoMainWindow *window); +static gboolean cb_rstto_main_window_show_fs_toolbar_timeout (RsttoMainWindow *window); static void cb_rstto_main_window_show_fs_toolbar_timeout_destroy (gpointer user_data); @@ -291,6 +294,10 @@ GtkWidget *widget, RsttoMainWindow *window); static void +cb_rstto_main_window_unfullscreen ( + GtkWidget *widget, + RsttoMainWindow *window); +static void cb_rstto_main_window_preferences ( GtkWidget *widget, RsttoMainWindow *window); @@ -825,7 +832,7 @@ GtkWidget *info_bar_content_area; GClosure *toggle_fullscreen_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_fullscreen, window, NULL); - GClosure *leave_fullscreen_closure = g_cclosure_new_swap ((GCallback)gtk_window_unfullscreen, window, NULL); + GClosure *leave_fullscreen_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_unfullscreen, window, NULL); GClosure *next_image_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_next_image, window, NULL); GClosure *previous_image_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_previous_image, window, NULL); GClosure *quit_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_quit, window, NULL); @@ -2551,6 +2558,16 @@ } } } + + /* Show the mouse cursor, but set a timer to hide it in 1 second if not moved again */ + if (window->priv->show_mouse_cursor_timeout_id > 0) + g_source_remove (window->priv->show_mouse_cursor_timeout_id); + else + gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET (window)), NULL); + + window->priv->show_mouse_cursor_timeout_id = g_timeout_add (1000, + (GSourceFunc) cb_rstto_main_window_show_mouse_cursor_timeout, + window); } return TRUE; } @@ -2609,6 +2626,15 @@ } static gboolean +cb_rstto_main_window_show_mouse_cursor_timeout (RsttoMainWindow *window) +{ + GdkCursor *cursor = gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET (window)), "none"); + gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET (window)), cursor); + window->priv->show_mouse_cursor_timeout_id = 0; + return FALSE; +} + +static gboolean cb_rstto_main_window_show_fs_toolbar_timeout (RsttoMainWindow *window) { gtk_widget_hide (window->priv->toolbar); @@ -2737,14 +2763,42 @@ if (gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window))) & GDK_WINDOW_STATE_FULLSCREEN) { gtk_window_unfullscreen (GTK_WINDOW (window)); + + if (window->priv->show_mouse_cursor_timeout_id > 0) + g_source_remove (window->priv->show_mouse_cursor_timeout_id); + else + gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET (window)), NULL); } else { gtk_window_fullscreen (GTK_WINDOW (window)); + + window->priv->show_mouse_cursor_timeout_id = g_timeout_add (1000, + (GSourceFunc) cb_rstto_main_window_show_mouse_cursor_timeout, + window); } } /** + * cb_rstto_main_window_unfullscreen: + * @widget: + * @window: + * + * Leave fullscreen mode. + * + */ +static void +cb_rstto_main_window_unfullscreen (GtkWidget *widget, RsttoMainWindow *window) +{ + if (window->priv->show_mouse_cursor_timeout_id > 0) + g_source_remove (window->priv->show_mouse_cursor_timeout_id); + else + gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET (window)), NULL); + + gtk_window_unfullscreen (GTK_WINDOW (window)); +} + +/** * cb_rstto_main_window_preferences: * @widget: * @window: