+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>
+
2005-02-16 Vincent Noel <vnoel@cox.net>
* shell/main.c (main): Specify an icon for the window. Patch by
typedef enum {
EV_VIEW_CURSOR_NORMAL,
EV_VIEW_CURSOR_LINK,
- EV_VIEW_CURSOR_WAIT
+ EV_VIEW_CURSOR_WAIT,
+ EV_VIEW_CURSOR_HIDDEN
} EvViewCursor;
#define ZOOM_IN_FACTOR 1.2
GDK_BUTTON_RELEASE_MASK |
GDK_SCROLL_MASK |
GDK_KEY_PRESS_MASK |
- GDK_POINTER_MOTION_MASK;
+ GDK_POINTER_MOTION_MASK |
+ GDK_LEAVE_NOTIFY_MASK;
view->bin_window = gdk_window_new (widget->window,
&attributes,
static void
highlight_find_results (EvView *view)
{
- EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
+ EvDocumentFind *find;
int i, results;
+ g_return_if_fail (EV_IS_DOCUMENT_FIND (view->document));
+
+ find = EV_DOCUMENT_FIND (view->document);
+
results = ev_document_find_get_n_results (find);
for (i = 0; i < results; i++) {
g_object_notify (G_OBJECT (view), "find-status");
}
+static GdkCursor *
+ev_view_create_invisible_cursor(void)
+{
+ GdkBitmap *empty;
+ GdkColor black = { 0, 0, 0, 0 };
+ static unsigned char bits[] = { 0x00 };
+
+ empty = gdk_bitmap_create_from_data (NULL, bits, 1, 1);
+
+ return gdk_cursor_new_from_pixmap (empty, empty, &black, &black, 0, 0);
+}
static void
ev_view_set_cursor (EvView *view, EvViewCursor new_cursor)
case EV_VIEW_CURSOR_WAIT:
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
break;
+ case EV_VIEW_CURSOR_HIDDEN:
+ cursor = ev_view_create_invisible_cursor ();
+ break;
+
}
if (cursor) {
&old_width, &old_height);
if (old_page != page) {
- ev_view_set_cursor (view, EV_VIEW_CURSOR_WAIT);
+ if (view->cursor != EV_VIEW_CURSOR_HIDDEN) {
+ ev_view_set_cursor (view, EV_VIEW_CURSOR_WAIT);
+ }
ev_document_set_page (view->document, page);
}
view->vadjustment->lower);
}
- view->find_page = page;
- view->find_result = 0;
-
if (EV_IS_DOCUMENT_FIND (view->document)) {
+ view->find_page = page;
+ view->find_result = 0;
update_find_status_message (view);
}
}
EvView *view)
{
gtk_widget_queue_draw (GTK_WIDGET (view));
- ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
+
+ if (view->cursor != EV_VIEW_CURSOR_HIDDEN) {
+ ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
+ }
}
/*** Public API ***/
if (document != view->document) {
if (view->document) {
- g_signal_handlers_disconnect_by_func
- (view->document, find_changed_cb, view);
+ g_signal_handlers_disconnect_by_func (view->document,
+ find_changed_cb,
+ view);
g_object_unref (view->document);
}
gtk_widget_queue_draw (GTK_WIDGET (view));
}
}
+void
+ev_view_hide_cursor (EvView *view)
+{
+ ev_view_set_cursor (view, EV_VIEW_CURSOR_HIDDEN);
+}
+
+void
+ev_view_show_cursor (EvView *view)
+{
+ ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK);
+}
const char *ev_view_get_status (EvView *view);
const char *ev_view_get_find_status (EvView *view);
+/* Cursor */
+void ev_view_hide_cursor (EvView *view);
+void ev_view_show_cursor (EvView *view);
+
G_END_DECLS
#endif /* __EV_VIEW_H__ */
EvChrome chrome;
gboolean fullscreen_mode;
EvSizingMode sizing_mode;
+ GSource *fullscreen_timeout_source;
};
static GtkTargetEntry ev_drop_types[] = {
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;
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)
{
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);
}
{
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);