From 76f3ceaadcf061e4dbfb6e15a4291dabb25815b9 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Tue, 14 Jan 2025 16:43:41 -0500 Subject: [PATCH] Deskbar: Reduce window height by 1 in mini-mode Adjust tray icons and clock to fit accordingly. Leaf menu height is reduced by 1 in vertical mode to match. This makes the overlap of maximized windows and Deskbar less noticeable, especially in horizontal mini-mode. Fixes #16231 Change-Id: I622d008ee093e018ebcb46e3c45647577f46184f Reviewed-on: https://review.haiku-os.org/c/haiku/+/8833 Tested-by: Commit checker robot Reviewed-by: John Scipione Haiku-Format: Haiku-format Bot --- src/apps/deskbar/BarWindow.cpp | 12 +++++------- src/apps/deskbar/StatusView.cpp | 9 ++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp index 049a769b39..00e18aacdf 100644 --- a/src/apps/deskbar/BarWindow.cpp +++ b/src/apps/deskbar/BarWindow.cpp @@ -694,7 +694,7 @@ TBarWindow::SetSizeLimits() float maxWidth; if (fBarView->Vertical()) { - minHeight = fBarView->TabHeight(); + minHeight = fBarView->TabHeight() - 1; maxHeight = B_SIZE_UNLIMITED; minWidth = gMinimumWindowWidth; maxWidth = gMaximumWindowWidth; @@ -704,15 +704,13 @@ TBarWindow::SetSizeLimits() // horizontal mini-mode minWidth = gMinimumWindowWidth; maxWidth = B_SIZE_UNLIMITED; - minHeight = fBarView->TabHeight(); - maxHeight = std::max(fBarView->TabHeight(), kGutter - + fBarView->ReplicantTray()->MaxReplicantHeight() - + kGutter); + minHeight = fBarView->TabHeight() - 1; + maxHeight = std::max(fBarView->TabHeight() - 1, + kGutter + fBarView->ReplicantTray()->MaxReplicantHeight() + kGutter); } else { // horizontal expando-mode const int32 max - = be_control_look->ComposeIconSize(kMaximumIconSize) - .IntegerWidth() + 1; + = be_control_look->ComposeIconSize(kMaximumIconSize).IntegerWidth() + 1; const float iconPadding = be_control_look->ComposeSpacing(kIconPadding); diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 19061dfa5b..79f182ffc2 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -150,8 +150,7 @@ TReplicantTray::TReplicantTray(TBarView* barView) = std::max(gMinReplicantHeight, (float)static_cast(be_app)->TeamIconSize()); // but not bigger than TabHeight which depends on be_bold_font // TODO this should only apply to mini-mode but we set it once here for all - fMaxReplicantHeight = std::min(fMaxReplicantHeight, - fBarView->TabHeight() - 4); + fMaxReplicantHeight = std::min(fMaxReplicantHeight, fBarView->TabHeight() - 1); // TODO: depends on window size... (so use something like // max(129, height * 3), and restrict the minimum window width for it) // Use bold font because it depends on the window tab height. @@ -164,7 +163,7 @@ TReplicantTray::TReplicantTray(TBarView* barView) } // Create the time view - fTime = new TTimeView(fMinimumTrayWidth, fMaxReplicantHeight - 1, fBarView); + fTime = new TTimeView(fMinimumTrayWidth, fMaxReplicantHeight + 1, fBarView); } @@ -267,7 +266,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight) // if mini-mode set to tab height // else if horizontal mode set to team menu item height if (fBarView->MiniState()) - height = std::max(fMinTrayHeight, fBarView->TabHeight()); + height = std::max(fMinTrayHeight, fBarView->TabHeight() - 1); else height = fBarView->TeamMenuItemHeight(); } @@ -1180,7 +1179,7 @@ TReplicantTray::LocationForReplicant(int32 index, float replicantWidth) if (fBarView->Vertical() && !fBarView->Left()) loc.x += gDragWidth; // move past dragger on left - loc.y = floorf((fBarView->TabHeight() - fMaxReplicantHeight) / 2) - 1; + loc.y = floorf((fBarView->TabHeight() - 1 - fMaxReplicantHeight) / 2); } else { loc.x -= 2; // keeps everything lined up nicely const int32 iconSize = static_cast(be_app)->TeamIconSize();