@@ -310,7 +310,7 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
310310
311311 var input_rect = window. get_buffer_rect ();
312312 var outer_rect = window. get_frame_rect ();
313- var clone_scale_factor = width / outer_rect. width;
313+ var clone_scale_factor = outer_rect . width != 0 ? width / outer_rect. width : 1f ;
314314
315315 // Compensate for invisible borders of the texture
316316 float clone_x = (input_rect. x - outer_rect. x) * clone_scale_factor;
@@ -327,12 +327,6 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
327327
328328 clone. set_scale (clone_scale_factor, clone_scale_factor);
329329
330- float clone_width, clone_height;
331- clone. get_preferred_size (null , null , out clone_width, out clone_height);
332-
333- var clone_alloc = InternalUtils . actor_box_from_rect (0 , 0 , clone_width, clone_height);
334- clone. allocate (clone_alloc);
335-
336330 Clutter . ActorBox shape_alloc = {
337331 - ACTIVE_SHAPE_SIZE ,
338332 - ACTIVE_SHAPE_SIZE ,
@@ -364,11 +358,12 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
364358 var monitor_index = display. get_monitor_index_for_rect (Mtk . Rectangle . from_graphene_rect (rect, ROUND ));
365359 var monitor_scale = display. get_monitor_scale (monitor_index);
366360
367- float window_title_max_width = box. get_width () - Utils . scale_to_int (TITLE_MAX_WIDTH_MARGIN , monitor_scale);
368- float window_title_height, window_title_nat_width;
369- window_title. get_preferred_size (null , null , out window_title_nat_width, out window_title_height);
361+ float window_title_min_width, window_title_nat_width, window_title_height;
362+ window_title. get_preferred_size (out window_title_min_width, null , out window_title_nat_width, out window_title_height);
363+
364+ float window_title_max_width = float . max (window_title_min_width, box. get_width () - Utils . scale_to_int (TITLE_MAX_WIDTH_MARGIN , monitor_scale));
370365
371- var window_title_width = window_title_nat_width . clamp ( 0 , window_title_max_width);
366+ var window_title_width = float . min (window_title_nat_width , window_title_max_width);
372367
373368 float window_title_x = (box. get_width () - window_title_width) / 2 ;
374369 float window_title_y = (window_icon. visible ? window_icon_y : box. get_height ()) - (window_title_height / 2 ) - Utils . scale_to_int (18 , monitor_scale);
0 commit comments