App Server DefaultWindowBehaviour: style fixes only

Compare bitmasks against 0 explicitly
Replace integer constant 0 with floating point constant 0.0f

No logic reversals I promise
This commit is contained in:
John Scipione
2016-12-24 19:01:47 -08:00
parent 0f83996ab0
commit 8f449285f2
@@ -232,7 +232,7 @@ struct DefaultWindowBehaviour::DragState : MouseTrackingState {
virtual void MouseMovedAction(BPoint& delta, bigtime_t now) virtual void MouseMovedAction(BPoint& delta, bigtime_t now)
{ {
if (!(fWindow->Flags() & B_NOT_MOVABLE)) { if ((fWindow->Flags() & B_NOT_MOVABLE) == 0) {
BPoint oldLeftTop = fWindow->Frame().LeftTop(); BPoint oldLeftTop = fWindow->Frame().LeftTop();
fBehavior.AlterDeltaForSnap(fWindow, delta, now); fBehavior.AlterDeltaForSnap(fWindow, delta, now);
@@ -241,7 +241,7 @@ struct DefaultWindowBehaviour::DragState : MouseTrackingState {
// constrain delta to true change in position // constrain delta to true change in position
delta = fWindow->Frame().LeftTop() - oldLeftTop; delta = fWindow->Frame().LeftTop() - oldLeftTop;
} else } else
delta = BPoint(0, 0); delta = BPoint(0.0f, 0.0f);
} }
}; };
@@ -259,11 +259,11 @@ struct DefaultWindowBehaviour::ResizeState : MouseTrackingState {
virtual void MouseMovedAction(BPoint& delta, bigtime_t now) virtual void MouseMovedAction(BPoint& delta, bigtime_t now)
{ {
if (!(fWindow->Flags() & B_NOT_RESIZABLE)) { if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0) {
if (fWindow->Flags() & B_NOT_V_RESIZABLE) if ((fWindow->Flags() & B_NOT_V_RESIZABLE) != 0)
delta.y = 0; delta.y = 0.0f;
if (fWindow->Flags() & B_NOT_H_RESIZABLE) if ((fWindow->Flags() & B_NOT_H_RESIZABLE) != 0)
delta.x = 0; delta.x = 0.0f;
BPoint oldRightBottom = fWindow->Frame().RightBottom(); BPoint oldRightBottom = fWindow->Frame().RightBottom();
@@ -272,7 +272,7 @@ struct DefaultWindowBehaviour::ResizeState : MouseTrackingState {
// constrain delta to true change in size // constrain delta to true change in size
delta = fWindow->Frame().RightBottom() - oldRightBottom; delta = fWindow->Frame().RightBottom() - oldRightBottom;
} else } else
delta = BPoint(0, 0); delta = BPoint(0.0f, 0.0f);
} }
}; };
@@ -300,9 +300,9 @@ struct DefaultWindowBehaviour::SlideTabState : MouseTrackingState {
location += delta.x; location += delta.x;
AdjustMultiTabLocation(location, true); AdjustMultiTabLocation(location, true);
if (fDesktop->SetWindowTabLocation(fWindow, location, true)) if (fDesktop->SetWindowTabLocation(fWindow, location, true))
delta.y = 0; delta.y = 0.0f;
else else
delta = BPoint(0, 0); delta = BPoint(0.0f, 0.0f);
} }
void AdjustMultiTabLocation(float location, bool isShifting) void AdjustMultiTabLocation(float location, bool isShifting)
@@ -328,13 +328,17 @@ struct DefaultWindowBehaviour::SlideTabState : MouseTrackingState {
return; return;
if (movingTab->tabOffset > location) { if (movingTab->tabOffset > location) {
if (location > if (location
neighbourTab->tabOffset + neighbourTab->tabRect.Width() / 2) > neighbourTab->tabOffset + neighbourTab->tabRect.Width()
/ 2) {
return; return;
}
} else { } else {
if (location + movingTab->tabRect.Width() < if (location + movingTab->tabRect.Width()
neighbourTab->tabOffset + neighbourTab->tabRect.Width() / 2) < neighbourTab->tabOffset + neighbourTab->tabRect.Width()
/ 2) {
return; return;
}
} }
fWindow->MoveToStackPosition(neighbourIndex, isShifting); fWindow->MoveToStackPosition(neighbourIndex, isShifting);
@@ -915,7 +919,7 @@ DefaultWindowBehaviour::MouseMoved(BMessage* message, BPoint where, bool isFake)
// change focus in FFM mode // change focus in FFM mode
DesktopSettings desktopSettings(fDesktop); DesktopSettings desktopSettings(fDesktop);
if (desktopSettings.FocusFollowsMouse() if (desktopSettings.FocusFollowsMouse()
&& !fWindow->IsFocus() && !(fWindow->Flags() & B_AVOID_FOCUS)) { && !fWindow->IsFocus() && (fWindow->Flags() & B_AVOID_FOCUS) == 0) {
// If the mouse move is a fake one, we set the focus to NULL, which // If the mouse move is a fake one, we set the focus to NULL, which
// will cause the window that had focus last to retrieve it again - this // will cause the window that had focus last to retrieve it again - this
// makes FFM much nicer to use with the keyboard. // makes FFM much nicer to use with the keyboard.