@@ -437,31 +437,34 @@ public class Gala.WindowClone : Clutter.Actor {
437437 }
438438
439439 public override void allocate (Clutter . ActorBox box) {
440- var monitor_index = wm. get_display (). get_monitor_index_for_rect ({ (int ) box. get_x (), (int ) box. get_y (), (int ) box. get_width (), (int ) box. get_height ()});
441- var monitor_scale = wm. get_display (). get_monitor_scale (monitor_index);
442-
443- var input_rect = window. get_buffer_rect ();
444- var outer_rect = window. get_frame_rect ();
445- var scale_factor = width / outer_rect. width;
440+ base . allocate (box);
446441
447442 if (clone == null || (drag_action != null && drag_action. dragging)) {
448- base . allocate (box);
449443 return ;
450444 }
451445
452- clone. set_scale (scale_factor, scale_factor);
446+ var input_rect = window. get_buffer_rect ();
447+ var outer_rect = window. get_frame_rect ();
448+ var clone_scale_factor = width / outer_rect. width;
449+
450+ clone. set_scale (clone_scale_factor, clone_scale_factor);
451+
452+ float clone_width, clone_height;
453+ clone. get_preferred_size (null , null , out clone_width, out clone_height);
453454
454455 // Compensate for invisible borders of the texture
455- clone . set_position (( input_rect. x - outer_rect. x) * scale_factor,
456- (input_rect. y - outer_rect. y) * scale_factor) ;
456+ float clone_x = ( input_rect. x - outer_rect. x) * clone_scale_factor;
457+ float clone_y = (input_rect. y - outer_rect. y) * clone_scale_factor ;
457458
458- base . allocate (box);
459+ var clone_alloc = Clutter . ActorBox ();
460+ clone_alloc. init_rect (clone_x, clone_y, clone_width, clone_height);
461+ clone. allocate (clone_alloc);
459462
460463 Clutter . ActorBox shape_alloc = {
461464 - ACTIVE_SHAPE_SIZE ,
462465 - ACTIVE_SHAPE_SIZE ,
463- outer_rect . width * scale_factor + ACTIVE_SHAPE_SIZE ,
464- outer_rect . height * scale_factor + ACTIVE_SHAPE_SIZE
466+ box . get_width () + ACTIVE_SHAPE_SIZE ,
467+ box . get_height () + ACTIVE_SHAPE_SIZE
465468 };
466469 active_shape. allocate (shape_alloc);
467470
@@ -475,6 +478,9 @@ public class Gala.WindowClone : Clutter.Actor {
475478 close_button_alloc. init_rect (close_button_x, - close_button_height * 0.33f , close_button_width, close_button_height);
476479 close_button. allocate (close_button_alloc);
477480
481+ var monitor_index = wm. get_display (). get_monitor_index_for_rect ({ (int ) box. get_x (), (int ) box. get_y (), (int ) box. get_width (), (int ) box. get_height ()});
482+ var monitor_scale = wm. get_display (). get_monitor_scale (monitor_index);
483+
478484 float window_title_max_width = box. get_width () - InternalUtils . scale_to_int (TITLE_MAX_WIDTH_MARGIN , monitor_scale);
479485 float window_title_height, window_title_nat_width;
480486 window_title. get_preferred_size (null , null , out window_title_nat_width, out window_title_height);
0 commit comments