Commit 520b15be authored by Igor's avatar Igor
Browse files

Hide the cursor while inactive in fullscreen mode

Fixes bug #15920
parent 41c3bf56
......@@ -684,8 +684,7 @@ rstto_image_list_set_directory (
/* Source code block */
if (image_list->priv->directory_loader != 0)
{
g_source_remove (image_list->priv->directory_loader);
image_list->priv->directory_loader = 0;
REMOVE_SOURCE (image_list->priv->directory_loader);
}
rstto_image_list_remove_all (image_list);
......@@ -803,8 +802,7 @@ cb_rstto_read_file ( gpointer user_data )
/* This is a hack, use a closure */
if (loader->image_list->priv->directory_loader != 0)
{
g_source_remove (loader->image_list->priv->directory_loader);
loader->image_list->priv->directory_loader = 0;
REMOVE_SOURCE (loader->image_list->priv->directory_loader);
}
iter = loader->image_list->priv->iterators;
......
......@@ -3026,8 +3026,7 @@ rstto_image_viewer_set_show_clock (RsttoImageViewer *viewer, gboolean value)
{
if (viewer->priv->refresh_timeout_id)
{
g_source_remove (viewer->priv->refresh_timeout_id);
viewer->priv->refresh_timeout_id = 0;
REMOVE_SOURCE (viewer->priv->refresh_timeout_id);
}
}
}
......
......@@ -79,6 +79,7 @@ struct _RsttoMainWindowPriv
GDBusProxy *filemanager_proxy;
guint show_fs_toolbar_timeout_id;
guint show_fs_mouse_cursor_timeout_id;
gint window_save_geometry_timer_id;
gboolean fs_toolbar_sticky;
......@@ -186,6 +187,10 @@ 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);
static gboolean
cb_rstto_main_window_show_fs_mouse_cursor_timeout (RsttoMainWindow *window);
static void
cb_rstto_main_window_show_fs_mouse_cursor_timeout_destroy (gpointer user_data);
static void
cb_rstto_main_window_image_list_iter_changed (RsttoImageListIter *iter, RsttoMainWindow *window);
static void
......@@ -2428,8 +2433,7 @@ cb_rstto_main_window_state_event (GtkWidget *widget, GdkEventWindowState *event,
{
if (window->priv->show_fs_toolbar_timeout_id > 0)
{
g_source_remove (window->priv->show_fs_toolbar_timeout_id);
window->priv->show_fs_toolbar_timeout_id = 0;
REMOVE_SOURCE (window->priv->show_fs_toolbar_timeout_id);
}
if (rstto_image_list_get_n_images (window->priv->image_list) != 0)
{
......@@ -2440,6 +2444,11 @@ cb_rstto_main_window_state_event (GtkWidget *widget, GdkEventWindowState *event,
}
}
window->priv->show_fs_mouse_cursor_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT, 500,
(GSourceFunc) cb_rstto_main_window_show_fs_mouse_cursor_timeout, window,
cb_rstto_main_window_show_fs_mouse_cursor_timeout_destroy);
if (rstto_settings_get_boolean_property (window->priv->settings_manager, "hide-thumbnails-fullscreen"))
{
gtk_widget_hide (window->priv->t_bar_s_window);
......@@ -2506,8 +2515,16 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (window->priv->show_fs_toolbar_timeout_id > 0)
{
g_source_remove (window->priv->show_fs_toolbar_timeout_id);
window->priv->show_fs_toolbar_timeout_id = 0;
REMOVE_SOURCE (window->priv->show_fs_toolbar_timeout_id);
}
if (window->priv->show_fs_mouse_cursor_timeout_id > 0)
{
REMOVE_SOURCE (window->priv->show_fs_mouse_cursor_timeout_id);
}
else
{
gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
}
gtk_widget_show (window->priv->menubar);
......@@ -2549,11 +2566,25 @@ cb_rstto_main_window_motion_notify_event (RsttoMainWindow *window, GdkEventMotio
if (window->priv->show_fs_toolbar_timeout_id > 0)
{
g_source_remove (window->priv->show_fs_toolbar_timeout_id);
window->priv->show_fs_toolbar_timeout_id = 0;
REMOVE_SOURCE (window->priv->show_fs_toolbar_timeout_id);
}
}
}
/* Show the mouse cursor, but set a timer to hide it in 1 second if not moved again */
if (window->priv->show_fs_mouse_cursor_timeout_id > 0)
{
REMOVE_SOURCE (window->priv->show_fs_mouse_cursor_timeout_id);
}
else
{
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
}
window->priv->show_fs_mouse_cursor_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT, 1000,
(GSourceFunc) cb_rstto_main_window_show_fs_mouse_cursor_timeout, window,
cb_rstto_main_window_show_fs_mouse_cursor_timeout_destroy);
}
return TRUE;
}
......@@ -2598,8 +2629,7 @@ cb_rstto_main_window_image_viewer_enter_notify_event (GtkWidget *widget, GdkEven
window->priv->fs_toolbar_sticky = FALSE;
if (window->priv->show_fs_toolbar_timeout_id > 0)
{
g_source_remove (window->priv->show_fs_toolbar_timeout_id);
window->priv->show_fs_toolbar_timeout_id = 0;
REMOVE_SOURCE (window->priv->show_fs_toolbar_timeout_id);
}
window->priv->show_fs_toolbar_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT, 500,
......@@ -2624,6 +2654,20 @@ cb_rstto_main_window_show_fs_toolbar_timeout_destroy (gpointer user_data)
RSTTO_MAIN_WINDOW (user_data)->priv->show_fs_toolbar_timeout_id = 0;
}
static gboolean
cb_rstto_main_window_show_fs_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);
return FALSE;
}
static void
cb_rstto_main_window_show_fs_mouse_cursor_timeout_destroy (gpointer user_data)
{
RSTTO_MAIN_WINDOW (user_data)->priv->show_fs_mouse_cursor_timeout_id = 0;
}
/**
* cb_rstto_main_window_play:
* @widget:
......@@ -2852,7 +2896,7 @@ cb_rstto_main_window_configure_event (GtkWidget *widget, GdkEventConfigure *even
/* drop any previous timer source */
if (window->priv->window_save_geometry_timer_id > 0)
{
g_source_remove (window->priv->window_save_geometry_timer_id);
REMOVE_SOURCE (window->priv->window_save_geometry_timer_id);
}
/* check if we should schedule another save timer */
......
......@@ -295,7 +295,7 @@ rstto_thumbnailer_queue_file (
if (thumbnailer->priv->request_timer_id)
{
g_source_remove (thumbnailer->priv->request_timer_id);
REMOVE_SOURCE (thumbnailer->priv->request_timer_id);
if (thumbnailer->priv->handle)
{
if(tumbler_thumbnailer1_call_dequeue_sync(
......@@ -338,7 +338,8 @@ rstto_thumbnailer_dequeue_file (
if (thumbnailer->priv->request_timer_id)
{
g_source_remove (thumbnailer->priv->request_timer_id);
REMOVE_SOURCE (thumbnailer->priv->request_timer_id);
}
if (thumbnailer->priv->handle)
......
......@@ -79,6 +79,9 @@ typedef enum {
#define THUMBNAIL_SIZE_LARGER_SIZE 128
#define THUMBNAIL_SIZE_VERY_LARGE_SIZE 256
/* Macro to remove and clear a source id */
#define REMOVE_SOURCE(ID) ({g_source_remove (ID); ID = 0;})
G_END_DECLS
#endif /* __RSTTO_UTIL_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment