Skip to content

Commit 094ce0a

Browse files
committed
Don't hardcode bottom margin
1 parent 7a6ef29 commit 094ce0a

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/MainWindow.vala

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
1818

1919
// Matches top margin in Launcher.css
2020
private const int TOP_MARGIN = 64;
21-
private const int MARGIN_BOTTOM = 9;
2221
private const int BORDER_RADIUS = 9;
2322

2423
private Settings transparency_settings;
@@ -30,6 +29,8 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
3029
private Gtk.Box main_box;
3130

3231
private WindowDragManager window_drag_manager;
32+
private BottomMargin bottom_margin;
33+
private bool initialized_blur = false;
3334

3435
class construct {
3536
set_css_name ("dock-window");
@@ -52,9 +53,11 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
5253
size_group.add_widget (overlay.child);
5354
size_group.add_widget (launcher_manager);
5455

56+
bottom_margin = new BottomMargin ();
57+
5558
main_box = new Gtk.Box (VERTICAL, 0);
5659
main_box.append (overlay);
57-
main_box.append (new BottomMargin ());
60+
main_box.append (bottom_margin);
5861
child = main_box;
5962

6063
remove_css_class ("background");
@@ -101,7 +104,6 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
101104
panel = desktop_shell.get_panel (wl_surface);
102105
panel.set_anchor (BOTTOM);
103106
panel.set_hide_mode (settings.get_enum ("autohide-mode"));
104-
panel.add_blur (0, 0, 0, MARGIN_BOTTOM, BORDER_RADIUS);
105107
#if WORKSPACE_SWITCHER
106108
panel.request_visible_in_multitasking_view ();
107109
#endif
@@ -134,6 +136,21 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
134136
item_manager_width,
135137
surface.height - top_margin
136138
}));
139+
140+
if (initialized_blur) {
141+
return;
142+
}
143+
144+
Graphene.Rect bounds;
145+
bottom_margin.compute_bounds (bottom_margin, out bounds);
146+
147+
initialized_blur = true;
148+
149+
if (panel != null) {
150+
panel.add_blur (0, 0, 0, (int) bounds.get_height (), BORDER_RADIUS);
151+
} else {
152+
update_panel_x11 ();
153+
}
137154
});
138155

139156
registry_listener.global = registry_handle_global;
@@ -165,6 +182,12 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
165182

166183
var value = "anchor=8:hide-mode=%d:restore-previous-region=1:visible-in-multitasking-view=1".printf (settings.get_enum ("autohide-mode"));
167184

185+
if (!initialized_blur) {
186+
Graphene.Rect bounds;
187+
bottom_margin.compute_bounds (bottom_margin, out bounds);
188+
value += ":blur=0,0,0,%d,%d".printf ((int) bounds.get_height (), BORDER_RADIUS);
189+
}
190+
168191
xdisplay.change_property (window, prop, X.XA_STRING, 8, 0, (uchar[]) value, value.length);
169192
}
170193
}

0 commit comments

Comments
 (0)