@@ -25,8 +25,8 @@ public class Gala.ShellClientsManager : Object {
2525 private NotificationsClient notifications_client;
2626 private ManagedClient [] protocol_clients = {};
2727
28- private GLib . HashTable<Meta . Window , PanelWindow > windows = new GLib .HashTable<Meta . Window , PanelWindow > (null , null );
29- private GLib . HashTable<Meta . Window , CenteredWindow > centered_windows = new GLib .HashTable<Meta . Window , CenteredWindow > (null , null );
28+ private GLib . HashTable<Meta . Window , PanelWindow > panel_windows = new GLib .HashTable<Meta . Window , PanelWindow > (null , null );
29+ private GLib . HashTable<Meta . Window , WindowPositioner > positioned_windows = new GLib .HashTable<Meta . Window , WindowPositioner > (null , null );
3030
3131 private ShellClientsManager (WindowManager wm ) {
3232 Object (wm: wm);
@@ -144,18 +144,18 @@ public class Gala.ShellClientsManager : Object {
144144 }
145145
146146 public void set_anchor (Meta .Window window , Meta .Side side ) {
147- if (window in windows ) {
148- windows [window]. update_anchor (side);
147+ if (window in panel_windows ) {
148+ panel_windows [window]. update_anchor (side);
149149 return ;
150150 }
151151
152152 make_dock (window);
153153 // TODO: Return if requested by window that's not a trusted client?
154154
155- windows [window] = new PanelWindow (wm, window, side);
155+ panel_windows [window] = new PanelWindow (wm, window, side);
156156
157157 // connect_after so we make sure the PanelWindow can destroy its barriers and struts
158- window. unmanaging. connect_after (() = > windows . remove (window ));
158+ window. unmanaging. connect_after ((_window ) = > panel_windows . remove (_window ));
159159 }
160160
161161 /**
@@ -166,37 +166,38 @@ public class Gala.ShellClientsManager : Object {
166166 * TODO: Maybe use for strut only?
167167 */
168168 public void set_size (Meta .Window window , int width , int height ) {
169- if (! (window in windows )) {
169+ if (! (window in panel_windows )) {
170170 warning (" Set anchor for window before size." );
171171 return ;
172172 }
173173
174- windows [window]. set_size (width, height);
174+ panel_windows [window]. set_size (width, height);
175175 }
176176
177177 public void set_hide_mode (Meta .Window window , Pantheon .Desktop .HideMode hide_mode ) {
178- if (! (window in windows )) {
178+ if (! (window in panel_windows )) {
179179 warning (" Set anchor for window before hide mode." );
180180 return ;
181181 }
182182
183- windows [window]. set_hide_mode (hide_mode);
183+ panel_windows [window]. set_hide_mode (hide_mode);
184184 }
185185
186- public void make_centered (Meta .Window window ) {
187- if (window in centered_windows) {
188- return ;
189- }
186+ public void make_centered (Meta .Window window ) requires (!is_itself_positioned (window )) {
187+ positioned_windows[window] = new WindowPositioner (wm, window, CENTER );
190188
191- centered_windows[window] = new CenteredWindow (wm, window);
189+ // connect_after so we make sure that any queued move is unqueued
190+ window. unmanaging. connect_after ((_window) = > positioned_windows. remove (_window));
191+ }
192192
193- window. unmanaging. connect_after (() = > centered_windows. remove (window));
193+ private bool is_itself_positioned (Meta .Window window ) {
194+ return (window in positioned_windows) || (window in panel_windows);
194195 }
195196
196197 public bool is_positioned_window (Meta .Window window ) {
197- bool positioned = (window in centered_windows) || (window in windows );
198+ bool positioned = is_itself_positioned (window);
198199 window. foreach_ancestor ((ancestor) = > {
199- if (ancestor in centered_windows || ancestor in windows ) {
200+ if (is_itself_positioned ( ancestor) ) {
200201 positioned = true ;
201202 }
202203
0 commit comments