Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-window.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2005-02-16 18:50:26 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-02-16 18:50:26 (GMT)
commit2c8c840466f3948e431ae851417e5ef92acf6fa7 (patch)
tree8d43e4453e96b8c85718a648c1f240f8dcd394f4 /shell/ev-window.c
parent11e0560261020abaa19efd5f1c901838855c7628 (diff)
Automatically hide the fullscreen button. Patch by Kristian Høgsberg
2005-02-16 Marco Pesenti Gritti <marco@gnome.org> * shell/ev-view.c: (ev_view_realize), (highlight_find_results), (ev_view_create_invisible_cursor), (ev_view_set_cursor), (set_document_page), (document_changed_callback), (ev_view_set_document), (ev_view_find_previous), (ev_view_hide_cursor), (ev_view_show_cursor): * shell/ev-view.h: * shell/ev-window.c: (update_chrome_visibility), (fullscreen_timeout_cb), (fullscreen_set_timeout), (fullscreen_clear_timeout), (fullscreen_motion_notify_cb), (fullscreen_leave_notify_cb), (ev_window_fullscreen), (ev_window_unfullscreen): * shell/main.c: (main): Automatically hide the fullscreen button. Patch by Kristian Høgsberg <krh@redhat.com>
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r--shell/ev-window.c94
1 files changed, 93 insertions, 1 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 27a6f60..387e998 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -108,6 +108,7 @@ struct _EvWindowPrivate {
EvChrome chrome;
gboolean fullscreen_mode;
EvSizingMode sizing_mode;
+ GSource *fullscreen_timeout_source;
};
static GtkTargetEntry ev_drop_types[] = {
@@ -222,7 +223,7 @@ update_chrome_visibility (EvWindow *window)
menubar = (priv->chrome & EV_CHROME_MENUBAR) != 0 && !priv->fullscreen_mode;
toolbar = (priv->chrome & EV_CHROME_TOOLBAR) != 0;
- sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0;
+ sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && !priv->fullscreen_mode;
findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
statusbar = (priv->chrome & EV_CHROME_STATUSBAR) != 0 && !priv->fullscreen_mode;
@@ -1038,6 +1039,71 @@ fullscreen_popup_size_request_cb (GtkWidget *popup, GtkRequisition *req, EvWindo
ev_window_update_fullscreen_popup (window);
}
+static gboolean
+fullscreen_timeout_cb (gpointer data)
+{
+ EvWindow *window = EV_WINDOW (data);
+
+ g_object_set (window->priv->toolbar_dock, "visible", FALSE, NULL);
+ ev_view_hide_cursor (EV_VIEW (window->priv->view));
+ window->priv->fullscreen_timeout_source = NULL;
+
+ return FALSE;
+}
+
+static void
+fullscreen_set_timeout (EvWindow *window)
+{
+ GSource *source;
+
+ if (window->priv->fullscreen_timeout_source != NULL)
+ g_source_destroy (window->priv->fullscreen_timeout_source);
+
+ source = g_timeout_source_new (1000);
+ g_source_set_callback (source, fullscreen_timeout_cb, window, NULL);
+ g_source_attach (source, NULL);
+ window->priv->fullscreen_timeout_source = source;
+}
+
+static void
+fullscreen_clear_timeout (EvWindow *window)
+{
+ if (window->priv->fullscreen_timeout_source != NULL)
+ g_source_destroy (window->priv->fullscreen_timeout_source);
+
+ window->priv->fullscreen_timeout_source = NULL;
+ ev_view_show_cursor (EV_VIEW (window->priv->view));
+}
+
+static gboolean
+fullscreen_motion_notify_cb (GtkWidget *widget,
+ GdkEventMotion *event,
+ gpointer user_data)
+{
+ EvWindow *window = EV_WINDOW (user_data);
+
+ if (!GTK_WIDGET_VISIBLE (window->priv->exit_fullscreen_popup)) {
+ g_object_set (window->priv->toolbar_dock, "visible", TRUE, NULL);
+ ev_view_show_cursor (EV_VIEW (window->priv->view));
+ }
+
+ fullscreen_set_timeout (window);
+
+ return FALSE;
+}
+
+static gboolean
+fullscreen_leave_notify_cb (GtkWidget *widget,
+ GdkEventCrossing *event,
+ gpointer user_data)
+{
+ EvWindow *window = EV_WINDOW (user_data);
+
+ fullscreen_clear_timeout (window);
+
+ return FALSE;
+}
+
static void
ev_window_fullscreen (EvWindow *window)
{
@@ -1079,6 +1145,22 @@ ev_window_fullscreen (EvWindow *window)
update_chrome_visibility (window);
+ g_object_set (G_OBJECT (window->priv->scrolled_window),
+ "shadow-type", GTK_SHADOW_NONE,
+ NULL);
+
+ g_signal_connect (window->priv->view,
+ "motion-notify-event",
+ G_CALLBACK (fullscreen_motion_notify_cb),
+ window);
+ g_signal_connect (window->priv->view,
+ "leave-notify-event",
+ G_CALLBACK (fullscreen_leave_notify_cb),
+ window);
+ fullscreen_set_timeout (window);
+
+ gtk_widget_grab_focus (window->priv->view);
+
ev_window_update_fullscreen_popup (window);
}
@@ -1087,6 +1169,16 @@ ev_window_unfullscreen (EvWindow *window)
{
window->priv->fullscreen_mode = FALSE;
+ g_object_set (G_OBJECT (window->priv->scrolled_window),
+ "shadow-type", GTK_SHADOW_IN,
+ NULL);
+
+ fullscreen_clear_timeout (window);
+
+ g_signal_handlers_disconnect_by_func (window->priv->view,
+ (gpointer) fullscreen_motion_notify_cb,
+ window);
+
destroy_exit_fullscreen_popup (window);
update_chrome_visibility (window);