@@ -550,7 +550,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
550550 MetaX11ScaleMode scale_mode = meta_settings_get_x11_scale_mode (settings );
551551 unsigned i , valid_crtcs ;
552552 GList * l ;
553- int width , height ;
553+ int width , height , scaled_width , scaled_height ;
554554 float max_scale ;
555555 float avg_screen_scale ;
556556 gboolean have_scaling ;
@@ -563,6 +563,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
563563 /* Compute the new size of the screen (framebuffer) */
564564 max_scale = get_maximum_crtc_info_scale (crtcs , n_crtcs );
565565 width = 0 ; height = 0 ;
566+ scaled_width = 0 ; scaled_height = 0 ;
566567 avg_screen_scale = 0 ;
567568 valid_crtcs = 0 ;
568569 for (i = 0 ; i < n_crtcs ; i ++ )
@@ -578,6 +579,13 @@ apply_crtc_assignments (MetaMonitorManager *manager,
578579
579580 if (have_scaling && scale_mode == META_X11_SCALE_MODE_UI_DOWN )
580581 scale = (ceilf (max_scale ) / crtc_info -> scale ) * crtc_info -> scale ;
582+ else
583+ {
584+ scaled_width = MAX (scaled_width , crtc_info -> layout .origin .x +
585+ crtc_info -> layout .size .width * crtc_info -> scale );
586+ scaled_height = MAX (scaled_height , crtc_info -> layout .origin .y +
587+ crtc_info -> layout .size .height * crtc_info -> scale );
588+ }
581589
582590 width = MAX (width , (int ) roundf (crtc_info -> layout .origin .x +
583591 crtc_info -> layout .size .width * scale ));
@@ -609,7 +617,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
609617 y2 = (int ) roundf (crtc_config -> layout .origin .y +
610618 crtc_config -> layout .size .height );
611619
612- if (!crtc_info -> mode || x2 > width || y2 > height )
620+ if (!crtc_info -> mode || width < scaled_width || height < scaled_height || x2 > width || y2 > height )
613621 {
614622 xrandr_set_crtc_config (manager_xrandr ,
615623 crtc ,
0 commit comments