]> www.fi.muni.cz Git - evince.git/commitdiff
Remove unused unrealize handler. Add scroll handling to
authorChristian Persch <chpe@cvs.gnome.org>
Thu, 22 Sep 2005 17:13:23 +0000 (17:13 +0000)
committerChristian Persch <chpe@src.gnome.org>
Thu, 22 Sep 2005 17:13:23 +0000 (17:13 +0000)
2005-09-22  Christian Persch  <chpe@cvs.gnome.org>

* shell/ev-view.c: (ev_view_scroll_event), (ev_view_class_init):
Remove unused unrealize handler. Add scroll handling to
ev_view_scroll_event for presentation mode (bug #316708),
and fix the event state checks there.

ChangeLog
shell/ev-view.c

index 29bbe46c913da62b4dfecded5d477f330dad04ec..8beb2d559e9d924bd95cad179f140f8bade7f349 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-09-22  Christian Persch  <chpe@cvs.gnome.org>
+
+       * shell/ev-view.c: (ev_view_scroll_event), (ev_view_class_init):
+       Remove unused unrealize handler. Add scroll handling to
+       ev_view_scroll_event for presentation mode (bug #316708),
+       and fix the event state checks there.
+
 2005-09-22  Marco Pesenti Gritti  <mpg@redhat.com>
 
        * shell/ev-page-action.c: (page_changed_cb):
index 5cc21ab1eedddd2631052b8784d6fa18cf46ae0a..612ffc5cf2f7995b913b60214d6b9c3c7115b115 100644 (file)
@@ -264,7 +264,6 @@ static void       ev_view_size_request                       (GtkWidget
 static void       ev_view_size_allocate                      (GtkWidget          *widget,
                                                              GtkAllocation      *allocation);
 static void       ev_view_realize                            (GtkWidget          *widget);
-static void       ev_view_unrealize                          (GtkWidget          *widget);
 static gboolean   ev_view_scroll_event                       (GtkWidget          *widget,
                                                              GdkEventScroll     *event);
 static gboolean   ev_view_expose_event                       (GtkWidget          *widget,
@@ -1457,39 +1456,59 @@ ev_view_realize (GtkWidget *widget)
                gdk_window_set_background (widget->window, &widget->style->mid [GTK_STATE_NORMAL]);
 }
 
-static void
-ev_view_unrealize (GtkWidget *widget)
-{
-       GTK_WIDGET_CLASS (ev_view_parent_class)->unrealize (widget);
-}
-
 static gboolean
 ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event)
 {
-       EvView *view = EV_VIEW (widget);
+       EvView *view = EV_VIEW (widget);
+       guint state;
 
-       if ((event->state & GDK_CONTROL_MASK) != 0) {
+       state = event->state & gtk_accelerator_get_default_mod_mask ();
 
-                ev_view_set_sizing_mode (view, EV_SIZING_FREE);
+       if (state == GDK_CONTROL_MASK && view->presentation == FALSE) {
+               ev_view_set_sizing_mode (view, EV_SIZING_FREE);
+
+               if (event->direction == GDK_SCROLL_UP ||
+                   event->direction == GDK_SCROLL_LEFT) {
+                       if (ev_view_can_zoom_in (view)) {
+                               ev_view_zoom_in (view);
+                       }
+               } else {
+                       if (ev_view_can_zoom_out (view)) {
+                               ev_view_zoom_out (view);
+                       }
+               }
 
-                if (event->direction == GDK_SCROLL_UP ||
-                       event->direction == GDK_SCROLL_LEFT) {
-                           if (ev_view_can_zoom_in (view)) {
-                                   ev_view_zoom_in (view);
-                           }
-                } else {
-                           if (ev_view_can_zoom_out (view)) {
-                                   ev_view_zoom_out (view);
-                           }
-                }
-                return TRUE;
+               return TRUE;
        }
 
-       if ((event->state & GDK_SHIFT_MASK) != 0) {
+       /* Shift+Wheel scrolls the in the perpendicular direction */
+       if (state & GDK_SHIFT_MASK) {
                if (event->direction == GDK_SCROLL_UP)
                        event->direction = GDK_SCROLL_LEFT;
+               if (event->direction == GDK_SCROLL_LEFT)
+                       event->direction = GDK_SCROLL_UP;
                if (event->direction == GDK_SCROLL_DOWN)
                        event->direction = GDK_SCROLL_RIGHT;
+               if (event->direction == GDK_SCROLL_RIGHT)
+                       event->direction = GDK_SCROLL_DOWN;
+
+               event->state &= ~GDK_SHIFT_MASK;
+               state &= ~GDK_SHIFT_MASK;
+       }
+
+       if (state == 0 && view->presentation) {
+               switch (event->direction) {
+               case GDK_SCROLL_DOWN:
+               case GDK_SCROLL_RIGHT:
+                       ev_view_next_page (view);       
+                       break;
+               case GDK_SCROLL_UP:
+               case GDK_SCROLL_LEFT:
+                       ev_view_previous_page (view);
+                       break;
+               }
+
+               return TRUE;
        }
 
        return FALSE;
@@ -2137,7 +2156,6 @@ ev_view_class_init (EvViewClass *class)
        widget_class->size_request = ev_view_size_request;
        widget_class->size_allocate = ev_view_size_allocate;
        widget_class->realize = ev_view_realize;
-       widget_class->unrealize = ev_view_unrealize;
        widget_class->scroll_event = ev_view_scroll_event;
        widget_class->enter_notify_event = ev_view_enter_notify_event;
        widget_class->leave_notify_event = ev_view_leave_notify_event;