Skip to content

Commit d36034f

Browse files
committed
Use in WindowClone
1 parent 725177f commit d36034f

File tree

1 file changed

+14
-45
lines changed

1 file changed

+14
-45
lines changed

src/Widgets/WindowClone.vala

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ public class Gala.WindowClone : Clutter.Actor {
278278
var offset_x = monitor_geom.x;
279279
var offset_y = monitor_geom.y;
280280

281-
var initial_x = x;
282-
var initial_y = y;
283281
var initial_width = width;
284282
var initial_height = height;
285283

@@ -290,22 +288,20 @@ public class Gala.WindowClone : Clutter.Actor {
290288
in_slot_animation = true;
291289
place_widgets (outer_rect.width, outer_rect.height, initial_scale);
292290

291+
new PropertyGestureTransition (this, gesture_tracker, "x", null, (float) target_x, with_gesture);
292+
new PropertyGestureTransition (this, gesture_tracker, "y", null, (float) target_y, with_gesture);
293+
new PropertyGestureTransition (this, gesture_tracker, "width", null, (float) outer_rect.width, with_gesture);
294+
new PropertyGestureTransition (this, gesture_tracker, "height", null, (float) outer_rect.height, with_gesture);
295+
new PropertyGestureTransition (this, gesture_tracker, "shadow-opacity", 255f, 0f, with_gesture);
296+
new PropertyGestureTransition (window_icon, gesture_tracker, "opacity", 255f, 0f, with_gesture);
297+
293298
GestureTracker.OnUpdate on_animation_update = (percentage) => {
294-
var x = GestureTracker.animation_value (initial_x, target_x, percentage);
295-
var y = GestureTracker.animation_value (initial_y, target_y, percentage);
296299
var width = GestureTracker.animation_value (initial_width, outer_rect.width, percentage);
297300
var height = GestureTracker.animation_value (initial_height, outer_rect.height, percentage);
298301
var scale = GestureTracker.animation_value (initial_scale, target_scale, percentage);
299-
var opacity = GestureTracker.animation_value (255f, 0f, percentage);
300-
301-
set_size (width, height);
302-
set_position (x, y);
303302

304-
window_icon.opacity = (uint) opacity;
305303
set_window_icon_position (width, height, scale, false);
306304
place_widgets ((int)width, (int)height, scale);
307-
308-
shadow_opacity = (uint8) opacity;
309305
};
310306

311307
GestureTracker.OnEnd on_animation_end = (percentage, cancel_action) => {
@@ -315,27 +311,13 @@ public class Gala.WindowClone : Clutter.Actor {
315311

316312
var duration = (animate && wm.enable_animations) ? MultitaskingView.ANIMATION_DURATION : 0;
317313

318-
save_easing_state ();
319-
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
320-
set_easing_duration (duration);
321-
322-
set_position (target_x, target_y);
323-
set_size (outer_rect.width, outer_rect.height);
324-
325-
if (should_fade ()) {
326-
opacity = 0;
327-
}
328-
329-
restore_easing_state ();
330-
331314
if (animate) {
332315
toggle_shadow (false);
333316
}
334317

335318
window_icon.save_easing_state ();
336319
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
337320
window_icon.set_easing_duration (duration);
338-
window_icon.opacity = 0;
339321
set_window_icon_position (outer_rect.width, outer_rect.height, target_scale);
340322
window_icon.restore_easing_state ();
341323

@@ -367,8 +349,6 @@ public class Gala.WindowClone : Clutter.Actor {
367349
public void take_slot (Meta.Rectangle rect, bool with_gesture = false, bool is_cancel_animation = false) {
368350
#endif
369351
slot = rect;
370-
var initial_x = x;
371-
var initial_y = y;
372352
var initial_width = width;
373353
var initial_height = height;
374354

@@ -379,20 +359,18 @@ public class Gala.WindowClone : Clutter.Actor {
379359
in_slot_animation = true;
380360
place_widgets (rect.width, rect.height, scale);
381361

362+
new PropertyGestureTransition (this, gesture_tracker, "x", null, (float) rect.x, with_gesture);
363+
new PropertyGestureTransition (this, gesture_tracker, "y", null, (float) rect.y, with_gesture);
364+
new PropertyGestureTransition (this, gesture_tracker, "width", null, (float) rect.width, with_gesture);
365+
new PropertyGestureTransition (this, gesture_tracker, "height", null, (float) rect.height, with_gesture);
366+
new PropertyGestureTransition (this, gesture_tracker, "shadow-opacity", 0f, 255f, with_gesture);
367+
new PropertyGestureTransition (window_icon, gesture_tracker, "opacity", 0f, 255f, with_gesture);
368+
382369
GestureTracker.OnUpdate on_animation_update = (percentage) => {
383-
var x = GestureTracker.animation_value (initial_x, rect.x, percentage);
384-
var y = GestureTracker.animation_value (initial_y, rect.y, percentage);
385370
var width = GestureTracker.animation_value (initial_width, rect.width, percentage);
386371
var height = GestureTracker.animation_value (initial_height, rect.height, percentage);
387-
var opacity = GestureTracker.animation_value (0f, 255f, percentage);
388-
389-
set_size (width, height);
390-
set_position (x, y);
391372

392-
window_icon.opacity = (uint) opacity;
393373
set_window_icon_position (width, height, scale, false);
394-
395-
shadow_opacity = (uint8) opacity;
396374
};
397375

398376
GestureTracker.OnEnd on_animation_end = (percentage, cancel_action) => {
@@ -402,19 +380,10 @@ public class Gala.WindowClone : Clutter.Actor {
402380

403381
var duration = wm.enable_animations ? MultitaskingView.ANIMATION_DURATION : 0;
404382

405-
save_easing_state ();
406-
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
407-
set_easing_duration (duration);
408-
409-
set_size (rect.width, rect.height);
410-
set_position (rect.x, rect.y);
411-
opacity = 255;
412-
restore_easing_state ();
413383

414384
window_icon.save_easing_state ();
415385
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
416386
window_icon.set_easing_duration (duration);
417-
window_icon.opacity = 255;
418387
set_window_icon_position (rect.width, rect.height, scale);
419388
window_icon.restore_easing_state ();
420389

0 commit comments

Comments
 (0)