Skip to content

Commit ceae97f

Browse files
committed
Rework workspace clone layouting
This will allow the window clone containers to allocate static windows in their allocation which is required to make the stacking of static windows correct.
1 parent c900aba commit ceae97f

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

src/Widgets/MultitaskingView/WindowCloneContainer.vala

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ public class Gala.WindowCloneContainer : ActorTarget {
1111
public signal void window_selected (Meta.Window window);
1212
public signal void requested_close ();
1313

14-
public int padding_top { get; set; default = 12; }
15-
public int padding_left { get; set; default = 12; }
16-
public int padding_right { get; set; default = 12; }
17-
public int padding_bottom { get; set; default = 12; }
14+
public Mtk.Rectangle area { get; set; }
1815

1916
public WindowManager wm { get; construct; }
2017
public WindowListModel windows { get; construct; }
@@ -140,13 +137,6 @@ public class Gala.WindowCloneContainer : ActorTarget {
140137
return (int) (seq_b - seq_a);
141138
});
142139

143-
Mtk.Rectangle area = {
144-
padding_left,
145-
padding_top,
146-
(int) width - padding_left - padding_right,
147-
(int) height - padding_top - padding_bottom
148-
};
149-
150140
foreach (var tilable in calculate_grid_placement (area, windows)) {
151141
tilable.clone.take_slot (tilable.rect, !view_toggle);
152142
}

src/Widgets/MultitaskingView/WorkspaceClone.vala

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ public class Gala.WorkspaceClone : ActorTarget {
183183
}
184184
});
185185

186+
clip_to_allocation = true;
187+
186188
add_child (background);
187189
add_child (window_container);
188190

@@ -234,18 +236,27 @@ public class Gala.WorkspaceClone : ActorTarget {
234236

235237
var scale = (float)(monitor.height - Utils.scale_to_int (TOP_OFFSET + BOTTOM_OFFSET, monitor_scale)) / monitor.height;
236238
var pivot_y = Utils.scale_to_int (TOP_OFFSET, monitor_scale) / (monitor.height - monitor.height * scale);
237-
background.set_pivot_point (0.5f, pivot_y);
239+
background.set_pivot_point (0f, pivot_y);
238240

239241
var initial_width = monitor.width;
240-
var target_width = monitor.width * scale + WorkspaceRow.WORKSPACE_GAP * 2;
242+
var target_width = monitor.width * scale;
243+
244+
var target_height = monitor.height * scale;
241245

242-
add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width, (float) target_width));
246+
add_target (new PropertyTarget (MULTITASKING_VIEW, window_container, "width", typeof (float), (float) initial_width, (float) target_width));
247+
add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width + WorkspaceRow.WORKSPACE_GAP, (float) target_width + WorkspaceRow.WORKSPACE_GAP));
243248
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-x", typeof (double), 1d, (double) scale));
244249
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-y", typeof (double), 1d, (double) scale));
245250

246-
window_container.padding_top = Utils.scale_to_int (TOP_OFFSET, monitor_scale);
247-
window_container.padding_left = window_container.padding_right = (int) (monitor.width - monitor.width * scale) / 2;
248-
window_container.padding_bottom = Utils.scale_to_int (BOTTOM_OFFSET, monitor_scale);
251+
background.x = WorkspaceRow.WORKSPACE_GAP / 2;
252+
window_container.x = WorkspaceRow.WORKSPACE_GAP / 2;
253+
254+
window_container.area = {
255+
12,
256+
Utils.scale_to_int (TOP_OFFSET, monitor_scale),
257+
(int) (target_width - 24),
258+
(int) target_height
259+
};
249260
}
250261

251262
#if OLD_ICON_GROUPS

src/Widgets/MultitaskingView/WorkspaceRow.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ public class Gala.WorkspaceRow : ActorTarget {
2323
set_allocation (allocation);
2424

2525
double progress = get_current_progress (SWITCH_WORKSPACE);
26+
var monitor_width = display.get_monitor_geometry (display.get_primary_monitor ()).width;
2627
int index = 0;
2728
for (var child = get_first_child (); child != null; child = child.get_next_sibling ()) {
2829
float preferred_width;
2930
child.get_preferred_width (-1, null, out preferred_width);
3031

31-
var child_x = (float) Math.round ((progress + index) * (preferred_width + WORKSPACE_GAP));
32+
var child_x = (float) Math.round ((progress + index) * preferred_width + (monitor_width - preferred_width) / 2);
3233

3334
child.allocate_preferred_size (child_x, 0);
3435

src/Widgets/WindowOverview.vala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
120120
model.items_changed.connect (on_items_changed);
121121

122122
window_clone_container = new WindowCloneContainer (wm, model, scale, true) {
123-
padding_top = TOP_GAP,
124-
padding_left = BORDER,
125-
padding_right = BORDER,
126-
padding_bottom = BOTTOM_GAP,
123+
area = { BORDER, TOP_GAP, geometry.width - 2 * BORDER, geometry.height - TOP_GAP - BOTTOM_GAP },
127124
width = geometry.width,
128125
height = geometry.height,
129126
x = geometry.x,

0 commit comments

Comments
 (0)