Skip to content

Commit 0e04bf6

Browse files
WindowClone: Hide icon in overview (#2189)
Co-authored-by: Leo <[email protected]>
1 parent 76296c2 commit 0e04bf6

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/Widgets/WindowClone.vala

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ public class Gala.WindowClone : Clutter.Actor {
165165
};
166166
close_button.triggered.connect (close_window);
167167

168-
window_icon = new WindowIcon (window, WINDOW_ICON_SIZE, (int)Math.round (monitor_scale_factor));
168+
window_icon = new WindowIcon (window, WINDOW_ICON_SIZE, (int)Math.round (monitor_scale_factor)) {
169+
visible = !overview_mode
170+
};
169171
window_icon.opacity = 0;
170172
window_icon.set_pivot_point (0.5f, 0.5f);
171173

@@ -340,6 +342,15 @@ public class Gala.WindowClone : Clutter.Actor {
340342
var close_button_alloc = InternalUtils.actor_box_from_rect (close_button_x, -close_button_height * 0.33f, close_button_width, close_button_height);
341343
close_button.allocate (close_button_alloc);
342344

345+
float window_icon_width, window_icon_height;
346+
window_icon.get_preferred_size (null, null, out window_icon_width, out window_icon_height);
347+
348+
var window_icon_x = (box.get_width () - window_icon_width) / 2;
349+
var window_icon_y = box.get_height () - (window_icon_height * 0.75f);
350+
351+
var window_icon_alloc = InternalUtils.actor_box_from_rect (window_icon_x, window_icon_y, window_icon_width, window_icon_height);
352+
window_icon.allocate (window_icon_alloc);
353+
343354
var rect = get_transformed_extents ();
344355
var monitor_index = display.get_monitor_index_for_rect (Mtk.Rectangle.from_graphene_rect (rect, ROUND));
345356
var monitor_scale = display.get_monitor_scale (monitor_index);
@@ -351,19 +362,10 @@ public class Gala.WindowClone : Clutter.Actor {
351362
var window_title_width = window_title_nat_width.clamp (0, window_title_max_width);
352363

353364
float window_title_x = (box.get_width () - window_title_width) / 2;
354-
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);
365+
float window_title_y = (window_icon.visible ? window_icon_y : box.get_height ()) - (window_title_height / 2) - InternalUtils.scale_to_int (18, monitor_scale);
355366

356367
var window_title_alloc = InternalUtils.actor_box_from_rect (window_title_x, window_title_y, window_title_width, window_title_height);
357368
window_title.allocate (window_title_alloc);
358-
359-
float window_icon_width, window_icon_height;
360-
window_icon.get_preferred_size (null, null, out window_icon_width, out window_icon_height);
361-
362-
var window_icon_x = (box.get_width () - window_icon_width) / 2;
363-
var window_icon_y = box.get_height () - (window_icon_height * 0.75f);
364-
365-
var window_icon_alloc = InternalUtils.actor_box_from_rect (window_icon_x, window_icon_y, window_icon_width, window_icon_height);
366-
window_icon.allocate (window_icon_alloc);
367369
}
368370

369371
#if HAS_MUTTER45

0 commit comments

Comments
 (0)