55
66public class Dock.MainWindow : Gtk .ApplicationWindow {
77 private class Container : Gtk .Widget {
8- private Settings settings = new Settings (" io.elementary.dock" );
9-
108 class construct {
119 set_css_name ("dock ");
1210 }
1311
1412 construct {
15- height_request = ItemManager . get_launcher_size ();
16- settings. changed[" icon-size" ]. connect (() = > {
17- height_request = ItemManager . get_launcher_size ();
18- });
19- }
20- }
21-
22- private class BottomMargin : Gtk .Widget {
23- private static BottomMargin ? first_instance;
24-
25- class construct {
26- set_css_name ("bottom -margin ");
27- }
28-
29- construct {
30- if (first_instance == null ) {
31- first_instance = this ;
32- }
33- }
34-
35- public new static int get_size () {
36- if (first_instance == null ) {
37- return 0 ;
38- }
39-
40- Graphene . Rect bounds;
41- first_instance. compute_bounds (first_instance, out bounds);
42-
43- return (int ) bounds. get_height ();
44- }
45- }
46-
47- private class DockBox : Gtk .Box {
48- construct {
49- orientation = VERTICAL ;
50- append (new Container ());
51- append (new BottomMargin ());
13+ vexpand = true ;
5214 }
5315 }
5416
@@ -64,27 +26,32 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
6426
6527 private WindowDragManager window_drag_manager;
6628 private bool initialized_blur = false ;
67- private DockBox dock_box;
6829
6930 class construct {
7031 set_css_name ("dock -window ");
7132 }
7233
7334 construct {
74- var launcher_manager = ItemManager . get_default ();
75-
7635 overflow = VISIBLE ;
7736 resizable = false ;
7837 titlebar = new Gtk .Label (" " ) { visible = false };
7938
80- dock_box = new DockBox ();
39+ var dock_box = new Gtk .Box (VERTICAL , 0 );
40+ dock_box. append (new Container ());
41+ dock_box. append (new BottomMargin ());
42+
43+ unowned var launcher_manager = ItemManager . get_default ();
8144
8245 // Don't clip launchers to dock background https://github.com/elementary/dock/issues/275
8346 var overlay = new Gtk .Overlay () {
8447 child = dock_box
8548 };
8649 overlay. add_overlay (launcher_manager);
8750
51+ var size_group = new Gtk .SizeGroup (Gtk . SizeGroupMode . BOTH );
52+ size_group. add_widget (dock_box);
53+ size_group. add_widget (launcher_manager);
54+
8855 child = overlay;
8956
9057 remove_css_class (" background" );
@@ -155,9 +122,6 @@ public class Dock.MainWindow : Gtk.ApplicationWindow {
155122 unowned var item_manager = ItemManager . get_default ();
156123 var item_manager_width = item_manager. get_width ();
157124
158- dock_box. width_request = item_manager_width;
159- item_manager. height_request = dock_box. get_height ();
160-
161125 // manually set input region since container's shadow are is the content of the window
162126 // and it still gets window events
163127 var shadow_size = (width - item_manager_width) / 2 ;
0 commit comments