@@ -283,11 +283,28 @@ ev_view_presentation_transition_animation_frame (EvViewPresentation *pview,
283283 gtk_widget_queue_draw (GTK_WIDGET (pview ));
284284}
285285
286+ static cairo_surface_t *
287+ get_surface_from_job (EvViewPresentation * pview ,
288+ EvJob * job )
289+ {
290+ cairo_surface_t * surface ;
291+
292+ if (!job )
293+ return NULL ;
294+
295+ surface = EV_JOB_RENDER (job )-> surface ;
296+ if (!surface )
297+ return NULL ;
298+
299+ return surface ;
300+ }
301+
286302static void
287303ev_view_presentation_animation_start (EvViewPresentation * pview ,
288304 gint new_page )
289305{
290306 EvTransitionEffect * effect = NULL ;
307+ EvJob * job ;
291308 cairo_surface_t * surface ;
292309 gint jump ;
293310
@@ -311,11 +328,12 @@ ev_view_presentation_animation_start (EvViewPresentation *pview,
311328
312329 jump = new_page - pview -> current_page ;
313330 if (jump == -1 )
314- surface = pview -> prev_job ? EV_JOB_RENDER ( pview -> prev_job ) -> surface : NULL ;
331+ job = pview -> prev_job ;
315332 else if (jump == 1 )
316- surface = pview -> next_job ? EV_JOB_RENDER ( pview -> next_job ) -> surface : NULL ;
333+ job = pview -> next_job ;
317334 else
318- surface = NULL ;
335+ job = NULL ;
336+ surface = get_surface_from_job (pview , job );
319337 if (surface )
320338 ev_transition_animation_set_dest_surface (pview -> animation , surface );
321339
@@ -342,7 +360,7 @@ job_finished_cb (EvJob *job,
342360
343361 if (pview -> animation ) {
344362 ev_transition_animation_set_dest_surface (pview -> animation ,
345- job_render -> surface );
363+ get_surface_from_job ( pview , job ) );
346364 } else {
347365 ev_view_presentation_transition_start (pview );
348366 gtk_widget_queue_draw (GTK_WIDGET (pview ));
@@ -1064,7 +1082,7 @@ ev_view_presentation_draw (GtkWidget *widget,
10641082 return TRUE;
10651083 }
10661084
1067- surface = pview -> curr_job ? EV_JOB_RENDER (pview -> curr_job )-> surface : NULL ;
1085+ surface = get_surface_from_job (pview , pview -> curr_job );
10681086 if (surface ) {
10691087 ev_view_presentation_update_current_surface (pview , surface );
10701088 } else if (pview -> current_surface ) {
@@ -1212,19 +1230,25 @@ ev_view_presentation_motion_notify_event (GtkWidget *widget,
12121230 return FALSE;
12131231}
12141232
1215- static gboolean
1216- init_presentation ( GtkWidget * widget )
1233+ static void
1234+ ev_view_presentation_update_monitor_geometry ( EvViewPresentation * pview )
12171235{
1218- EvViewPresentation * pview = EV_VIEW_PRESENTATION (widget );
1219- GdkDisplay * display = gtk_widget_get_display (widget );
1236+ GdkScreen * screen = gtk_widget_get_screen (GTK_WIDGET (pview ));
12201237 GdkRectangle monitor ;
1221- GdkMonitor * monitor_num ;
1222-
1223- monitor_num = gdk_display_get_monitor_at_window (display , gtk_widget_get_window (widget ));
1224- gdk_monitor_get_geometry (monitor_num , & monitor );
1238+ gint monitor_num ;
12251239
1240+ monitor_num = gdk_screen_get_monitor_at_window (screen , gtk_widget_get_window (GTK_WIDGET (pview )));
1241+ gdk_screen_get_monitor_geometry (screen , monitor_num , & monitor );
12261242 pview -> monitor_width = monitor .width ;
12271243 pview -> monitor_height = monitor .height ;
1244+ }
1245+
1246+ static gboolean
1247+ init_presentation (GtkWidget * widget )
1248+ {
1249+ EvViewPresentation * pview = EV_VIEW_PRESENTATION (widget );
1250+
1251+ ev_view_presentation_update_monitor_geometry (pview );
12281252
12291253 ev_view_presentation_update_current_page (pview , pview -> current_page );
12301254 ev_view_presentation_hide_cursor_timeout_start (pview );
@@ -1378,6 +1402,14 @@ ev_view_presentation_get_property (GObject *object,
13781402 }
13791403}
13801404
1405+ static void
1406+ ev_view_presentation_notify_scale_factor (EvViewPresentation * pview )
1407+ {
1408+ ev_view_presentation_update_monitor_geometry (pview );
1409+ ev_view_presentation_reset_jobs (pview );
1410+ ev_view_presentation_update_current_page (pview , pview -> current_page );
1411+ }
1412+
13811413static GObject *
13821414ev_view_presentation_constructor (GType type ,
13831415 guint n_construct_properties ,
@@ -1397,6 +1429,9 @@ ev_view_presentation_constructor (GType type,
13971429 ev_page_cache_set_flags (pview -> page_cache , EV_PAGE_DATA_INCLUDE_LINKS );
13981430 }
13991431
1432+ g_signal_connect (object , "notify::scale-factor" ,
1433+ G_CALLBACK (ev_view_presentation_notify_scale_factor ), NULL );
1434+
14001435 return object ;
14011436}
14021437
0 commit comments