Skip to content

Commit c6eb6ae

Browse files
committed
Initial support for keeping shellclients in the multitasking view
1 parent b5d774d commit c6eb6ae

File tree

10 files changed

+52
-307
lines changed

10 files changed

+52
-307
lines changed

protocol/pantheon-desktop-shell-v1.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@
9898

9999
<arg name="hide_mode" type="uint" enum="hide_mode" summary="hide mode"/>
100100
</request>
101+
102+
<request name="request_visible_in_multitasking_view">
103+
<description summary="request visible in multitasking view">
104+
Tell the shell that the panel would like to be visible in the multitasking view.
105+
</description>
106+
</request>
101107
</interface>
102108

103109
<interface name="io_elementary_pantheon_widget_v1" version="1">

protocol/pantheon-desktop-shell.vapi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace Pantheon.Desktop {
4141
public Focus focus;
4242
public SetSize set_size;
4343
public SetHideMode set_hide_mode;
44+
public RequestVisibleInMultitaskingView request_visible_in_multitasking_view;
4445
}
4546

4647
[CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "struct io_elementary_pantheon_widget_v1_interface")]
@@ -75,6 +76,8 @@ namespace Pantheon.Desktop {
7576
[CCode (has_target = false, has_typedef = false)]
7677
public delegate void SetHideMode (Wl.Client client, Wl.Resource resource, [CCode (type = "uint32_t")] HideMode hide_mode);
7778
[CCode (has_target = false, has_typedef = false)]
79+
public delegate void RequestVisibleInMultitaskingView (Wl.Client client, Wl.Resource resource);
80+
[CCode (has_target = false, has_typedef = false)]
7881
public delegate void SetKeepAbove (Wl.Client client, Wl.Resource resource);
7982
[CCode (has_target = false, has_typedef = false)]
8083
public delegate void MakeCentered (Wl.Client client, Wl.Resource resource);

src/PantheonShell.vala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ namespace Gala {
5858
focus_panel,
5959
set_size,
6060
set_hide_mode,
61+
request_visible_in_multitasking_view,
6162
};
6263

6364
wayland_pantheon_widget_interface = {
@@ -311,6 +312,23 @@ namespace Gala {
311312
ShellClientsManager.get_instance ().set_hide_mode (window, hide_mode);
312313
}
313314

315+
internal static void request_visible_in_multitasking_view (Wl.Client client, Wl.Resource resource) {
316+
unowned PanelSurface? panel_surface = resource.get_user_data<PanelSurface> ();
317+
if (panel_surface.wayland_surface == null) {
318+
warning ("Window tried to set visible in mutltiasking view but wayland surface is null.");
319+
return;
320+
}
321+
322+
Meta.Window? window;
323+
panel_surface.wayland_surface.get ("window", out window, null);
324+
if (window == null) {
325+
warning ("Window tried to set hide mode but wayland surface had no associated window.");
326+
return;
327+
}
328+
329+
ShellClientsManager.get_instance ().request_visible_in_multitasking_view (window);
330+
}
331+
314332
internal static void set_keep_above (Wl.Client client, Wl.Resource resource) {
315333
unowned ExtendedBehaviorSurface? eb_surface = resource.get_user_data<ExtendedBehaviorSurface> ();
316334
if (eb_surface.wayland_surface == null) {

src/ShellClients/ShellClientsManager.vala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
185185
panel_windows[window].hide_mode = hide_mode;
186186
}
187187

188+
public void request_visible_in_multitasking_view (Meta.Window window) {
189+
if (!(window in panel_windows)) {
190+
warning ("Set anchor for window before visible in mutltiasking view.");
191+
return;
192+
}
193+
194+
panel_windows[window].visible_in_multitasking_view = true;
195+
}
196+
188197
public void make_centered (Meta.Window window) requires (!is_itself_positioned (window)) {
189198
positioned_windows[window] = new ShellWindow (window, CENTER);
190199

src/ShellClients/ShellWindow.vala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
public class Gala.ShellWindow : PositionedWindow, GestureTarget {
99
public Clutter.Actor? actor { get { return window_actor; } }
1010

11+
public bool visible_in_multitasking_view { get; set; default = false; }
12+
1113
private Meta.WindowActor window_actor;
1214
private double custom_progress = 0;
1315
private double multitasking_view_progress = 0;
@@ -38,9 +40,16 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
3840
);
3941
}
4042

43+
private double get_hidden_progress () {
44+
if (visible_in_multitasking_view) {
45+
return double.min (custom_progress, 1 - multitasking_view_progress);
46+
} else {
47+
return double.max (custom_progress, multitasking_view_progress);
48+
}
49+
}
50+
4151
private void update_property () {
42-
var hidden_progress = double.max (custom_progress, multitasking_view_progress);
43-
property_target.propagate (UPDATE, DOCK, hidden_progress);
52+
property_target.propagate (UPDATE, DOCK, get_hidden_progress ());
4453
}
4554

4655
public override void propagate (UpdateType update_type, GestureAction action, double progress) {
@@ -82,7 +91,7 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
8291
}
8392

8493
private void update_visibility () {
85-
var visible = double.max (multitasking_view_progress, custom_progress) < 0.1;
94+
var visible = get_hidden_progress () < 0.1;
8695
var animating = animations_ongoing > 0;
8796

8897
if (!Meta.Util.is_wayland_compositor ()) {

src/Widgets/IconGroupContainer.vala

Lines changed: 0 additions & 163 deletions
This file was deleted.

src/Widgets/MultitaskingView.vala

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ namespace Gala {
3636

3737
private List<MonitorClone> window_containers_monitors;
3838

39-
private IconGroupContainer icon_groups;
4039
private ActorTarget workspaces;
4140
private Clutter.Actor primary_monitor_container;
4241
private Clutter.BrightnessContrastEffect brightness_effect;
@@ -73,8 +72,6 @@ namespace Gala {
7372
workspaces_gesture_controller.enable_touchpad ();
7473
workspaces_gesture_controller.enable_scroll (this, HORIZONTAL);
7574

76-
icon_groups = new IconGroupContainer (display.get_monitor_scale (display.get_primary_monitor ()));
77-
7875
brightness_effect = new Clutter.BrightnessContrastEffect ();
7976
update_brightness_effect ();
8077

@@ -88,7 +85,6 @@ namespace Gala {
8885
// multitasking view UI. The Clutter.Actor of this class has to be allowed to grow to the size of the
8986
// stage as it contains MonitorClones for each monitor.
9087
primary_monitor_container = new ActorTarget ();
91-
primary_monitor_container.add_child (icon_groups);
9288
primary_monitor_container.add_child (workspaces);
9389
add_child (primary_monitor_container);
9490

@@ -152,7 +148,6 @@ namespace Gala {
152148

153149
var primary_geometry = display.get_monitor_geometry (primary);
154150
var scale = display.get_monitor_scale (primary);
155-
icon_groups.scale_factor = scale;
156151

157152
primary_monitor_container.set_position (primary_geometry.x, primary_geometry.y);
158153
primary_monitor_container.set_size (primary_geometry.width, primary_geometry.height);
@@ -167,7 +162,6 @@ namespace Gala {
167162
private void update_workspaces () {
168163
foreach (unowned var child in workspaces.get_children ()) {
169164
unowned var workspace_clone = (WorkspaceClone) child;
170-
icon_groups.remove_group (workspace_clone.icon_group);
171165
workspace_clone.destroy ();
172166
}
173167

@@ -257,12 +251,8 @@ namespace Gala {
257251
}
258252

259253
if (!opened) {
260-
modal_proxy = wm.push_modal (this);
261-
modal_proxy.set_keybinding_filter (keybinding_filter);
262-
263-
var scale = display.get_monitor_scale (display.get_primary_monitor ());
264-
icon_groups.force_reposition ();
265-
icon_groups.y = primary_monitor_container.height - InternalUtils.scale_to_int (WorkspaceClone.BOTTOM_OFFSET - 20, scale);
254+
// modal_proxy = wm.push_modal (this);
255+
// modal_proxy.set_keybinding_filter (keybinding_filter);
266256
} else {
267257
DragDropAction.cancel_all_by_id ("multitaskingview-window");
268258
}
@@ -308,7 +298,7 @@ namespace Gala {
308298
wm.top_window_group.show ();
309299
hide ();
310300

311-
wm.pop_modal (modal_proxy);
301+
// wm.pop_modal (modal_proxy);
312302
}
313303
}
314304

@@ -328,32 +318,6 @@ namespace Gala {
328318
} else {
329319
workspaces_gesture_controller.progress = -manager.get_active_workspace_index ();
330320
}
331-
332-
reposition_icon_groups (animate);
333-
}
334-
335-
private void reposition_icon_groups (bool animate) {
336-
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
337-
var active_index = manager.get_active_workspace ().index ();
338-
339-
if (animate) {
340-
icon_groups.save_easing_state ();
341-
icon_groups.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
342-
icon_groups.set_easing_duration (200);
343-
}
344-
345-
var scale = display.get_monitor_scale (display.get_primary_monitor ());
346-
// make sure the active workspace's icongroup is always visible
347-
var icon_groups_width = icon_groups.calculate_total_width ();
348-
if (icon_groups_width > primary_monitor_container.width) {
349-
icon_groups.x = (-active_index * InternalUtils.scale_to_int (IconGroupContainer.SPACING + IconGroup.SIZE, scale) + primary_monitor_container.width / 2)
350-
.clamp (primary_monitor_container.width - icon_groups_width - InternalUtils.scale_to_int (64, scale), InternalUtils.scale_to_int (64, scale));
351-
} else
352-
icon_groups.x = primary_monitor_container.width / 2 - icon_groups_width / 2;
353-
354-
if (animate) {
355-
icon_groups.restore_easing_state ();
356-
}
357321
}
358322

359323
private void add_workspace (int num) {
@@ -362,7 +326,6 @@ namespace Gala {
362326

363327
var workspace = new WorkspaceClone (manager.get_workspace_by_index (num), scale);
364328
workspaces.insert_child_at_index (workspace, num);
365-
icon_groups.add_group (workspace.icon_group);
366329

367330
workspace.window_selected.connect (window_selected);
368331
workspace.selected.connect (activate_workspace);
@@ -395,10 +358,6 @@ namespace Gala {
395358
workspace.window_selected.disconnect (window_selected);
396359
workspace.selected.disconnect (activate_workspace);
397360

398-
if (icon_groups.contains (workspace.icon_group)) {
399-
icon_groups.remove_group (workspace.icon_group);
400-
}
401-
402361
workspace.destroy ();
403362

404363
update_positions (opened);

0 commit comments

Comments
 (0)