@@ -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,7 +49,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
4949 }
5050 });
5151
52- notify[" anchor" ]. connect (() = > position = Position . from_anchor (anchor) );
52+ notify[" anchor" ]. connect (position_window );
5353
5454 unowned var workspace_manager = window. display. get_workspace_manager ();
5555 workspace_manager. workspace_added. connect (update_strut);
@@ -75,7 +75,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
7575 workspace_hide_tracker. window_state_changed_progress_updated. connect (workspace_gesture_controller. goto);
7676
7777 window. size_changed. connect (update_target);
78- notify[" position " ]. connect (update_target);
78+ notify[" anchor " ]. connect (update_target);
7979 update_target ();
8080
8181 add_gesture_controller (user_gesture_controller);
@@ -86,7 +86,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
8686 window_actor. notify[" width" ]. connect (update_clip);
8787 window_actor. notify[" height" ]. connect (update_clip);
8888 window_actor. notify[" translation-y" ]. connect (update_clip);
89- notify[" position " ]. connect (update_clip);
89+ notify[" anchor " ]. connect (update_clip);
9090 }
9191
9292 public Mtk . Rectangle get_custom_window_rect () {
@@ -99,7 +99,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
9999 if (height > 0 ) {
100100 window_rect. height = height;
101101
102- if (position == BOTTOM ) {
102+ if (anchor == BOTTOM ) {
103103 var geom = window. display. get_monitor_geometry (window. get_monitor ());
104104 window_rect. y = geom. y + geom. height - height;
105105 }
@@ -248,6 +248,27 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
248248 }
249249 }
250250
251+ protected override void get_window_position (Mtk . Rectangle window_rect, out int x, out int y) {
252+ var monitor_rect = window. display. get_monitor_geometry (window. display. get_primary_monitor ());
253+ switch (anchor) {
254+ case TOP :
255+ x = monitor_rect. x + (monitor_rect. width - window_rect. width) / 2 ;
256+ y = monitor_rect. y;
257+ break ;
258+
259+ case BOTTOM :
260+ x = monitor_rect. x + (monitor_rect. width - window_rect. width) / 2 ;
261+ y = monitor_rect. y + monitor_rect. height - window_rect. height;
262+ break ;
263+
264+ default:
265+ warning (" Unsupported anchor %s for PanelWindow" , anchor. to_string ());
266+ x = 0 ;
267+ y = 0 ;
268+ break ;
269+ }
270+ }
271+
251272 private void update_target () {
252273 var to_value = anchor == TOP ? - get_custom_window_rect (). height : get_custom_window_rect (). height;
253274 hide_target = new PropertyTarget (CUSTOM , actor, " translation-y" , typeof (float ), 0f , (float ) to_value);
0 commit comments