Skip to content

Commit 88c9d79

Browse files
authored
Merge branch 'main' into leolost/fix-ws-switch-crash
2 parents 0a20e8e + c164204 commit 88c9d79

File tree

6 files changed

+19
-32
lines changed

6 files changed

+19
-32
lines changed

src/ShellClients/HideTracker.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public class Gala.HideTracker : Object {
171171
continue;
172172
}
173173

174-
if (!panel.window.get_frame_rect ().overlap (window.get_frame_rect ())) {
174+
if (!panel.get_custom_window_rect ().overlap (window.get_frame_rect ())) {
175175
continue;
176176
}
177177

src/Widgets/MonitorClone.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace Gala {
102102
*/
103103
public void close (bool with_gesture = false, bool is_cancel_animation = false) {
104104
window_container.restack_windows ();
105-
window_container.close (with_gesture, is_cancel_animation);
105+
window_container.close (with_gesture);
106106
}
107107

108108
private void window_left (int window_monitor, Meta.Window window) {

src/Widgets/WindowClone.vala

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public class Gala.WindowClone : Clutter.Actor {
112112
window.notify["fullscreen"].connect (check_shadow_requirements);
113113
window.notify["maximized-horizontally"].connect (check_shadow_requirements);
114114
window.notify["maximized-vertically"].connect (check_shadow_requirements);
115+
window.size_changed.connect (() => request_reposition ());
115116

116117
if (overview_mode) {
117118
var click_action = new Clutter.ClickAction ();
@@ -183,16 +184,14 @@ public class Gala.WindowClone : Clutter.Actor {
183184
* at this point it will animate to it. Otherwise it will just place
184185
* itself at the location of the original window. Also adds the shadow
185186
* effect and makes sure the shadow is updated on size changes.
186-
*
187-
* @param was_waiting Internal argument used to indicate that we had to
188-
* wait before the window's texture became available.
189187
*/
190-
private void load_clone (bool was_waiting = false) {
188+
private void load_clone () {
191189
var actor = (Meta.WindowActor) window.get_compositor_private ();
192190
if (actor == null) {
193191
Idle.add (() => {
194-
if (window.get_compositor_private () != null)
195-
load_clone (true);
192+
if (window.get_compositor_private () != null) {
193+
load_clone ();
194+
}
196195
return Source.REMOVE;
197196
});
198197

@@ -217,18 +216,6 @@ public class Gala.WindowClone : Clutter.Actor {
217216
if (should_fade ()) {
218217
opacity = 0;
219218
}
220-
221-
// if we were waiting the view was most probably already opened when our window
222-
// finally got available. So we fade-in and make sure we took the took place.
223-
// If the slot is not available however, the view was probably closed while this
224-
// window was opened, so we stay at our old place.
225-
if (was_waiting && slot != null) {
226-
opacity = 0;
227-
take_slot (slot, true);
228-
opacity = 255;
229-
230-
request_reposition ();
231-
}
232219
}
233220

234221
private void check_shadow_requirements () {
@@ -271,7 +258,7 @@ public class Gala.WindowClone : Clutter.Actor {
271258
*
272259
* @param animate Animate the transformation of the placement
273260
*/
274-
public void transition_to_original_state (bool with_gesture = false, bool is_cancel_animation = false) {
261+
public void transition_to_original_state (bool with_gesture = false) {
275262
var outer_rect = window.get_frame_rect ();
276263

277264
unowned var display = window.get_display ();
@@ -332,9 +319,9 @@ public class Gala.WindowClone : Clutter.Actor {
332319
* Animate the window to the given slot
333320
*/
334321
#if HAS_MUTTER45
335-
public void take_slot (Mtk.Rectangle rect, bool from_window_position, bool with_gesture = false, bool is_cancel_animation = false) {
322+
public void take_slot (Mtk.Rectangle rect, bool from_window_position, bool with_gesture = false) {
336323
#else
337-
public void take_slot (Meta.Rectangle rect, bool from_window_position, bool with_gesture = false, bool is_cancel_animation = false) {
324+
public void take_slot (Meta.Rectangle rect, bool from_window_position, bool with_gesture = false) {
338325
#endif
339326
slot = rect;
340327
active = false;

src/Widgets/WindowCloneContainer.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ namespace Gala {
206206

207207
foreach (var tilable in window_positions) {
208208
unowned var clone = (WindowClone) tilable.id;
209-
clone.take_slot (tilable.rect, opening, with_gesture, is_cancel_animation);
209+
clone.take_slot (tilable.rect, opening && !is_cancel_animation, with_gesture);
210210
}
211211
}
212212

@@ -400,15 +400,15 @@ namespace Gala {
400400
* Calls the transition_to_original_state() function on each child
401401
* to make them take their original locations again.
402402
*/
403-
public void close (bool with_gesture = false, bool is_cancel_animation = false) {
403+
public void close (bool with_gesture = false) {
404404
if (!opened) {
405405
return;
406406
}
407407

408408
opened = false;
409409

410410
foreach (var window in get_children ()) {
411-
((WindowClone) window).transition_to_original_state (with_gesture, is_cancel_animation);
411+
((WindowClone) window).transition_to_original_state (with_gesture);
412412
}
413413
}
414414
}

src/Widgets/WorkspaceClone.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ namespace Gala {
369369
update_size (monitor);
370370

371371
new GesturePropertyTransition (this, gesture_tracker, "x", initial_x, target_x).start (with_gesture);
372-
new GesturePropertyTransition (background, gesture_tracker, "scale-x", 1.0d, (double) scale).start (with_gesture);
373-
new GesturePropertyTransition (background, gesture_tracker, "scale-y", 1.0d, (double) scale).start (with_gesture);
372+
new GesturePropertyTransition (background, gesture_tracker, "scale-x", null, (double) scale).start (with_gesture);
373+
new GesturePropertyTransition (background, gesture_tracker, "scale-y", null, (double) scale).start (with_gesture);
374374

375375
#if HAS_MUTTER45
376376
Mtk.Rectangle area = {
@@ -415,7 +415,7 @@ namespace Gala {
415415
new GesturePropertyTransition (background, gesture_tracker, "scale-x", null, 1.0d).start (with_gesture);
416416
new GesturePropertyTransition (background, gesture_tracker, "scale-y", null, 1.0d).start (with_gesture);
417417

418-
window_container.close (with_gesture, is_cancel_animation);
418+
window_container.close (with_gesture);
419419
}
420420
}
421421
}

src/WindowManager.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,7 +2201,6 @@ namespace Gala {
22012201
if (!animating_switch_workspace) {
22022202
return;
22032203
}
2204-
animating_switch_workspace = cancel_action;
22052204

22062205
if (switch_workspace_window_created_id > 0) {
22072206
disconnect (switch_workspace_window_created_id);
@@ -2212,6 +2211,8 @@ namespace Gala {
22122211
switch_workspace_completed ();
22132212
}
22142213

2214+
animating_switch_workspace = cancel_action;
2215+
22152216
if (cancel_action) {
22162217
var cancel_direction = (animation_direction == Meta.MotionDirection.LEFT)
22172218
? Meta.MotionDirection.RIGHT
@@ -2293,8 +2294,7 @@ namespace Gala {
22932294
}
22942295

22952296
public override void kill_switch_workspace () {
2296-
// We don't care about animation direction, we don't want to cancel it, make it nudge so that it doesn't call switch_workspace_completed ()
2297-
switch_workspace_animation_finished (LEFT, false, true);
2297+
end_switch_workspace ();
22982298
}
22992299

23002300
public override void locate_pointer () {

0 commit comments

Comments
 (0)