Revert "Merge branch 'lenemter/windowclone-fix-mem-leak' into lenemter/rework-multitasking-view"

This reverts commit 953c896a68, reversing
changes made to 03f77af00d.
This commit is contained in:
lenemter 2024-07-08 13:58:52 +09:00
parent 416ee50c8d
commit 3341fa9ce9
2 changed files with 25 additions and 27 deletions

View File

@ -35,9 +35,9 @@ public class Gala.WindowClone : Clutter.Actor {
* The currently assigned slot of the window in the tiling layout. May be null.
*/
#if HAS_MUTTER45
public Mtk.Rectangle? slot { get; set; default = null; }
public Mtk.Rectangle? slot { get; private set; default = null; }
#else
public Meta.Rectangle? slot { get; set; default = null; }
public Meta.Rectangle? slot { get; private set; default = null; }
#endif
/**
@ -113,8 +113,8 @@ public class Gala.WindowClone : Clutter.Actor {
if (overview_mode) {
var click_action = new Clutter.ClickAction ();
click_action.clicked.connect ((_click_action, actor) => {
actor_clicked (_click_action.get_button ());
click_action.clicked.connect (() => {
actor_clicked (click_action.get_button ());
});
add_action (click_action);
@ -300,14 +300,11 @@ public class Gala.WindowClone : Clutter.Actor {
set_window_icon_position (outer_rect.width, outer_rect.height, target_scale);
window_icon.restore_easing_state ();
unowned var transition = window_icon.get_transition ("opacity");
var transition = window_icon.get_transition ("opacity");
if (transition != null) {
transition.completed.connect (() => {
var _outer_rect = window.get_frame_rect ();
var _target_scale = window.get_display ().get_monitor_scale (window.get_monitor ());
in_slot_animation = false;
place_widgets (_outer_rect.width, _outer_rect.height, _target_scale);
place_widgets (outer_rect.width, outer_rect.height, target_scale);
});
} else {
in_slot_animation = false;
@ -325,7 +322,12 @@ public class Gala.WindowClone : Clutter.Actor {
/**
* Animate the window to the given slot
*/
public void take_slot (bool with_gesture = false, bool is_cancel_animation = false) requires (slot != null) {
#if HAS_MUTTER45
public void take_slot (Mtk.Rectangle rect, bool with_gesture = false, bool is_cancel_animation = false) {
#else
public void take_slot (Meta.Rectangle rect, bool with_gesture = false, bool is_cancel_animation = false) {
#endif
slot = rect;
var initial_x = x;
var initial_y = y;
var initial_width = width;
@ -333,16 +335,16 @@ public class Gala.WindowClone : Clutter.Actor {
active = false;
unowned var display = wm.get_display ();
var scale = display.get_monitor_scale (display.get_monitor_index_for_rect (slot));
var scale = display.get_monitor_scale (display.get_monitor_index_for_rect (rect));
in_slot_animation = true;
place_widgets (slot.width, slot.height, scale);
place_widgets (rect.width, rect.height, scale);
GestureTracker.OnUpdate on_animation_update = (percentage) => {
var x = GestureTracker.animation_value (initial_x, slot.x, percentage);
var y = GestureTracker.animation_value (initial_y, slot.y, percentage);
var width = GestureTracker.animation_value (initial_width, slot.width, percentage);
var height = GestureTracker.animation_value (initial_height, slot.height, percentage);
var x = GestureTracker.animation_value (initial_x, rect.x, percentage);
var y = GestureTracker.animation_value (initial_y, rect.y, percentage);
var width = GestureTracker.animation_value (initial_width, rect.width, percentage);
var height = GestureTracker.animation_value (initial_height, rect.height, percentage);
var opacity = GestureTracker.animation_value (0f, 255f, percentage);
set_size (width, height);
@ -365,8 +367,8 @@ public class Gala.WindowClone : Clutter.Actor {
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
set_easing_duration (duration);
set_size (slot.width, slot.height);
set_position (slot.x, slot.y);
set_size (rect.width, rect.height);
set_position (rect.x, rect.y);
opacity = 255;
restore_easing_state ();
@ -374,23 +376,20 @@ public class Gala.WindowClone : Clutter.Actor {
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
window_icon.set_easing_duration (duration);
window_icon.opacity = 255;
set_window_icon_position (slot.width, slot.height, scale);
set_window_icon_position (rect.width, rect.height, scale);
window_icon.restore_easing_state ();
toggle_shadow (true);
unowned var transition = window_icon.get_transition ("opacity");
var transition = window_icon.get_transition ("opacity");
if (transition != null) {
transition.completed.connect (() => {
unowned var _display = wm.get_display ();
var _scale = _display.get_monitor_scale (_display.get_monitor_index_for_rect (slot));
in_slot_animation = false;
place_widgets (slot.width, slot.height, _scale);
place_widgets (rect.width, rect.height, scale);
});
} else {
in_slot_animation = false;
place_widgets (slot.width, slot.height, scale);
place_widgets (rect.width, rect.height, scale);
}
};

View File

@ -196,8 +196,7 @@ namespace Gala {
foreach (unowned var tilable in window_positions) {
unowned var clone = (WindowClone) tilable.id;
clone.slot = tilable.rect;
clone.take_slot (with_gesture, is_cancel_animation);
clone.take_slot (tilable.rect, with_gesture, is_cancel_animation);
}
}