Skip to content

Commit 6e8a992

Browse files
committed
Cleanup
1 parent 83c4642 commit 6e8a992

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/Widgets/WindowClone.vala

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,6 @@ public class Gala.WindowClone : Clutter.Actor {
434434
}
435435
}
436436

437-
/**
438-
* Except for the texture clone and the highlight all children are placed
439-
* according to their given allocations. The first two are placed in a way
440-
* that compensates for invisible borders of the texture.
441-
*/
442437
public override void allocate (Clutter.ActorBox box) {
443438
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 ()});
444439
var monitor_scale = wm.get_display ().get_monitor_scale (monitor_index);
@@ -453,24 +448,13 @@ public class Gala.WindowClone : Clutter.Actor {
453448
}
454449

455450
clone.set_scale (scale_factor, scale_factor);
451+
452+
// Compensate for invisible borders of the texture
456453
clone.set_position ((input_rect.x - outer_rect.x) * scale_factor,
457454
(input_rect.y - outer_rect.y) * scale_factor);
458455

459456
base.allocate (box);
460457

461-
float window_title_max_width = box.get_width () - InternalUtils.scale_to_int (TITLE_MAX_WIDTH_MARGIN, monitor_scale);
462-
float window_title_height, window_title_nat_width;
463-
window_title.get_preferred_size (null, null, out window_title_nat_width, out window_title_height);
464-
465-
var window_title_width = float.min (window_title_nat_width, window_title_max_width);
466-
467-
float window_title_x = (box.get_width () - window_title_width) / 2;
468-
float window_title_y = box.get_height () - InternalUtils.scale_to_int (WINDOW_ICON_SIZE, monitor_scale) * 0.75f - (window_title_height / 2) - InternalUtils.scale_to_int (18, monitor_scale);
469-
470-
var window_title_alloc = Clutter.ActorBox ();
471-
window_title_alloc.init_rect (window_title_x, window_title_y, window_title_width, window_title_height);
472-
window_title.allocate (window_title_alloc);
473-
474458
Clutter.ActorBox shape_alloc = {
475459
-ACTIVE_SHAPE_SIZE,
476460
-ACTIVE_SHAPE_SIZE,
@@ -488,6 +472,19 @@ public class Gala.WindowClone : Clutter.Actor {
488472
var close_button_alloc = Clutter.ActorBox ();
489473
close_button_alloc.init_rect (close_button_x, -close_button_height * 0.33f, close_button_width, close_button_height);
490474
close_button.allocate (close_button_alloc);
475+
476+
float window_title_max_width = box.get_width () - InternalUtils.scale_to_int (TITLE_MAX_WIDTH_MARGIN, monitor_scale);
477+
float window_title_height, window_title_nat_width;
478+
window_title.get_preferred_size (null, null, out window_title_nat_width, out window_title_height);
479+
480+
var window_title_width = float.min (window_title_nat_width, window_title_max_width);
481+
482+
float window_title_x = (box.get_width () - window_title_width) / 2;
483+
float window_title_y = box.get_height () - InternalUtils.scale_to_int (WINDOW_ICON_SIZE, monitor_scale) * 0.75f - (window_title_height / 2) - InternalUtils.scale_to_int (18, monitor_scale);
484+
485+
var window_title_alloc = Clutter.ActorBox ();
486+
window_title_alloc.init_rect (window_title_x, window_title_y, window_title_width, window_title_height);
487+
window_title.allocate (window_title_alloc);
491488
}
492489

493490
#if HAS_MUTTER45

0 commit comments

Comments
 (0)