@@ -36,7 +36,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
3636 private int height = - 1 ;
3737
3838 public PanelWindow (WindowManager wm, Meta . Window window, Pantheon . Desktop . Anchor anchor) {
39- Object (wm: wm, anchor : anchor, window: window, position : Position . from_anchor ( anchor) );
39+ Object (wm: wm, window: window, anchor : anchor);
4040 }
4141
4242 construct {
@@ -46,8 +46,6 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
4646 }
4747 });
4848
49- notify[" anchor" ]. connect (() = > position = Position . from_anchor (anchor));
50-
5149 unowned var workspace_manager = window. display. get_workspace_manager ();
5250 workspace_manager. workspace_added. connect (update_strut);
5351 workspace_manager. workspace_removed. connect (update_strut);
@@ -65,15 +63,15 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
6563 hide_tracker. show. connect (show);
6664
6765 window. size_changed. connect (update_target);
68- notify[" position " ]. connect (update_target);
66+ notify[" anchor " ]. connect (update_target);
6967 update_target ();
7068
7169 var window_actor = (Meta . WindowActor ) window. get_compositor_private ();
7270
7371 window_actor. notify[" width" ]. connect (update_clip);
7472 window_actor. notify[" height" ]. connect (update_clip);
7573 window_actor. notify[" translation-y" ]. connect (update_clip);
76- notify[" position " ]. connect (update_clip);
74+ notify[" anchor " ]. connect (update_clip);
7775 }
7876
7977 public Mtk . Rectangle get_custom_window_rect () {
@@ -86,7 +84,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
8684 if (height > 0 ) {
8785 window_rect. height = height;
8886
89- if (position == BOTTOM ) {
87+ if (anchor == BOTTOM ) {
9088 var geom = window. display. get_monitor_geometry (window. get_monitor ());
9189 window_rect. y = geom. y + geom. height - height;
9290 }
@@ -177,6 +175,28 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
177175 }
178176 }
179177
178+ protected override void get_window_position (
179+ Mtk . Rectangle window_rect, Mtk . Rectangle monitor_rect, out int x, out int y
180+ ) {
181+ switch (anchor) {
182+ case TOP :
183+ x = monitor_rect. x + (monitor_rect. width - window_rect. width) / 2 ;
184+ y = monitor_rect. y;
185+ break ;
186+
187+ case BOTTOM :
188+ x = monitor_rect. x + (monitor_rect. width - window_rect. width) / 2 ;
189+ y = monitor_rect. y + monitor_rect. height - window_rect. height;
190+ break ;
191+
192+ default:
193+ warning (" Unsupported anchor %s for PanelWindow" , anchor. to_string ());
194+ x = 0 ;
195+ y = 0 ;
196+ break ;
197+ }
198+ }
199+
180200 private void update_target () {
181201 var to_value = anchor == TOP ? - get_custom_window_rect (). height : get_custom_window_rect (). height;
182202 hide_target = new PropertyTarget (CUSTOM , actor, " translation-y" , typeof (float ), 0f , (float ) to_value);
0 commit comments