88public class Gala.ShellWindow : PositionedWindow , GestureTarget {
99 public bool restore_previous_x11_region { private get ; set ; default = false ; }
1010
11- private Meta . WindowActor window_actor;
11+ /**
12+ * A gesture target that will receive a CUSTOM update every time a gesture
13+ * is propagated, with the progress gotten via {@link get_hidden_progress()}
14+ */
15+ public GestureTarget hide_target { get ; construct set ; }
16+
1217 private double multitasking_view_progress = 0 ;
1318 private int animations_ongoing = 0 ;
1419
15- private PropertyTarget property_target;
16-
1720 public ShellWindow (Meta . Window window, Position position, Variant ? position_data = null ) {
1821 base (window, position, position_data);
1922 }
2023
21- construct {
22- window_actor = (Meta . WindowActor ) window. get_compositor_private ();
23-
24- window_actor. notify[" width" ]. connect (update_clip);
25- window_actor. notify[" height" ]. connect (update_clip);
26- window_actor. notify[" translation-y" ]. connect (update_clip);
27- notify[" position" ]. connect (update_clip);
28-
29- window. size_changed. connect (update_target);
30- notify[" position" ]. connect (update_target);
31- update_target ();
32- }
33-
34- protected virtual void update_target () {
35- property_target = new PropertyTarget (
36- CUSTOM , window_actor,
37- get_animation_property (),
38- get_property_type (),
39- calculate_value (false ),
40- calculate_value (true )
41- );
42- }
43-
4424 public virtual void propagate (UpdateType update_type, GestureAction action, double progress) {
4525 switch (update_type) {
4626 case START :
@@ -53,7 +33,7 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
5333 multitasking_view_progress = progress;
5434 }
5535
56- property_target . propagate (UPDATE , CUSTOM , get_hidden_progress ());
36+ hide_target . propagate (UPDATE , CUSTOM , get_hidden_progress ());
5737 break ;
5838
5939 case END :
@@ -71,6 +51,8 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
7151 }
7252
7353 private void update_visibility () {
54+ unowned var window_actor = (Meta . WindowActor ) window. get_compositor_private ();
55+
7456 var visible = get_hidden_progress () < 0.1 ;
7557 var animating = animations_ongoing > 0 ;
7658
@@ -104,63 +86,11 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget {
10486 return true ;
10587 }
10688
107- unowned var window_actor = (Meta . WindowActor ) transient. get_compositor_private ();
89+ unowned var transient_window_actor = (Meta . WindowActor ) transient. get_compositor_private ();
10890
109- window_actor . visible = visible && ! animating;
91+ transient_window_actor . visible = visible && ! animating;
11092
11193 return true ;
11294 });
11395 }
114-
115- private string get_animation_property () {
116- switch (position) {
117- case TOP :
118- case BOTTOM :
119- return " translation-y" ;
120- default:
121- return " opacity" ;
122- }
123- }
124-
125- private Type get_property_type () {
126- switch (position) {
127- case TOP :
128- case BOTTOM :
129- return typeof (float );
130- default:
131- return typeof (uint );
132- }
133- }
134-
135- private Value calculate_value (bool hidden ) {
136- var custom_rect = get_custom_window_rect ();
137-
138- switch (position) {
139- case TOP :
140- return hidden ? - custom_rect. height : 0f ;
141- case BOTTOM :
142- return hidden ? custom_rect. height : 0f ;
143- default:
144- return hidden ? 0u : 255u ;
145- }
146- }
147-
148- private void update_clip () {
149- if (position != TOP && position != BOTTOM ) {
150- window_actor. remove_clip ();
151- return ;
152- }
153-
154- var monitor_geom = window. display. get_monitor_geometry (window. get_monitor ());
155-
156- var y = window_actor. y + window_actor. translation_y;
157-
158- if (y + window_actor. height > monitor_geom. y + monitor_geom. height) {
159- window_actor. set_clip (0 , 0 , window_actor. width, monitor_geom. y + monitor_geom. height - y);
160- } else if (y < monitor_geom. y) {
161- window_actor. set_clip (0 , monitor_geom. y - y, window_actor. width, window_actor. height);
162- } else {
163- window_actor. remove_clip ();
164- }
165- }
16696}
0 commit comments