Skip to content

Commit 66efb9f

Browse files
committed
PositionedWindow: Move custom window rect handling to PanelWindow
1 parent fb6818c commit 66efb9f

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
@@ -32,6 +32,9 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
3232
private GestureController gesture_controller;
3333
private HideTracker hide_tracker;
3434

35+
private int width = -1;
36+
private int height = -1;
37+
3538
public PanelWindow (WindowManager wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) {
3639
Object (wm: wm, anchor: anchor, window: window, position: Position.from_anchor (anchor));
3740
}
@@ -73,6 +76,30 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
7376
notify["position"].connect (update_clip);
7477
}
7578

79+
public Mtk.Rectangle get_custom_window_rect () {
80+
var window_rect = window.get_frame_rect ();
81+
82+
if (width > 0) {
83+
window_rect.width = width;
84+
}
85+
86+
if (height > 0) {
87+
window_rect.height = height;
88+
89+
if (position == BOTTOM) {
90+
var geom = window.display.get_monitor_geometry (window.get_monitor ());
91+
window_rect.y = geom.y + geom.height - height;
92+
}
93+
}
94+
95+
return window_rect;
96+
}
97+
98+
public void set_size (int width, int height) {
99+
this.width = width;
100+
this.height = height;
101+
}
102+
76103
public void request_visible_in_multitasking_view () {
77104
visible_in_multitasking_view = true;
78105
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)