]> www.fi.muni.cz Git - evince.git/commitdiff
[presentation] resize presentation when window allocation changes
authorxbezdick <255993@mail.muni.cz>
Tue, 19 Apr 2011 16:06:35 +0000 (18:06 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 Jun 2011 11:09:21 +0000 (13:09 +0200)
libview/ev-view-presentation.c

index be8c336c35bf5d96b214ca0d7d91ba150ee8ace5..14cd0dabacb4f31d960a5a7b14076ff4de3011d4 100644 (file)
@@ -1235,8 +1235,9 @@ ev_view_presentation_motion_notify_event (GtkWidget      *widget,
        return FALSE;
 }
 
-void ev_view_presentation_resize_cb (EvViewPresentation *pview,
-                                                                gpointer data)
+static void
+ev_view_presentation_resize_cb (EvViewPresentation *pview,
+                                                               gpointer data)
  {
        GdkScreen                  *screen = gtk_widget_get_screen (GTK_WIDGET(pview));
        GdkRectangle        monitor;
@@ -1244,8 +1245,15 @@ void ev_view_presentation_resize_cb (EvViewPresentation *pview,
 
        monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET(pview)));
        gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-       g_printf("%d %d\n",monitor.width,monitor.height);
- }
+       if(!(pview->monitor_width == monitor.width)||!(pview->monitor_height = monitor.height)) {
+               pview->monitor_width = monitor.width;
+               pview->monitor_height = monitor.height;
+
+               pview->scale = 0;
+        ev_view_presentation_reset_jobs (pview);
+        ev_view_presentation_update_current_page (pview, pview->current_page);
+       }
+}
 
 static gboolean
 init_presentation (GtkWidget *widget)
@@ -1255,9 +1263,8 @@ init_presentation (GtkWidget *widget)
        GdkRectangle        monitor;
        gint                monitor_num;
 
-       g_signal_connect_swapped(G_OBJECT(screen), "size-changed",
-        G_CALLBACK(ev_view_presentation_resize_cb),G_OBJECT(pview));
-
+       g_signal_connect_swapped(G_OBJECT(widget), "size-allocate",
+       G_CALLBACK(ev_view_presentation_resize_cb),G_OBJECT(pview));
 
        monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
        gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);