ShowImage: Avoid cutting off the toolbar in fullscreen mode

Fixes #20013

Change-Id: Iab55f9315473b8c010a9853ea9c9fa75b37d66df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10617
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
nipos
2026-05-15 06:34:09 +00:00
committed by Adrien Destugues
parent 36aa36d060
commit 73bbb6644e
+6 -7
View File
@@ -197,8 +197,6 @@ ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref,
tool_bar_icon(kIconViewWindowed), B_TRANSLATE("Leave full screen"));
fToolBar->SetActionVisible(MSG_FULL_SCREEN, false);
fToolBar->ResizeTo(viewFrame.Width(), fToolBar->MinSize().height);
contentView->AddChild(fToolBar);
if (fShowToolBar)
@@ -244,6 +242,8 @@ ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref,
gridLayout->AddView(hScrollBarContainer, 1, 1);
}
fToolBar->ResizeTo(-fVScrollBar->PreferredSize().width, fToolBar->MinSize().height);
fVScrollBar->SetTarget(fImageView);
fHScrollBar->SetTarget(fImageView);
@@ -529,9 +529,8 @@ ShowImageWindow::_ResizeWindowToImage()
// TODO: use View::GetPreferredSize() instead?
BRect r(bitmap->Bounds());
float width = r.Width() + be_control_look->GetScrollBarWidth(B_VERTICAL);
float height = r.Height() + 1 + fBar->Frame().Height()
+ be_control_look->GetScrollBarWidth(B_HORIZONTAL);
float width = r.Width() + fVScrollBar->PreferredSize().width;
float height = r.Height() + 1 + fBar->Frame().Height() + fHScrollBar->PreferredSize().height;
BRect frame = screen.Frame();
const float windowBorder = 5;
@@ -1367,8 +1366,8 @@ ShowImageWindow::_ToggleFullScreen()
fWindowFrame = Frame();
frame = screen.Frame();
frame.top -= fBar->Bounds().Height() + 1;
frame.right += be_control_look->GetScrollBarWidth(B_VERTICAL);
frame.bottom += be_control_look->GetScrollBarWidth(B_HORIZONTAL);
frame.right += fVScrollBar->PreferredSize().width;
frame.bottom += fHScrollBar->PreferredSize().height;
SetFlags(Flags() | B_NOT_RESIZABLE | B_NOT_MOVABLE);