@@ -81,48 +81,18 @@ namespace Gala {
8181 * the stage, which means your actors, instead of the windows.
8282 *
8383 * It is calculated by the system whenever update_region is called.
84- * You can influce it with the custom_region and the track_actor function.
84+ * You can influence it with the track_actor function.
8585 */
8686 private Mtk . Rectangle [] region;
8787 public unowned Mtk .Rectangle [] get_region () {
8888 return region;
8989 }
90- /**
91- * This list will be merged with the region property. See region for
92- * more details. Changing this property will cause update_region to be
93- * called. Default to null.
94- */
95- private Mtk . Rectangle []? _custom_region = null ;
96- protected unowned Mtk .Rectangle []? get_custom_region () {
97- return _custom_region;
98- }
99- protected void set_custom_region (Mtk .Rectangle []? custom_region ) {
100- _custom_region = custom_region;
101- update_region ();
102- }
103- /**
104- * Set this property to true while animating an actor if you have tracked
105- * actors to prevent constant recalculations of the regions during an
106- * animation.
107- */
108- protected bool freeze_track {
109- get {
110- return _freeze_track;
111- }
112- set {
113- _freeze_track = value ;
11490
115- if (! _freeze_track)
116- update_region ();
117- }
118- }
119-
120- private bool _freeze_track = false ;
12191 private List<Clutter . Actor > tracked_actors = new List<Clutter . Actor > ();
12292
12393 /**
12494 * Once this method is called you can start adding actors to the stage
125- * via the windowmanager instance that is given to you.
95+ * via the window manager instance that is given to you.
12696 *
12797 * @param wm The window manager.
12898 */
@@ -145,7 +115,7 @@ namespace Gala {
145115 */
146116 public void track_actor (Clutter .Actor actor ) {
147117 tracked_actors. prepend (actor);
148- actor. notify[" allocation" ]. connect (on_actor_allocation_changed );
118+ actor. notify[" allocation" ]. connect (update_region );
149119
150120 update_region ();
151121 }
@@ -158,50 +128,28 @@ namespace Gala {
158128 */
159129 public void untrack_actor (Clutter .Actor actor ) {
160130 tracked_actors. remove (actor);
161- actor. notify[" allocation" ]. disconnect (on_actor_allocation_changed );
131+ actor. notify[" allocation" ]. disconnect (update_region );
162132 }
163133
164134 /**
165135 * You can call this method to force the system to update the region that
166- * is used by the window manager. It will automatically upon changes to
167- * the custom_region property and when a tracked actor's allocation changes
168- * unless freeze_track is set to true. You may need to call this function
169- * after setting freeze_track back to false after an animation to make the
170- * wm aware of the new position of the actor in question.
136+ * is used by the window manager. It will automatically be called when a tracked actor's allocation changes.
171137 */
172138 public void update_region () {
173- unowned var custom_region = get_custom_region ();
174- var has_custom = custom_region != null ;
175- var len = tracked_actors. length () + (has_custom ? custom_region. length : 0 );
176-
177- var regions = new Mtk.Rectangle [len];
139+ var regions = new Mtk .Rectangle [tracked_actors.length ()];
178140 var i = 0 ;
179141
180- if (has_custom) {
181- for (var j = 0 ; j < custom_region. length; j++ ) {
182- regions[i++ ] = custom_region[j];
183- }
184- }
185-
186142 foreach (var actor in tracked_actors) {
187143 float x, y, w, h;
188144 actor. get_transformed_position (out x, out y);
189145 actor. get_transformed_size (out w, out h);
190146
191- if (w == 0 || h == 0 )
192- continue ;
193-
194147 regions[i++ ] = { (int ) x, (int ) y, (int ) w, (int ) h };
195148 }
196149
197150 region = regions;
198151
199152 region_changed ();
200153 }
201-
202- private void on_actor_allocation_changed (GLib .Object actor_object , GLib .ParamSpec pspec ) {
203- if (! freeze_track)
204- update_region ();
205- }
206154 }
207155}
0 commit comments