Skip to content

Commit 779c036

Browse files
committed
Merge branch 'main' into leolost/window-list-model-full
2 parents 450dc8d + 64ad306 commit 779c036

File tree

10 files changed

+44
-56
lines changed

10 files changed

+44
-56
lines changed

lib/Gestures/ActorTarget.vala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
* If a new child (or target via {@link add_target}) is added, its progress will be synced.
1212
*/
1313
public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
14-
public Clutter.Actor? actor {
15-
get {
16-
return this;
17-
}
18-
}
19-
2014
public bool animating { get { return ongoing_animations > 0; } }
2115

2216
private double[] current_progress;

lib/Gestures/GestureTarget.vala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,5 @@ public interface Gala.GestureTarget : Object {
1313
END
1414
}
1515

16-
/**
17-
* The actor manipulated by the gesture. The associated frame clock
18-
* will be used for animation timelines.
19-
*/
20-
public abstract Clutter.Actor? actor { get; }
21-
2216
public virtual void propagate (UpdateType update_type, GestureAction action, double progress) { }
2317
}

lib/Gestures/PropertyTarget.vala

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,34 @@
77

88
public class Gala.PropertyTarget : Object, GestureTarget {
99
public GestureAction action { get; construct; }
10-
11-
//we don't want to hold a strong reference to the actor because we might've been added to it which would form a reference cycle
12-
private weak Clutter.Actor? _actor;
13-
public Clutter.Actor? actor { get { return _actor; } }
14-
10+
// Don't take a reference since we are most of the time owned by the target
11+
public weak Object? target { get; private set; }
1512
public string property { get; construct; }
1613

1714
public Clutter.Interval interval { get; construct; }
1815

19-
public PropertyTarget (GestureAction action, Clutter.Actor actor, string property, Type value_type, Value from_value, Value to_value) {
16+
public PropertyTarget (GestureAction action, Object target, string property, Type value_type, Value from_value, Value to_value) {
2017
Object (action: action, property: property, interval: new Clutter.Interval.with_values (value_type, from_value, to_value));
2118

22-
_actor = actor;
23-
_actor.destroy.connect (() => _actor = null);
19+
this.target = target;
20+
this.target.weak_ref (on_target_disposed);
21+
}
22+
23+
~PropertyTarget () {
24+
if (target != null) {
25+
target.weak_unref (on_target_disposed);
26+
}
27+
}
28+
29+
private void on_target_disposed () {
30+
target = null;
2431
}
2532

2633
public override void propagate (UpdateType update_type, GestureAction action, double progress) {
27-
if (update_type != UPDATE || action != this.action) {
34+
if (target == null || update_type != UPDATE || action != this.action) {
2835
return;
2936
}
3037

31-
actor.set_property (property, interval.compute (progress));
38+
target.set_property (property, interval.compute (progress));
3239
}
3340
}

lib/Gestures/RootTarget.vala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
*/
77

88
public interface Gala.RootTarget : Object, GestureTarget {
9+
/**
10+
* The actor manipulated by the gesture. The associated frame clock
11+
* will be used for animation timelines.
12+
*/
13+
public abstract Clutter.Actor? actor { get; }
14+
915
public void add_gesture_controller (GestureController controller) requires (controller.target == null) {
1016
controller.attached (this);
1117
weak_ref (controller.detached);

src/ShellClients/PanelWindow.vala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
public class Gala.PanelWindow : ShellWindow, RootTarget {
99
private static HashTable<Meta.Window, Meta.Strut?> window_struts = new HashTable<Meta.Window, Meta.Strut?> (null, null);
1010

11+
public Clutter.Actor? actor { get { return (Clutter.Actor) window.get_compositor_private (); } }
1112
public WindowManager wm { get; construct; }
1213
public Pantheon.Desktop.Anchor anchor { get; construct set; }
1314

@@ -26,6 +27,8 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
2627
}
2728
}
2829

30+
public bool visible_in_multitasking_view { get; private set; default = false; }
31+
2932
private GestureController gesture_controller;
3033
private HideTracker hide_tracker;
3134

@@ -64,6 +67,14 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
6467
actor.add_action (new DragDropAction (DESTINATION, "multitaskingview-window"));
6568
}
6669

70+
protected override double get_hidden_progress () {
71+
if (visible_in_multitasking_view) {
72+
return double.min (gesture_controller.progress, 1 - base.get_hidden_progress ());
73+
} else {
74+
return double.max (gesture_controller.progress, base.get_hidden_progress ());
75+
}
76+
}
77+
6778
private void hide () {
6879
gesture_controller.goto (1);
6980
}

src/ShellClients/ShellClientsManager.vala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
2020
return instance;
2121
}
2222

23-
public Clutter.Actor? actor { get { return wm.stage; } }
24-
2523
public WindowManager wm { get; construct; }
2624

2725
private NotificationsClient notifications_client;

src/ShellClients/ShellWindow.vala

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
*/
77

88
public class Gala.ShellWindow : PositionedWindow, GestureTarget {
9-
public Clutter.Actor? actor { get { return window_actor; } }
109
public bool restore_previous_x11_region { private get; set; default = false; }
11-
public bool visible_in_multitasking_view { get; set; default = false; }
1210

1311
private Meta.WindowActor window_actor;
14-
private double custom_progress = 0;
1512
private double multitasking_view_progress = 0;
16-
1713
private int animations_ongoing = 0;
1814

1915
private PropertyTarget property_target;
@@ -45,18 +41,6 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
4541
);
4642
}
4743

