BWindow: Update Zoom() with Deskbar window flags

Call newly created BDeskbar methods to adjust default Zoom().

if auto-hide is turned on don't consider Deskbar's frame.

In vertical mode allow windows to zoom on top of Deskbar if
auto-raise or always on top is turned on.

Deskbar can take up a significant area so you can reclaim that
space by turning on auto-raise or always on top.

In horizontal mode ignore auto-raise and always on top settings,
don't allow windows to zoom on top of Deskbar even if these
settings are turned on.

Deskbar doesn't take up very much space and you don't want your
window to get cut-off at the bottom.
This commit is contained in:
John Scipione
2017-11-27 11:13:50 -08:00
parent fc23c09758
commit fd236f33cd
+22 -17
View File
@@ -1703,28 +1703,33 @@ BWindow::Zoom()
BRect zoomArea = screenFrame; // starts at screen size
// remove area taken up by Deskbar
BDeskbar deskbar;
BRect deskbarFrame = deskbar.Frame();
switch (deskbar.Location()) {
case B_DESKBAR_TOP:
zoomArea.top = deskbarFrame.bottom + 2;
break;
if (!deskbar.IsAutoHide()) {
// remove area taken up by Deskbar (if not auto-hidden)
switch (deskbar.Location()) {
case B_DESKBAR_TOP:
zoomArea.top = deskbarFrame.bottom + 2;
break;
case B_DESKBAR_BOTTOM:
zoomArea.bottom = deskbarFrame.top - 2;
break;
case B_DESKBAR_BOTTOM:
zoomArea.bottom = deskbarFrame.top - 2;
break;
case B_DESKBAR_LEFT_TOP:
case B_DESKBAR_LEFT_BOTTOM:
zoomArea.left = deskbarFrame.right + 2;
break;
// in vertical mode, only if not always on top and not auto-raise
case B_DESKBAR_LEFT_TOP:
case B_DESKBAR_LEFT_BOTTOM:
if (!deskbar.IsAlwaysOnTop() && !deskbar.IsAutoRaise())
zoomArea.left = deskbarFrame.right + 2;
break;
default:
case B_DESKBAR_RIGHT_TOP:
case B_DESKBAR_RIGHT_BOTTOM:
zoomArea.right = deskbarFrame.left - 2;
break;
default:
case B_DESKBAR_RIGHT_TOP:
case B_DESKBAR_RIGHT_BOTTOM:
if (!deskbar.IsAlwaysOnTop() && !deskbar.IsAutoRaise())
zoomArea.right = deskbarFrame.left - 2;
break;
}
}
// TODO: Broken for tab on left side windows...