From f9b3a3b1f346d1edf135b1813787d72e01f633fd Mon Sep 17 00:00:00 2001 From: John Scipione Date: Thu, 13 Aug 2020 00:07:15 -0400 Subject: [PATCH] Deskbar: Restore old mini-mode ... with the replicant tray below the menu bar. Deskbar now has four modes: 1. vertical mini-mode (old mini-mode) 2. horizontal mini-mode (new mini-mode, was vertical) 3. vertical expando-mode (default) 4. horizonal expando-mode Horizontal mini-mode gets the corner, then it switches to vertical mini-mode above or below that, then to vertical expando-mode after that. Horizontal expando mode is in center-screen top and bottom. Clock vertical centering simplification. Change-Id: I216008c20feb28f793693046792bbcfdf1e703e3 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3146 Reviewed-by: Adrien Destugues --- src/apps/deskbar/BarMenuTitle.cpp | 2 +- src/apps/deskbar/BarView.cpp | 171 ++++++++++++++--------------- src/apps/deskbar/BarView.h | 7 +- src/apps/deskbar/BarWindow.cpp | 35 ++++-- src/apps/deskbar/StatusView.cpp | 177 ++++++++++++++++-------------- src/apps/deskbar/StatusView.h | 14 ++- src/apps/deskbar/TimeView.cpp | 3 +- 7 files changed, 222 insertions(+), 187 deletions(-) diff --git a/src/apps/deskbar/BarMenuTitle.cpp b/src/apps/deskbar/BarMenuTitle.cpp index 7fce780057f..3d82e432c5b 100644 --- a/src/apps/deskbar/BarMenuTitle.cpp +++ b/src/apps/deskbar/BarMenuTitle.cpp @@ -136,7 +136,7 @@ TBarMenuTitle::DrawContent() // cut-off the leaf bool isLeafMenu = dynamic_cast(fMenu) != NULL; - if (fBarView->Vertical() && isLeafMenu) + if (isLeafMenu) iconRect.OffsetBy(widthOffset, frame.Height() - iconRect.Height() + 2); else iconRect.OffsetBy(widthOffset, heightOffset); diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 09cc4a0f3c8..d668c47b521 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -465,16 +465,19 @@ TBarView::PlaceDeskbarMenu() // Calculate the size of the deskbar menu BRect menuFrame(Bounds()); if (fVertical) { - if (fState == kMiniState) - width = gMinimumWindowWidth; - else - width = fBarApp->Settings()->width; - + width = static_cast(be_app)->Settings()->width; height = fTabHeight; } else { - width = gMinimumWindowWidth / 2 + kIconPadding; - height = std::max(TeamMenuItemHeight(), - kGutter + fReplicantTray->MaxReplicantHeight() + kGutter); + // horizontal + if (fState == kMiniState) { + width = gMinimumWindowWidth; + height = std::max(fTabHeight, + kGutter + fReplicantTray->MaxReplicantHeight() + kGutter); + } else { + width = gMinimumWindowWidth / 2 + kIconPadding; + height = std::max(TeamMenuItemHeight(), + kGutter + fReplicantTray->MaxReplicantHeight() + kGutter); + } } menuFrame.bottom = menuFrame.top + height; @@ -485,24 +488,14 @@ TBarView::PlaceDeskbarMenu() } else fBarMenuBar->SmartResize(-1, -1); - if (fVertical) { - switch (fState) { - case kFullState: - case kExpandoState: - default: - // shows apps below tray - fBarMenuBar->RemoveTeamMenu(); - fBarMenuBar->RemoveSeperatorItem(); - break; - - case kMiniState: - // leaf menu next to team menu - fBarMenuBar->RemoveSeperatorItem(); - fBarMenuBar->AddTeamMenu(); - break; - } + if (fState == kMiniState) { + // vertical or horizontal mini + fBarMenuBar->RemoveSeperatorItem(); + fBarMenuBar->AddTeamMenu(); + } else if (fVertical) { + fBarMenuBar->RemoveSeperatorItem(); + fBarMenuBar->RemoveTeamMenu(); } else { - // shows apps to the right of the leaf menu fBarMenuBar->RemoveTeamMenu(); fBarMenuBar->AddSeparatorItem(); } @@ -529,20 +522,27 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap) // also resizes replicant tray if (fVertical) { - if (fState == kExpandoState || fState == kFullState) { - // move replicant tray down by 2px - if (fLeft) { - // move replicant tray past dragger and shrink by same amount - fReplicantTray->MoveTo(kDragWidth + 1, 2); - fReplicantTray->ResizeBy(-(kDragWidth + 1), -2); - } else { - fReplicantTray->MoveTo(0, 2); - fReplicantTray->ResizeBy(0, -2); - } + if (fResizeControl->IsHidden()) + fResizeControl->Show(); - statusLoc.x = 0; - statusLoc.y = fBarMenuBar->Frame().bottom + 1; - } else if (fState == kMiniState) { + if (fLeft) { + // move replicant tray past dragger width on left + // also down 1px so it won't cover the border + fReplicantTray->MoveTo(kDragWidth + kGutter, kGutter); + + // shrink width by same amount + fReplicantTray->ResizeBy(-(kDragWidth + kGutter), 0); + } else { + // move replicant tray down 1px so it won't cover the border + fReplicantTray->MoveTo(0, kGutter); + } + + statusLoc.x = 0; + statusLoc.y = fBarMenuBar->Frame().bottom + 1; + } else { + // horizontal + if (fState == kMiniState) { + // horizontal mini statusLoc.x = fLeft ? fBarMenuBar->Frame().right + 1 : 0; statusLoc.y = 0; @@ -550,25 +550,22 @@ TBarView::PlaceTray(bool vertSwap, bool leftSwap) // and make room for the top and bottom borders fReplicantTray->MoveTo(fLeft ? kDragWidth : 0, kGutter); fReplicantTray->ResizeBy(0, -4); + } else { + // move tray right and down to not cover border, resize by same + fReplicantTray->MoveTo(2, 0); + fReplicantTray->ResizeBy(-2, 0); + BRect screenFrame = (BScreen(Window())).Frame(); + statusLoc.x = screenFrame.right - fDragRegion->Bounds().Width(); + statusLoc.y = 0; } - } else { - // horizontal - - // move tray right and down to not cover border, resize by same - fReplicantTray->MoveTo(2, 0); - fReplicantTray->ResizeBy(-2, 0); - BRect screenFrame = (BScreen(Window())).Frame(); - statusLoc.x = screenFrame.right - fDragRegion->Bounds().Width(); - statusLoc.y = 0; } fDragRegion->MoveTo(statusLoc); // make room for top and bottom border - fResizeControl->ResizeTo(kDragWidth, fDragRegion->Bounds().Height() - 2); + fResizeControl->ResizeTo(kDragWidth, fDragRegion->Bounds().Height() - 2); - // resize control is only used in vertical expando and full state - if (fVertical && fState != kMiniState) { + if (fVertical) { // move resize control into place based on width setting fResizeControl->MoveTo( fLeft ? fBarApp->Settings()->width - kDragWidth : 0, 1); @@ -588,16 +585,19 @@ void TBarView::PlaceApplicationBar() { BRect screenFrame = (BScreen(Window())).Frame(); - if (fVertical && fState == kMiniState) { + if (fState == kMiniState) { if (!fInlineScrollView->IsHidden()) fInlineScrollView->Hide(); SizeWindow(screenFrame); PositionWindow(screenFrame); Window()->UpdateIfNeeded(); - // move the menu bar into place after the window has been resized - // based on replicant tray - fBarMenuBar->MoveTo(fLeft ? 0 : fDragRegion->Bounds().right + 1, 0); + if (!fVertical) { + // move the menu bar into place after the window has been resized + // based on replicant tray + fBarMenuBar->MoveTo(fLeft ? 0 : fDragRegion->Bounds().right + 1, + 0); + } Invalidate(); return; } @@ -652,40 +652,37 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width, windowWidth = screenFrame.Width(); } else windowWidth = kHiddenDimension; - } else if (!fVertical) { - // horizontal top or bottom - windowHeight = std::max(TeamMenuItemHeight(), - kGutter + fReplicantTray->MaxReplicantHeight() + kGutter); - windowWidth = screenFrame.Width(); - } else { - // vertical - switch (fState) { - case kFullState: - case kExpandoState: - default: - // top left or right - if (fTrayLocation != 0) - windowHeight = fDragRegion->Frame().bottom + 1; - else - windowHeight = fBarMenuBar->Frame().bottom + 1; - - // use Height() here not bottom because view can be scrolled - if (fExpandoMenuBar != NULL) - windowHeight += fExpandoMenuBar->Bounds().Height(); - - // full state has minimum screen window height - if (fState == kFullState) - windowHeight = std::max(screenFrame.bottom, windowHeight); + } else if (fVertical) { + if (fState == kFullState) { + // full state has minimum screen window height + windowHeight = std::max(screenFrame.bottom, windowHeight); + } else { + // mini or expando + if (fTrayLocation != 0) + windowHeight = fDragRegion->Frame().bottom; + else + windowHeight = fBarMenuBar->Frame().bottom; - windowWidth = fBarApp->Settings()->width; - break; + if (fState == kExpandoState && fExpandoMenuBar != NULL) { + // top left or right + windowHeight += fExpandoMenuBar->Bounds().Height(); + // use Height() here, not bottom so view can be scrolled + } + } - case kMiniState: - // four corners - windowHeight = fBarMenuBar->Frame().bottom; - windowWidth = fDragRegion->Frame().Width() - + fBarMenuBar->Frame().Width() + 1; - break; + windowWidth = fBarApp->Settings()->width; + } else { + // horizontal + if (fState == kMiniState) { + // four corners horizontal + windowHeight = fBarMenuBar->Frame().Height(); + windowWidth = fDragRegion->Frame().Width() + + fBarMenuBar->Frame().Width() + 1; + } else { + // horizontal top or bottom + windowHeight = std::max(TeamMenuItemHeight(), + kGutter + fReplicantTray->MaxReplicantHeight() + kGutter); + windowWidth = screenFrame.Width(); } } @@ -714,7 +711,7 @@ TBarView::PositionWindow(BRect screenFrame) BPoint moveLoc(0, 0); // right, expanded, mini, or full - if (!fLeft && fVertical) + if (!fLeft && (fVertical || fState == kMiniState)) moveLoc.x = screenFrame.right - windowWidth; // bottom, full diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h index 0589bb996fd..6c704b277f7 100644 --- a/src/apps/deskbar/BarView.h +++ b/src/apps/deskbar/BarView.h @@ -106,9 +106,10 @@ class TBarView : public BView { bool Vertical() const { return fVertical; }; bool Left() const { return fLeft; }; bool Top() const { return fTop; }; - bool AcrossTop() const { return fTop && !fVertical; }; - bool AcrossBottom() const - { return !fTop && !fVertical; }; + bool AcrossTop() const { return fTop && !fVertical + && fState != kMiniState; }; + bool AcrossBottom() const { return !fTop && !fVertical + && fState != kMiniState; }; // window state methods bool ExpandoState() const diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp index 98a386cc284..418384dede5 100644 --- a/src/apps/deskbar/BarWindow.cpp +++ b/src/apps/deskbar/BarWindow.cpp @@ -244,7 +244,7 @@ TBarWindow::Minimize(bool minimize) void TBarWindow::FrameResized(float width, float height) { - if (fBarView->MiniState() || !fBarView->Vertical()) + if (!fBarView->Vertical()) return BWindow::FrameResized(width, height); bool setToHiddenSize = fBarApp->Settings()->autoHide @@ -686,19 +686,34 @@ TBarWindow::SetSizeLimits() 0, kHiddenDimension); } } else { + float minHeight; + float maxHeight; + float minWidth; + float maxWidth; + if (fBarView->Vertical()) { - float minHeight = 0; - float maxHeight = B_SIZE_UNLIMITED; - float minWidth = gMinimumWindowWidth; - float maxWidth = fBarView->MiniState() ? B_SIZE_UNLIMITED - : gMaximumWindowWidth; - BWindow::SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); + minHeight = fBarView->TabHeight(); + maxHeight = B_SIZE_UNLIMITED; + minWidth = gMinimumWindowWidth; + maxWidth = gMaximumWindowWidth; } else { - BWindow::SetSizeLimits(screenFrame.Width(), screenFrame.Width(), - kMenuBarHeight - 1, kMaximumIconSize + 4); + // horizontal + if (fBarView->MiniState()) { + minWidth = gMinimumWindowWidth; + maxWidth = B_SIZE_UNLIMITED; + minHeight = fBarView->TabHeight(); + maxHeight = std::max(fBarView->TabHeight(), kGutter + + fBarView->ReplicantTray()->MaxReplicantHeight() + + kGutter); + } else { + minWidth = maxWidth = screenFrame.Width(); + minHeight = kMenuBarHeight - 1; + maxHeight = kMaximumIconSize + 4; + } } - } + BWindow::SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); + } } diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index 2a311442be0..875a94cb9b3 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -77,6 +77,9 @@ All rights reserved. #include "TimeView.h" +static const float kVerticalMiniMultiplier = 2.9f; + + #ifdef DB_ADDONS // Add-on support // @@ -229,8 +232,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight) float width = 0; float height = fMinTrayHeight; - if (fBarView->Vertical() - && (fBarView->ExpandoState() || fBarView->FullState())) { + if (fBarView->Vertical()) { width = static_cast(be_app)->Settings()->width - kDragWidth - kGutter; if (fRightBottomReplicant.IsValid()) @@ -261,7 +263,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->Vertical() && fBarView->MiniState()) + if (fBarView->MiniState()) height = std::max(fMinTrayHeight, fBarView->TabHeight()); else height = fBarView->TeamMenuItemHeight(); @@ -1143,7 +1145,7 @@ TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message) alignment align = B_ALIGN_LEFT; if (fAlignmentSupport && message->HasBool("deskbar:dynamic_align")) { - if (!fBarView->Vertical()) + if (!fBarView->Vertical() && !fBarView->MiniState()) align = B_ALIGN_RIGHT; else align = fBarView->Left() ? B_ALIGN_LEFT : B_ALIGN_RIGHT; @@ -1172,19 +1174,17 @@ BPoint TReplicantTray::LocationForReplicant(int32 index, float replicantWidth) { BPoint loc(kTrayPadding, 0); - if (fBarView->Vertical()) { - if (fBarView->MiniState()) - loc.y = floorf((fBarView->TabHeight() - fMaxReplicantHeight) / 2); - else if (!fBarView->Left()) { - // move past dragger on right - loc.x += kDragWidth; - loc.y += 1; - } + if (fBarView->Vertical() || fBarView->MiniState()) { + if (fBarView->Vertical() && !fBarView->Left()) + loc.x += kDragWidth; // move past dragger on left + + loc.y = floorf((fBarView->TabHeight() - fMaxReplicantHeight) / 2) - 1; } else { loc.x -= 2; // keeps everything lined up nicely const int32 iconSize = static_cast(be_app)->IconSize(); float yOffset = iconSize > B_MINI_ICON ? 3 : 2; // squeeze icons in there at 16x16, reduce border by 1px + if (fBarView->Top()) { // align top loc.y = yOffset; @@ -1195,8 +1195,11 @@ TReplicantTray::LocationForReplicant(int32 index, float replicantWidth) } } - if (fBarView->Vertical() - && (fBarView->ExpandoState() || fBarView->FullState())) { + // move clock vertically centered in first row next to replicants + fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - kTrayPadding, + loc.y + floorf((fMaxReplicantHeight - fTime->fHeight) / 2)); + + if (fBarView->Vertical()) { // try to find free space in every row for (int32 row = 0; ; loc.y += fMaxReplicantHeight + kIconGap, row++) { // determine free space in this row @@ -1231,12 +1234,8 @@ TReplicantTray::LocationForReplicant(int32 index, float replicantWidth) // check next row } - - // move clock into place vertically centered in first row - fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - kTrayPadding, - floorf((fMaxReplicantHeight - fTime->fHeight) / 2) + 1); } else { - // horizontal or mini-mode + // horizontal if (index > 0) { // get the last replicant added for placement reference BView* view = NULL; @@ -1246,10 +1245,6 @@ TReplicantTray::LocationForReplicant(int32 index, float replicantWidth) loc.x = view->Frame().right + kIconGap + 1; } } - - // move clock into place vertically centered next to replicants - fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - kTrayPadding, - loc.y + floorf((fMaxReplicantHeight - fTime->fHeight) / 2)); } if (loc.y > fRightBottomReplicant.top @@ -1395,9 +1390,7 @@ TDragRegion::GetPreferredSize(float* width, float* height) else *width += 6; - bool vertical = fBarView->Vertical(); - bool expandoOrFull = fBarView->ExpandoState() || fBarView->FullState(); - if (vertical && expandoOrFull) + if (fBarView->Vertical() && !fBarView->MiniState()) *height += 3; // add a pixel for an extra border on top else *height += 2; // all other modes have a 1px border on top and bottom @@ -1415,17 +1408,15 @@ TDragRegion::Draw(BRect updateRect) BRect frame(Bounds()); BeginLineArray(4); - if (fBarView->Vertical() - && (fBarView->ExpandoState() || fBarView->FullState())) { - // vertical expando or full state, draw 2 lines at the top + if (fBarView->Vertical()) { + // vertical expando full or mini state, draw 2 lines at the top AddLine(frame.LeftTop(), frame.RightTop(), dark); AddLine(BPoint(frame.left, frame.top + 1), BPoint(frame.right, frame.top + 1), ldark); // add hilight along bottom AddLine(BPoint(frame.left + 1, frame.bottom), BPoint(frame.right - 1, frame.bottom), hilite); - } else if ((fBarView->Vertical() && fBarView->MiniState()) - || fBarView->AcrossTop() || fBarView->AcrossBottom()) { + } else { // mini-mode or horizontal, draw hilight along top left and bottom AddLine(frame.LeftTop(), frame.RightTop(), hilite); AddLine(BPoint(frame.left, frame.top + 1), frame.LeftBottom(), hilite); @@ -1501,10 +1492,8 @@ TDragRegion::DragRegion() const bool placeOnLeft = false; if (fDragLocation == kAutoPlaceDragRegion) { - if (fBarView->Vertical() && fBarView->Left()) - placeOnLeft = true; - else - placeOnLeft = false; + placeOnLeft = fBarView->Left() + && (fBarView->Vertical() || fBarView->MiniState()); } else placeOnLeft = fDragLocation == kDragRegionLeft; @@ -1591,38 +1580,57 @@ TDragRegion::CalculateRegions() float halfScreen = floorf(screenFrame.Height() / 2); // corners - fTopLeft.Set(BRect(screenFrame.left, screenFrame.top, + fTopLeftVertical.Set(BRect(screenFrame.left, + screenFrame.top + menuBarHeight, screenFrame.left + hDivider, + screenFrame.top + floorf(menuBarHeight * kVerticalMiniMultiplier))); + fTopRightVertical.Set(BRect(screenFrame.right - hDivider, + screenFrame.top + menuBarHeight, screenFrame.right, + screenFrame.top + floorf(menuBarHeight * kVerticalMiniMultiplier))); + fBottomLeftVertical.Set(BRect(screenFrame.left, + screenFrame.bottom - floorf(menuBarHeight * kVerticalMiniMultiplier), + screenFrame.left + hDivider, screenFrame.bottom - menuBarHeight)); + fBottomRightVertical.Set(BRect(screenFrame.right - hDivider, + screenFrame.bottom - floorf(menuBarHeight * kVerticalMiniMultiplier), + screenFrame.right, screenFrame.bottom - menuBarHeight)); + + fTopLeftHorizontal.Set(BRect(screenFrame.left, screenFrame.top, screenFrame.left + hDivider, screenFrame.top + menuBarHeight)); - fTopRight.Set(BRect(screenFrame.right - hDivider, screenFrame.top, + fTopRightHorizontal.Set(BRect(screenFrame.right - hDivider, screenFrame.top, screenFrame.right, screenFrame.top + menuBarHeight)); - fBottomLeft.Set(BRect(screenFrame.left, screenFrame.bottom - menuBarHeight, + fBottomLeftHorizontal.Set(BRect(screenFrame.left, screenFrame.bottom - menuBarHeight, screenFrame.left + hDivider, screenFrame.bottom)); - fBottomRight.Set(BRect(screenFrame.right - hDivider, + fBottomRightHorizontal.Set(BRect(screenFrame.right - hDivider, screenFrame.bottom - menuBarHeight, screenFrame.right, screenFrame.bottom)); // left/right expando fMiddleLeft.Set(BRect(screenFrame.left, screenFrame.top, screenFrame.left + hDivider, screenFrame.bottom)); - fMiddleLeft.Exclude(&fTopLeft); - fMiddleLeft.Exclude(&fBottomLeft); + fMiddleLeft.Exclude(&fTopLeftHorizontal); + fMiddleLeft.Exclude(&fBottomLeftHorizontal); + fMiddleLeft.Exclude(&fTopLeftVertical); + fMiddleLeft.Exclude(&fBottomLeftVertical); fMiddleRight.Set(BRect(screenFrame.right - hDivider, screenFrame.top, screenFrame.right, screenFrame.bottom)); - fMiddleRight.Exclude(&fTopRight); - fMiddleRight.Exclude(&fBottomRight); + fMiddleRight.Exclude(&fTopRightHorizontal); + fMiddleRight.Exclude(&fBottomRightHorizontal); + fMiddleRight.Exclude(&fTopRightVertical); + fMiddleRight.Exclude(&fBottomRightVertical); #ifdef FULL_MODE // left/right full fLeftSide.Set(BRect(screenFrame.left, screenFrame.bottom - halfScreen, screenFrame.left + hDivider, screenFrame.bottom)); - fLeftSide.Exclude(&fBottomLeft); + fLeftSide.Exclude(&fBottomLeftHorizontal); + fLeftSide.Exclude(&fBottomLeftVertical); fMiddleLeft.Exclude(&fLeftSide); fRightSide.Set(BRect(screenFrame.right - hDivider, screenFrame.bottom - halfScreen, screenFrame.right, screenFrame.bottom)); - fRightSide.Exclude(&fBottomRight); + fRightSide.Exclude(&fBottomRightHorizontal); + fRightSide.Exclude(&fBottomRightVertical); fMiddleRight.Exclude(&fRightSide); #endif @@ -1663,15 +1671,24 @@ TDragRegion::MouseMoved(BPoint where, uint32 transit, } // use short circuit evaluation for convenience - if (// mini - SwitchModeForRegion(whereScreen, fTopLeft, true, true, true, - kMiniState) - || SwitchModeForRegion(whereScreen, fTopRight, true, false, true, - kMiniState) - || SwitchModeForRegion(whereScreen, fBottomLeft, true, true, false, - kMiniState) - || SwitchModeForRegion(whereScreen, fBottomRight, true, false, false, - kMiniState) + if (// vertical mini + SwitchModeForRegion(whereScreen, fTopLeftVertical, true, + true, true, kMiniState) + || SwitchModeForRegion(whereScreen, fTopRightVertical, true, + false, true, kMiniState) + || SwitchModeForRegion(whereScreen, fBottomLeftVertical, true, + true, false, kMiniState) + || SwitchModeForRegion(whereScreen, fBottomRightVertical, true, + false, false, kMiniState) + // horizontal mini + || SwitchModeForRegion(whereScreen, fTopLeftHorizontal, false, + true, true, kMiniState) + || SwitchModeForRegion(whereScreen, fTopRightHorizontal, false, + false, true, kMiniState) + || SwitchModeForRegion(whereScreen, fBottomLeftHorizontal, false, + true, false, kMiniState) + || SwitchModeForRegion(whereScreen, fBottomRightHorizontal, false, + false, false, kMiniState) // expando || SwitchModeForRegion(whereScreen, fMiddleLeft, true, true, true, kExpandoState) @@ -1823,34 +1840,34 @@ void TResizeControl::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage) { - if (IsResizing() && fBarView->Vertical() - && (fBarView->ExpandoState() || fBarView->FullState())) { - float windowWidth = Window()->Frame().Width(); - float delta = 0; - BPoint whereScreen = ConvertToScreen(where); - - if (fBarView->Left()) { - delta = whereScreen.x - Window()->Frame().right; - if (delta > 0 && windowWidth >= gMaximumWindowWidth) - ; // do nothing - else if (delta < 0 && windowWidth <= gMinimumWindowWidth) - ; // do nothing - else - Window()->ResizeBy(delta, 0); - } else { - delta = Window()->Frame().left - whereScreen.x; - if (delta > 0 && windowWidth >= gMaximumWindowWidth) - ; // do nothing - else if (delta < 0 && windowWidth <= gMinimumWindowWidth) - ; // do nothing - else { - Window()->MoveBy(delta, 0); - Window()->ResizeBy(delta, 0); - } + if (!fBarView->Vertical() || !IsResizing()) + return BControl::MouseMoved(where, code, dragMessage); + + float windowWidth = Window()->Frame().Width(); + float delta = 0; + BPoint whereScreen = ConvertToScreen(where); + + if (fBarView->Left()) { + delta = whereScreen.x - Window()->Frame().right; + if (delta > 0 && windowWidth >= gMaximumWindowWidth) + ; // do nothing + else if (delta < 0 && windowWidth <= gMinimumWindowWidth) + ; // do nothing + else + Window()->ResizeBy(delta, 0); + } else { + delta = Window()->Frame().left - whereScreen.x; + if (delta > 0 && windowWidth >= gMaximumWindowWidth) + ; // do nothing + else if (delta < 0 && windowWidth <= gMinimumWindowWidth) + ; // do nothing + else { + Window()->MoveBy(delta, 0); + Window()->ResizeBy(delta, 0); } - - windowWidth = Window()->Frame().Width(); } + windowWidth = Window()->Frame().Width(); + BControl::MouseMoved(where, code, dragMessage); } diff --git a/src/apps/deskbar/StatusView.h b/src/apps/deskbar/StatusView.h index 1225a9212d3..54a3952789f 100644 --- a/src/apps/deskbar/StatusView.h +++ b/src/apps/deskbar/StatusView.h @@ -231,10 +231,16 @@ class TDragRegion : public BControl { BPoint fPreviousPosition; int32 fDragLocation; - BRegion fTopLeft; - BRegion fTopRight; - BRegion fBottomLeft; - BRegion fBottomRight; + BRegion fTopLeftVertical; + BRegion fTopRightVertical; + BRegion fBottomLeftVertical; + BRegion fBottomRightVertical; + + BRegion fTopLeftHorizontal; + BRegion fTopRightHorizontal; + BRegion fBottomLeftHorizontal; + BRegion fBottomRightHorizontal; + BRegion fMiddleLeft; BRegion fMiddleRight; #ifdef FULL_MODE diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index 0a6292e232b..d9e38d73963 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -532,6 +532,5 @@ TTimeView::Vertical() if (fBarView == NULL) return true; - return fBarView->Vertical() - && (fBarView->ExpandoState() || fBarView->FullState()); + return fBarView->Vertical(); }