@@ -39,7 +39,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
3939 private int height = - 1 ;
4040
4141 public PanelWindow (WindowManager wm, Meta . Window window, Pantheon . Desktop . Anchor anchor) {
42- Object (wm: wm, anchor : anchor, window: window, position : Position . from_anchor ( anchor) );
42+ Object (wm: wm, window: window, anchor : anchor);
4343 }
4444
4545 construct {
@@ -49,8 +49,6 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
4949 }
5050 });
5151
52- notify[" anchor" ]. connect (() = > position = Position . from_anchor (anchor));
53-
5452 unowned var workspace_manager = window. display. get_workspace_manager ();
5553 workspace_manager. workspace_added. connect (update_strut);
5654 workspace_manager. workspace_removed. connect (update_strut);
@@ -77,15 +75,15 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
7775 workspace_hide_tracker. window_state_changed_progress_updated. connect (workspace_gesture_controller. goto);
7876
7977 window. size_changed. connect (update_target);
80- notify[" position " ]. connect (update_target);
78+ notify[" anchor " ]. connect (update_target);
8179 update_target ();
8280
8381 var window_actor = (Meta . WindowActor ) window. get_compositor_private ();
8482
8583 window_actor. notify[" width" ]. connect (update_clip);
8684 window_actor. notify[" height" ]. connect (update_clip);
8785 window_actor. notify[" translation-y" ]. connect (update_clip);
88- notify[" position " ]. connect (update_clip);
86+ notify[" anchor " ]. connect (update_clip);
8987 }
9088
9189 public Mtk . Rectangle get_custom_window_rect () {
@@ -98,7 +96,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
9896 if (height > 0 ) {
9997 window_rect. height = height;
10098
101- if (position == BOTTOM ) {
99+ if (anchor == BOTTOM ) {
102100 var geom = window. display. get_monitor_geometry (window. get_monitor ());
103101 window_rect. y = geom. y + geom. height - height;
104102 }
@@ -247,6 +245,28 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
247245 }
248246 }
249247
248+ protected override void get_window_position (
249+ Mtk . Rectangle window_rect, Mtk . Rectangle monitor_rect, out int x, out int y
250+ ) {
251+ switch (anchor) {
252+ case TOP :
253+ x = monitor_rect. x + (monitor_rect. width - window_rect. width) / 2 ;
254+ y = monitor_rect. y;
255+ break ;
256+
257+ case BOTTOM :
258+ x = monitor_rect. x + (monitor_rect. width - window_rect. width) / 2 ;
259+ y = monitor_rect. y + monitor_rect. height - window_rect. height;
260+ break ;
261+
262+ default:
263+ warning (" Unsupported anchor %s for PanelWindow" , anchor. to_string ());
264+ x = 0 ;
265+ y = 0 ;
266+ break ;
267+ }
268+ }
269+
250270 private void update_target () {
251271 var to_value = anchor == TOP ? - get_custom_window_rect (). height : get_custom_window_rect (). height;
252272 hide_target = new PropertyTarget (CUSTOM , actor, " translation-y" , typeof (float ), 0f , (float ) to_value);
0 commit comments