48-
private double get_hidden_progress () {
49-
if (visible_in_multitasking_view) {
50-
return double.min (custom_progress, 1 - multitasking_view_progress);
51-
} else {
52-
return double.max (custom_progress, multitasking_view_progress);
53-
}
54-
}
55-
56-
private void update_property () {
57-
property_target.propagate (UPDATE, CUSTOM, get_hidden_progress ());
58-
}
59-
6044
public override void propagate (UpdateType update_type, GestureAction action, double progress) {
6145
switch (update_type) {
6246
case START:
@@ -65,7 +49,11 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
6549
break;
6650

6751
case UPDATE:
68-
on_update (action, progress);
52+
if (action == MULTITASKING_VIEW) {
53+
multitasking_view_progress = progress;
54+
}
55+
56+
property_target.propagate (UPDATE, CUSTOM, get_hidden_progress ());
6957
break;
7058

7159
case END:
@@ -78,21 +66,8 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
7866
}
7967
}
8068

81-
private void on_update (GestureAction action, double progress) {
82-
switch (action) {
83-
case MULTITASKING_VIEW:
84-
multitasking_view_progress = progress;
85-
break;
86-
87-
case CUSTOM:
88-
custom_progress = progress;
89-
break;
90-
91-
default:
92-
break;
93-
}
94-
95-
update_property ();
69+
protected virtual double get_hidden_progress () {
70+
return multitasking_view_progress;
9671
}
9772

9873
private void update_visibility () {

src/Widgets/MultitaskingView/MultitaskingView.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
2626
private GestureController workspaces_gesture_controller;
2727
private GestureController multitasking_gesture_controller;
2828

29+
public Clutter.Actor? actor { get { return this; } }
2930
public WindowManagerGala wm { get; construct; }
3031

3132
private Meta.Display display;

src/Widgets/MultitaskingView/WindowClone.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
2727
*/
2828
public signal void request_reposition ();
2929

30+
public Clutter.Actor? actor { get { return this; } }
3031
public WindowManager wm { get; construct; }
3132
public Meta.Window window { get; construct; }
3233

src/Widgets/WindowOverview.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class Gala.WindowOverview : ActorTarget, RootTarget, ActivatableComponent
1010
private const int TOP_GAP = 30;
1111
private const int BOTTOM_GAP = 100;
1212

13+
public Clutter.Actor? actor { get { return this; } }
1314
public WindowManager wm { get; construct; }
1415

1516
private GestureController gesture_controller; // Currently not used for actual touchpad gestures but only as controller

0 commit comments

Comments
 (0)