Skip to content

Commit 08761fd

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 a35fbc2 commit 08761fd

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

src/Widgets/MultitaskingView/WindowCloneContainer.vala

Lines changed: 1 addition & 13 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; }
@@ -40,8 +37,6 @@ public class Gala.WindowCloneContainer : ActorTarget {
4037
on_items_changed (0, 0, windows.get_n_items ());
4138
windows.items_changed.connect (on_items_changed);
4239

43-
clip_to_allocation = true;
44-
4540
set_relayout_action (MULTITASKING_VIEW, true);
4641
set_relayout_action (SWITCH_WORKSPACE, true);
4742
}
@@ -148,13 +143,6 @@ public class Gala.WindowCloneContainer : ActorTarget {
148143
return (int) (seq_b - seq_a);
149144
});
150145

151-
Mtk.Rectangle area = {
152-
padding_left,
153-
padding_top,
154-
(int) width - padding_left - padding_right,
155-
(int) height - padding_top - padding_bottom
156-
};
157-
158146
target_allocations.remove_all ();
159147
origin_allocations.remove_all ();
160148
foreach (var tilable in calculate_grid_placement (area, windows)) {

src/Widgets/MultitaskingView/WorkspaceClone.vala

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ public class Gala.WorkspaceClone : ActorTarget {
167167
}
168168
});
169169

170+
clip_to_allocation = true;
171+
170172
add_child (background);
171173
add_child (window_container);
172174

@@ -200,18 +202,31 @@ public class Gala.WorkspaceClone : ActorTarget {
200202

201203
var scale = (float)(monitor.height - Utils.scale_to_int (TOP_OFFSET + BOTTOM_OFFSET, monitor_scale)) / monitor.height;
202204
var pivot_y = Utils.scale_to_int (TOP_OFFSET, monitor_scale) / (monitor.height - monitor.height * scale);
203-
background.set_pivot_point (0.5f, pivot_y);
205+
background.set_pivot_point (0f, pivot_y);
204206

205207
var initial_width = monitor.width;
206-
var target_width = monitor.width * scale + WorkspaceRow.WORKSPACE_GAP * 2;
208+
var target_width = monitor.width * scale;
209+
210+
var target_height = monitor.height * scale;
207211

208-
add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width, (float) target_width));
212+
add_target (new PropertyTarget (MULTITASKING_VIEW, window_container, "width", typeof (float), (float) target_height, (float) target_width));
213+
add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width + WorkspaceRow.WORKSPACE_GAP, (float) target_width + WorkspaceRow.WORKSPACE_GAP));
209214
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-x", typeof (double), 1d, (double) scale));
210215
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-y", typeof (double), 1d, (double) scale));
211216

212-
window_container.padding_top = Utils.scale_to_int (TOP_OFFSET, monitor_scale);
213-
window_container.padding_left = window_container.padding_right = (int) (monitor.width - monitor.width * scale) / 2;
214-
window_container.padding_bottom = Utils.scale_to_int (BOTTOM_OFFSET, monitor_scale);
217+
background.x = WorkspaceRow.WORKSPACE_GAP / 2;
218+
window_container.x = WorkspaceRow.WORKSPACE_GAP / 2;
219+
220+
window_container.area = {
221+
12,
222+
Utils.scale_to_int (TOP_OFFSET, monitor_scale),
223+
(int) (target_width - 24),
224+
(int) target_height
225+
};
226+
}
227+
228+
public override void update_progress (GestureAction action, double progress) {
229+
// background.set_pivot_point (0.5f, 0f);
215230
}
216231

217232
private void activate (bool close_view) {

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)