Skip to content

Commit 746ff72

Browse files
committed
Fixed CC adaptive height being short with fit-to-screen enabled
1 parent b3fe84c commit 746ff72

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/controlCenter/controlCenter.vala

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
namespace SwayNotificationCenter {
2+
/* Only to be used by the Viewport in the Control Center */
23
private class FixedViewportLayout : Gtk.LayoutManager {
34
private unowned Gtk.ScrolledWindow parent;
45

@@ -40,6 +41,11 @@ namespace SwayNotificationCenter {
4041
return;
4142
}
4243

44+
if (ConfigModel.instance.fit_to_screen) {
45+
child.allocate (width, height, baseline, null);
46+
return;
47+
}
48+
4349
int m_height, n_height;
4450
child.measure (Gtk.Orientation.VERTICAL, width,
4551
out m_height, out n_height,
@@ -49,13 +55,13 @@ namespace SwayNotificationCenter {
4955
out m_width, out n_width,
5056
null, null);
5157

52-
int window_width = parent.get_width ();
53-
int window_height = parent.get_height ();
58+
int parent_width = parent.get_width ();
59+
int parent_height = parent.get_height ();
5460

5561
// Limit the size to the ScrolledWindows size
5662
child.allocate (
57-
n_width.clamp ((int) Math.fmin (m_width, window_width), window_width),
58-
n_height.clamp ((int) Math.fmin (m_height, window_height), window_height),
63+
n_width.clamp ((int) Math.fmin (m_width, parent_width), parent_width),
64+
n_height.clamp ((int) Math.fmin (m_height, parent_height), parent_height),
5965
baseline, null);
6066
}
6167
}

0 commit comments

Comments
 (0)