Skip to content

Commit 50a2adc

Browse files
committed
PositionedWindow: Move custom window rect handling to PanelWindow
1 parent e65e63e commit 50a2adc

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/ShellClients/PanelWindow.vala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
3535
private GestureController workspace_gesture_controller;
3636
private WorkspaceHideTracker workspace_hide_tracker;
3737

38+
private int width = -1;
39+
private int height = -1;
40+
3841
public PanelWindow (WindowManager wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) {
3942
Object (wm: wm, anchor: anchor, window: window, position: Position.from_anchor (anchor));
4043
}
@@ -86,6 +89,30 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
8689
notify["position"].connect (update_clip);
8790
}
8891

92+
public Mtk.Rectangle get_custom_window_rect () {
93+
var window_rect = window.get_frame_rect ();
94+
95+
if (width > 0) {
96+
window_rect.width = width;
97+
}
98+
99+
if (height > 0) {
100+
window_rect.height = height;
101+
102+
if (position == BOTTOM) {
103+
var geom = window.display.get_monitor_geometry (window.get_monitor ());
104+
window_rect.y = geom.y + geom.height - height;
105+
}
106+
}
107+
108+
return window_rect;
109+
}
110+
111+
public void set_size (int width, int height) {
112+
this.width = width;
113+
this.height = height;
114+
}
115+
89116
public void request_visible_in_multitasking_view () {
90117
visible_in_multitasking_view = true;
91118
actor.add_action (new DragDropAction (DESTINATION, "multitaskingview-window"));

src/ShellClients/PositionedWindow.vala

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public class Gala.PositionedWindow : Object {
2929
public Position position { get; construct set; }
3030
public Variant? position_data { get; construct set; }
3131

32-
private int width = -1;
33-
private int height = -1;
34-
3532
private ulong position_changed_id;
3633

3734
public PositionedWindow (Meta.Window window, Position position, Variant? position_data = null) {
@@ -53,30 +50,6 @@ public class Gala.PositionedWindow : Object {
5350
notify["position-data"].connect (position_window);
5451
}
5552

56-
public Mtk.Rectangle get_custom_window_rect () {
57-
var window_rect = window.get_frame_rect ();
58-
59-
if (width > 0) {
60-
window_rect.width = width;
61-
}
62-
63-
if (height > 0) {
64-
window_rect.height = height;
65-
66-
if (position == BOTTOM) {
67-
var geom = window.display.get_monitor_geometry (window.get_monitor ());
68-
window_rect.y = geom.y + geom.height - height;
69-
}
70-
}
71-
72-
return window_rect;
73-
}
74-
75-
public void set_size (int width, int height) {
76-
this.width = width;
77-
this.height = height;
78-
}
79-
8053
private void position_window () {
8154
int x = 0, y = 0;
8255
var window_rect = window.get_frame_rect ();

0 commit comments

Comments
 (0)