diff --git a/src/components/dock/dock.vala b/src/components/dock/dock.vala index f02aa91..4a06f26 100644 --- a/src/components/dock/dock.vala +++ b/src/components/dock/dock.vala @@ -58,6 +58,7 @@ namespace Singularity { private GtkLayerShell.Edge _reveal_barrier_edge = GtkLayerShell.Edge.BOTTOM; private int _last_dimension = 0; private int _current_margin = 0; + private int _rest_margin = 0; private bool _menu_open = false; private Gee.ArrayList _menu_providers = new Gee.ArrayList(); @@ -461,16 +462,19 @@ namespace Singularity { set_margin(this, GtkLayerShell.Edge.LEFT, 0); set_margin(this, GtkLayerShell.Edge.RIGHT, 0); set_margin(this, GtkLayerShell.Edge.TOP, 0); + _rest_margin = 0; if (dock_style == "panel") { _current_margin = 0; return; } if (pos == "left") { _current_margin = gap; + _rest_margin = gap; set_margin(this, GtkLayerShell.Edge.LEFT, gap); main_container.margin_end = gap + magnifier.headroom(true); } else if (pos == "right") { _current_margin = gap; + _rest_margin = gap; set_margin(this, GtkLayerShell.Edge.RIGHT, gap); main_container.margin_start = gap + magnifier.headroom(true); } else { @@ -479,7 +483,8 @@ namespace Singularity { // container's bottom margin. Pull the surface down by that // much so the shadow is not clipped at the surface edge, // while the dock stays at the same visual gap (#162). - set_margin(this, GtkLayerShell.Edge.BOTTOM, int.max(0, gap - 21)); + _rest_margin = int.max(0, gap - 21); + set_margin(this, GtkLayerShell.Edge.BOTTOM, _rest_margin); main_container.margin_top = gap + magnifier.headroom(true); } } @@ -878,6 +883,15 @@ namespace Singularity { if (changed) app_system.config_changed("dock-reservation"); } + public int shown_extent() { + if (!_enabled || hidden_by_scrolling_tiling()) return 0; + int headroom = dock_style == "panel" ? 0 : magnifier.headroom(true); + int body = _last_dimension > 10 + ? _last_dimension - SHADOW_BOTTOM_PX - headroom + : _settings.get_int("dock-icon-size") + 20 + _settings.get_int("dock-gap"); + return int.max(0, body) + _rest_margin; + } + private void update_autohide_state() { if (hidden_by_scrolling_tiling()) { _set_reveal_barrier_active(false); diff --git a/src/components/overview/overview.vala b/src/components/overview/overview.vala index b61f1b0..91b9ead 100644 --- a/src/components/overview/overview.vala +++ b/src/components/overview/overview.vala @@ -32,6 +32,8 @@ namespace Singularity { public bool showing { get; private set; default = false; } + public Singularity.Dock? dock { get; set; default = null; } + // True when the keyboard focus is on something the user is typing // into (Entry, TextView, etc.) - used to suppress the // "redirect to search bar" behavior so notes / calculator widgets @@ -411,12 +413,26 @@ namespace Singularity { if (grid_mon == null) return; Gdk.Rectangle gg = grid_mon.get_geometry(); int avail = gg.width - 48; + int avail_h = gg.height; string dock_pos = desktop_settings.get_string("dock-position"); - if ((dock_pos == "left" || dock_pos == "right") - && !desktop_settings.get_boolean("dock-autohide")) { - int isz = Singularity.FormShell.dock_icon_size(desktop_settings, grid_mon); - if (isz <= 0) isz = 48; - avail -= isz + desktop_settings.get_int("dock-gap") + 28; + bool under_dock = Singularity.FormShell.wants_dock(grid_mon) + && Singularity.FormFactor.at(grid_mon).is_touch_first(); + int dock_extent = (dock != null && !under_dock) ? dock.shown_extent() : 0; + content_stack.margin_bottom = 0; + content_stack.margin_start = 0; + content_stack.margin_end = 0; + if (dock_pos == "left" || dock_pos == "right") { + if (dock == null && !desktop_settings.get_boolean("dock-autohide")) { + int isz = Singularity.FormShell.dock_icon_size(desktop_settings, grid_mon); + if (isz <= 0) isz = 48; + dock_extent = isz + desktop_settings.get_int("dock-gap") + 28; + } + avail -= dock_extent; + if (dock_pos == "left") content_stack.margin_start = dock_extent; + else content_stack.margin_end = dock_extent; + } else { + content_stack.margin_bottom = dock_extent; + avail_h -= dock_extent; } if (Singularity.FormFactor.at(grid_mon) == Singularity.FormFactorKind.PHONE) { int slot = avail / PHONE_GRID_COLUMNS; @@ -429,7 +445,7 @@ namespace Singularity { results_scrolled.width_request = RESULTS_WIDTH; } launcher_grid.set_columns_for_width(avail); - launcher_grid.viewport_hint = gg.height; + launcher_grid.viewport_hint = avail_h; } private void animate_stage(bool entering) { diff --git a/src/core/main.vala b/src/core/main.vala index fa52bb5..3207df3 100644 --- a/src/core/main.vala +++ b/src/core/main.vala @@ -915,6 +915,7 @@ public class SingularityApp : Singularity.ShellApplication, Singularity.Shell.Sh } else if (want_dock) { dock = new Singularity.Dock(this); } + if (overview != null) overview.dock = dock; connect_shell_signals(); if (hot_corner_manager != null) { if (panel != null) hot_corner_manager.attach_to_panel(panel); @@ -1159,6 +1160,7 @@ public class SingularityApp : Singularity.ShellApplication, Singularity.Shell.Sh private void ensure_overview() { if (overview != null) return; overview = new Singularity.Overview(this, panel); + overview.dock = dock; overview.shown.connect(() => { set_tiling_layout_hold(overview, true); if (panel != null) panel.set_overview_mode(true);