Skip to content

Commit

Permalink
Merge branch 'main' into leolost/overshoot-gestures
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 authored Dec 13, 2024
2 parents 6e1db4b + c164204 commit ab8b085
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class Gala.HideTracker : Object {
continue;
}

if (!panel.window.get_frame_rect ().overlap (window.get_frame_rect ())) {
if (!panel.get_custom_window_rect ().overlap (window.get_frame_rect ())) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/MonitorClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace Gala {
*/
public void close (bool with_gesture = false, bool is_cancel_animation = false) {
window_container.restack_windows ();
window_container.close (with_gesture, is_cancel_animation);
window_container.close (with_gesture);
}

private void window_left (int window_monitor, Meta.Window window) {
Expand Down
29 changes: 8 additions & 21 deletions src/Widgets/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public class Gala.WindowClone : Clutter.Actor {
window.notify["fullscreen"].connect (check_shadow_requirements);
window.notify["maximized-horizontally"].connect (check_shadow_requirements);
window.notify["maximized-vertically"].connect (check_shadow_requirements);
window.size_changed.connect (() => request_reposition ());

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

Expand All @@ -217,18 +216,6 @@ public class Gala.WindowClone : Clutter.Actor {
if (should_fade ()) {
opacity = 0;
}

// if we were waiting the view was most probably already opened when our window
// finally got available. So we fade-in and make sure we took the took place.
// If the slot is not available however, the view was probably closed while this
// window was opened, so we stay at our old place.
if (was_waiting && slot != null) {
opacity = 0;
take_slot (slot, true);
opacity = 255;

request_reposition ();
}
}

private void check_shadow_requirements () {
Expand Down Expand Up @@ -271,7 +258,7 @@ public class Gala.WindowClone : Clutter.Actor {
*
* @param animate Animate the transformation of the placement
*/
public void transition_to_original_state (bool with_gesture = false, bool is_cancel_animation = false) {
public void transition_to_original_state (bool with_gesture = false) {
var outer_rect = window.get_frame_rect ();

unowned var display = window.get_display ();
Expand Down Expand Up @@ -332,9 +319,9 @@ public class Gala.WindowClone : Clutter.Actor {
* Animate the window to the given slot
*/
#if HAS_MUTTER45
public void take_slot (Mtk.Rectangle rect, bool from_window_position, bool with_gesture = false, bool is_cancel_animation = false) {
public void take_slot (Mtk.Rectangle rect, bool from_window_position, bool with_gesture = false) {
#else
public void take_slot (Meta.Rectangle rect, bool from_window_position, bool with_gesture = false, bool is_cancel_animation = false) {
public void take_slot (Meta.Rectangle rect, bool from_window_position, bool with_gesture = false) {
#endif
slot = rect;
active = false;
Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/WindowCloneContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ namespace Gala {

foreach (var tilable in window_positions) {
unowned var clone = (WindowClone) tilable.id;
clone.take_slot (tilable.rect, opening, with_gesture, is_cancel_animation);
clone.take_slot (tilable.rect, opening && !is_cancel_animation, with_gesture);
}
}

Expand Down Expand Up @@ -400,15 +400,15 @@ namespace Gala {
* Calls the transition_to_original_state() function on each child
* to make them take their original locations again.
*/
public void close (bool with_gesture = false, bool is_cancel_animation = false) {
public void close (bool with_gesture = false) {
if (!opened) {
return;
}

opened = false;

foreach (var window in get_children ()) {
((WindowClone) window).transition_to_original_state (with_gesture, is_cancel_animation);
((WindowClone) window).transition_to_original_state (with_gesture);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/WorkspaceClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ namespace Gala {
update_size (monitor);

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

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

window_container.close (with_gesture, is_cancel_animation);
window_container.close (with_gesture);
}
}
}
6 changes: 3 additions & 3 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2201,7 +2201,6 @@ namespace Gala {
if (!animating_switch_workspace) {
return;
}
animating_switch_workspace = cancel_action;

if (switch_workspace_window_created_id > 0) {
disconnect (switch_workspace_window_created_id);
Expand All @@ -2212,6 +2211,8 @@ namespace Gala {
switch_workspace_completed ();
}

animating_switch_workspace = cancel_action;

if (cancel_action) {
var cancel_direction = (animation_direction == Meta.MotionDirection.LEFT)
? Meta.MotionDirection.RIGHT
Expand Down Expand Up @@ -2293,8 +2294,7 @@ namespace Gala {
}

public override void kill_switch_workspace () {
// 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 ()
switch_workspace_animation_finished (LEFT, false, true);
end_switch_workspace ();
}

public override void locate_pointer () {
Expand Down

0 comments on commit ab8b085

Please sign in to comment.