return FALSE;
}
-static void
-ev_view_presentation_resize_cb (EvViewPresentation *pview,
- gpointer data)
- {
+static GdkRectangle
+ev_view_presentation_get_monitor_geometry (EvViewPresentation *pview)
+{
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET(pview));
GdkRectangle monitor;
gint monitor_num;
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);
- if(!(pview->monitor_width == monitor.width)||!(pview->monitor_height = monitor.height)) {
+
+ return monitor;
+}
+
+static void
+ev_view_presentation_update_scale (EvViewPresentation *pview)
+{
+ GdkRectangle monitor = ev_view_presentation_get_monitor_geometry (pview);
+
+ 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);
+ ev_view_presentation_reset_jobs (pview);
+ ev_view_presentation_update_current_page (pview, pview->current_page);
}
}
+static void
+ev_view_presentation_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ gtk_widget_set_allocation (widget, allocation);
+ if (gtk_widget_get_realized (widget))
+ gdk_window_move_resize (gtk_widget_get_window (widget),
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+ ev_view_presentation_update_scale (EV_VIEW_PRESENTATION (widget));
+}
+
static gboolean
init_presentation (GtkWidget *widget)
{
EvViewPresentation *pview = EV_VIEW_PRESENTATION (widget);
- GdkScreen *screen = gtk_widget_get_screen (widget);
- GdkRectangle monitor;
- gint monitor_num;
+ GdkRectangle monitor = ev_view_presentation_get_monitor_geometry (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);
pview->monitor_width = monitor.width;
pview->monitor_height = monitor.height;
+ g_signal_connect_swapped (G_OBJECT (widget), "screen-changed",
+ G_CALLBACK (ev_view_presentation_update_scale), pview);
+
ev_view_presentation_update_current_page (pview, pview->current_page);
ev_view_presentation_hide_cursor_timeout_start (pview);
window);
g_idle_add ((GSourceFunc)init_presentation, widget);
-}
+ }
static void
ev_view_presentation_change_page (EvViewPresentation *pview,
gobject_class->dispose = ev_view_presentation_dispose;
+ widget_class->size_allocate = ev_view_presentation_size_allocate;
widget_class->get_preferred_width = ev_view_presentation_get_preferred_width;
widget_class->get_preferred_height = ev_view_presentation_get_preferred_height;
widget_class->realize = ev_view_presentation_realize;