@@ -13,10 +13,10 @@ public class Gala.ShellWindow : PositionedWindow {
1313 MULTITASKING_VIEW
1414 }
1515
16- private Meta . WindowActor actor ;
16+ private const State HIDING_STATES = CUSTOM_HIDDEN | MULTITASKING_VIEW ;
1717
18- private State state = DESKTOP ;
19- private bool hidden = false ;
18+ private Meta . WindowActor actor ;
19+ private State current_state = DESKTOP ;
2020
2121 private bool gesture_ongoing = false ;
2222
@@ -29,35 +29,15 @@ public class Gala.ShellWindow : PositionedWindow {
2929 }
3030
3131 public void add_state (State state , GestureTracker gesture_tracker ) {
32- this . state |= state;
33- check_hide (gesture_tracker);
32+ animate (current_state | state, gesture_tracker);
3433 }
3534
3635 public void remove_state (State state , GestureTracker gesture_tracker ) {
37- this . state &= ~state;
38- check_hide (gesture_tracker);
39- }
40-
41- private void check_hide (GestureTracker gesture_tracker ) {
42- if (gesture_ongoing) {
43- return ;
44- }
45-
46- if (CUSTOM_HIDDEN in state) {
47- animate (true , gesture_tracker);
48- return ;
49- }
50-
51- if (MULTITASKING_VIEW in state) {
52- animate (true , gesture_tracker);
53- return ;
54- }
55-
56- animate (false , gesture_tracker);
36+ animate (current_state & ~state, gesture_tracker);
5737 }
5838
59- private void animate (bool hide , GestureTracker gesture_tracker ) {
60- if (hide == hidden ) {
39+ private void animate (State new_state , GestureTracker gesture_tracker ) {
40+ if (new_state == current_state || gesture_ongoing ) {
6141 return ;
6242 }
6343
@@ -70,11 +50,14 @@ public class Gala.ShellWindow : PositionedWindow {
7050 InternalUtils . update_transients_visible (window, false );
7151
7252 new GesturePropertyTransition (
73- actor, gesture_tracker, get_animation_property (), null , calculate_value (hide)
74- ). start (true , () = > InternalUtils . update_transients_visible (window, ! hidden));
53+ actor, gesture_tracker, get_animation_property (), null , calculate_value ((new_state & HIDING_STATES ) != 0 )
54+ ). start (true , () = > InternalUtils . update_transients_visible (window, (current_state & HIDING_STATES ) == 0 ));
55+
56+ gesture_tracker. add_success_callback (false , (percentage, completions) = > {
57+ if (completions != 0 ) {
58+ current_state = new_state;
59+ }
7560
76- gesture_tracker. add_success_callback (false , () = > {
77- hidden = hide;
7861 gesture_ongoing = false ;
7962 });
8063 }
0 commit comments