Deskbar: Update window resize size limits
With B_NOT_V_RESIZABLE ctrl+alt+rmb can be used to resize the window in undesired ways. Set window size limits to prevent user from resizing the window beyond the set size limits. Update window size limits on ScreenChanged() Fixes #15067 Change-Id: Ia10eafb9860009019be35ec5c244d034861eeae9 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1968 Reviewed-by: Axel Dörfler <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
7586efaf07
commit
7e27cd8e6f
@@ -733,6 +733,10 @@ TBarView::_ChangeState(BMessage* message)
|
||||
// enable or disable preference items.
|
||||
|
||||
if (vertSwap) {
|
||||
TBarWindow* window = dynamic_cast<TBarWindow*>(Window());
|
||||
if (window != NULL)
|
||||
window->SetSizeLimits();
|
||||
|
||||
fReplicantTray->fTime->SetOrientation(fVertical);
|
||||
if (fExpandoMenuBar != NULL) {
|
||||
if (fVertical) {
|
||||
|
||||
@@ -102,6 +102,8 @@ TBarWindow::TBarWindow()
|
||||
|
||||
RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY);
|
||||
AddShortcut('F', B_COMMAND_KEY, new BMessage(kFindButton));
|
||||
|
||||
SetSizeLimits();
|
||||
}
|
||||
|
||||
|
||||
@@ -294,6 +296,7 @@ TBarWindow::ScreenChanged(BRect size, color_space depth)
|
||||
BWindow::ScreenChanged(size, depth);
|
||||
|
||||
fBarView->UpdatePlacement();
|
||||
SetSizeLimits();
|
||||
}
|
||||
|
||||
|
||||
@@ -647,6 +650,20 @@ TBarWindow::IsShowingMenu() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TBarWindow::SetSizeLimits()
|
||||
{
|
||||
BRect screenFrame = (BScreen(this)).Frame();
|
||||
if (fBarView->Vertical()) {
|
||||
BWindow::SetSizeLimits(gMinimumWindowWidth, gMaximumWindowWidth,
|
||||
kMenuBarHeight - 1, screenFrame.Height());
|
||||
} else {
|
||||
BWindow::SetSizeLimits(screenFrame.Width(), screenFrame.Width(),
|
||||
kMenuBarHeight - 1, kMaximumIconSize + 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TBarWindow::_IsFocusMessage(BMessage* message)
|
||||
{
|
||||
|
||||
@@ -87,6 +87,8 @@ public:
|
||||
|
||||
bool IsShowingMenu() const;
|
||||
|
||||
void SetSizeLimits();
|
||||
|
||||
private:
|
||||
bool _IsFocusMessage(BMessage* message);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user