|
1 | 1 | /* |
2 | 2 | * SPDX-License-Identifier: GPL-3.0 |
3 | | - * SPDX-FileCopyrightText: 2022 elementary, Inc. (https://elementary.io) |
| 3 | + * SPDX-FileCopyrightText: 2022-2024 elementary, Inc. (https://elementary.io) |
4 | 4 | */ |
5 | 5 |
|
6 | 6 | public class Dock.MainWindow : Gtk.ApplicationWindow { |
| 7 | + private class Container : Gtk.Box { |
| 8 | + class construct { |
| 9 | + set_css_name ("dock"); |
| 10 | + } |
| 11 | + } |
| 12 | + |
| 13 | + private class BottomMargin : Gtk.Widget { |
| 14 | + class construct { |
| 15 | + set_css_name ("bottom-margin"); |
| 16 | + } |
| 17 | + } |
| 18 | + |
7 | 19 | private static Settings settings = new Settings ("io.elementary.dock"); |
8 | 20 |
|
9 | 21 | private Pantheon.Desktop.Shell? desktop_shell; |
10 | 22 | private Pantheon.Desktop.Panel? panel; |
11 | 23 |
|
| 24 | + private Gtk.Box main_box; |
| 25 | + private int height = 0; |
| 26 | + |
12 | 27 | class construct { |
13 | | - set_css_name ("dock"); |
| 28 | + set_css_name ("dock-window"); |
14 | 29 | } |
15 | 30 |
|
16 | 31 | construct { |
17 | 32 | var launcher_manager = LauncherManager.get_default (); |
18 | 33 |
|
19 | | - child = launcher_manager; |
20 | 34 | overflow = VISIBLE; |
21 | 35 | resizable = false; |
22 | 36 | titlebar = new Gtk.Label ("") { visible = false }; |
23 | 37 |
|
| 38 | + // Don't clip launchers to dock background https://github.com/elementary/dock/issues/275 |
| 39 | + var overlay = new Gtk.Overlay () { |
| 40 | + child = new Container () |
| 41 | + }; |
| 42 | + overlay.add_overlay (launcher_manager); |
| 43 | + |
| 44 | + var size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.BOTH); |
| 45 | + size_group.add_widget (overlay.child); |
| 46 | + size_group.add_widget (launcher_manager); |
| 47 | + |
| 48 | + main_box = new Gtk.Box (VERTICAL, 0); |
| 49 | + main_box.append (overlay); |
| 50 | + main_box.append (new BottomMargin ()); |
| 51 | + child = main_box; |
| 52 | + |
| 53 | + remove_css_class ("background"); |
| 54 | + |
24 | 55 | // Fixes DnD reordering of launchers failing on a very small line between two launchers |
25 | 56 | var drop_target_launcher = new Gtk.DropTarget (typeof (Launcher), MOVE); |
26 | 57 | launcher_manager.add_controller (drop_target_launcher); |
@@ -51,6 +82,21 @@ public class Dock.MainWindow : Gtk.ApplicationWindow { |
51 | 82 |
|
52 | 83 | private static Wl.RegistryListener registry_listener; |
53 | 84 | private void init_panel () { |
| 85 | + get_surface ().layout.connect_after (() => { |
| 86 | + var new_height = main_box.get_height (); |
| 87 | + if (new_height == height) { |
| 88 | + return; |
| 89 | + } |
| 90 | + |
| 91 | + height = new_height; |
| 92 | + |
| 93 | + if (panel != null) { |
| 94 | + panel.set_size (-1, height); |
| 95 | + } else { |
| 96 | + update_panel_x11 (); |
| 97 | + } |
| 98 | + }); |
| 99 | + |
54 | 100 | registry_listener.global = registry_handle_global; |
55 | 101 | unowned var display = Gdk.Display.get_default (); |
56 | 102 | if (display is Gdk.Wayland.Display) { |
@@ -78,7 +124,7 @@ public class Dock.MainWindow : Gtk.ApplicationWindow { |
78 | 124 |
|
79 | 125 | var prop = xdisplay.intern_atom ("_MUTTER_HINTS", false); |
80 | 126 |
|
81 | | - var value = "anchor=8:hide-mode=%d".printf (settings.get_enum ("autohide-mode")); |
| 127 | + var value = "anchor=8:hide-mode=%d:size=-1,%d".printf (settings.get_enum ("autohide-mode"), height); |
82 | 128 |
|
83 | 129 | xdisplay.change_property (window, prop, X.XA_STRING, 8, 0, (uchar[]) value, value.length); |
84 | 130 | } |
|
0 commit comments