@@ -207,8 +207,6 @@ public class Gala.WindowClone : Clutter.Actor {
207207 set_child_above_sibling (window_icon, clone);
208208 set_child_above_sibling (window_title, clone);
209209
210- transition_to_original_state (false );
211-
212210 check_shadow_requirements ();
213211
214212 if (should_fade ()) {
@@ -221,7 +219,7 @@ public class Gala.WindowClone : Clutter.Actor {
221219 // window was opened, so we stay at our old place.
222220 if (was_waiting && slot != null ) {
223221 opacity = 0 ;
224- take_slot (slot);
222+ take_slot (slot, true );
225223 opacity = 255 ;
226224
227225 request_reposition ();
@@ -268,7 +266,7 @@ public class Gala.WindowClone : Clutter.Actor {
268266 *
269267 * @param animate Animate the transformation of the placement
270268 */
271- public void transition_to_original_state (bool animate , bool with_gesture = false , bool is_cancel_animation = false ) {
269+ public void transition_to_original_state (bool with_gesture = false , bool is_cancel_animation = false ) {
272270 var outer_rect = window. get_frame_rect ();
273271
274272 unowned var display = window. get_display ();
@@ -314,11 +312,9 @@ public class Gala.WindowClone : Clutter.Actor {
314312 return ;
315313 }
316314
317- var duration = (animate && wm. enable_animations) ? MultitaskingView . ANIMATION_DURATION : 0 ;
315+ var duration = wm. enable_animations ? MultitaskingView . ANIMATION_DURATION : 0 ;
318316
319- if (animate) {
320- toggle_shadow (false );
321- }
317+ toggle_shadow (false );
322318
323319 window_icon. save_easing_state ();
324320 window_icon. set_easing_mode (Clutter . AnimationMode . EASE_OUT_QUAD );
@@ -327,7 +323,7 @@ public class Gala.WindowClone : Clutter.Actor {
327323 window_icon. restore_easing_state ();
328324 };
329325
330- if (! animate || gesture_tracker == null || ! with_gesture || ! wm. enable_animations) {
326+ if (gesture_tracker == null || ! with_gesture || ! wm. enable_animations) {
331327 on_animation_end (1 , false , 0 );
332328 } else {
333329 gesture_tracker. connect_handlers (null , (owned ) on_animation_update, (owned ) on_animation_end);
@@ -338,25 +334,33 @@ public class Gala.WindowClone : Clutter.Actor {
338334 * Animate the window to the given slot
339335 */
340336#if HAS_MUTTER45
341- public void take_slot (Mtk .Rectangle rect , bool with_gesture = false , bool is_cancel_animation = false ) {
337+ public void take_slot (Mtk .Rectangle rect , bool from_window_position , bool with_gesture = false , bool is_cancel_animation = false ) {
342338#else
343- public void take_slot (Meta . Rectangle rect, bool with_gesture = false , bool is_cancel_animation = false ) {
339+ public void take_slot (Meta . Rectangle rect, bool from_window_position, bool with_gesture = false , bool is_cancel_animation = false ) {
344340#endif
345341 slot = rect;
346- var initial_width = width;
347- var initial_height = height;
342+ in_slot_animation = true ;
348343
349344 active = false ;
345+
346+ var outer_rect = window. get_frame_rect ();
347+
348+ float initial_width = from_window_position ? outer_rect. width : width;
349+ float initial_height = from_window_position ? outer_rect. height : height;
350+
350351 unowned var display = wm. get_display ();
351- var scale = display. get_monitor_scale (display. get_monitor_index_for_rect (rect));
352352
353- in_slot_animation = true ;
353+ var monitor_geom = display. get_monitor_geometry (window. get_monitor ());
354+ float intial_x = from_window_position ? outer_rect. x - monitor_geom. x : x;
355+ float intial_y = from_window_position ? outer_rect. y - monitor_geom. y : y;
356+
357+ var scale = display. get_monitor_scale (display. get_monitor_index_for_rect (rect));
354358 place_widgets (rect. width, rect. height, scale);
355359
356- new GesturePropertyTransition (this , gesture_tracker, " x" , null , (float ) rect. x). start (with_gesture);
357- new GesturePropertyTransition (this , gesture_tracker, " y" , null , (float ) rect. y). start (with_gesture);
358- new GesturePropertyTransition (this , gesture_tracker, " width" , null , (float ) rect. width). start (with_gesture);
359- new GesturePropertyTransition (this , gesture_tracker, " height" , null , (float ) rect. height). start (with_gesture);
360+ new GesturePropertyTransition (this , gesture_tracker, " x" , intial_x , (float ) rect. x). start (with_gesture);
361+ new GesturePropertyTransition (this , gesture_tracker, " y" , intial_y , (float ) rect. y). start (with_gesture);
362+ new GesturePropertyTransition (this , gesture_tracker, " width" , ( float ) initial_width , (float ) rect. width). start (with_gesture);
363+ new GesturePropertyTransition (this , gesture_tracker, " height" , ( float ) initial_height , (float ) rect. height). start (with_gesture);
360364 new GesturePropertyTransition (this , gesture_tracker, " shadow-opacity" , (uint8 ) 0 , (uint8 ) 255 ). start (with_gesture);
361365 var opacity_transition = new GesturePropertyTransition (window_icon, gesture_tracker, " opacity" , 0u , 255u );
362366 opacity_transition. start (with_gesture);
0 commit comments