[haiku-commits] haiku: hrev50788 - src/servers/app/decorator

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 25 Dec 2016 04:10:17 +0100 (CET)

hrev50788 adds 1 changeset to branch 'master'
old head: 0f83996ab03f83523f926964f9a085ca5f55cab5
new head: 8f449285f2232e34682e34450c0e0d50d4f54998
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=8f449285f223+%5E0f83996ab03f

----------------------------------------------------------------------------

8f449285f223: 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

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50788
Commit:      8f449285f2232e34682e34450c0e0d50d4f54998
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8f449285f223
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Wed Dec 14 19:01:28 2016 UTC

----------------------------------------------------------------------------

1 file changed, 19 insertions(+), 15 deletions(-)
.../app/decorator/DefaultWindowBehaviour.cpp     | 34 +++++++++++---------

----------------------------------------------------------------------------

diff --git a/src/servers/app/decorator/DefaultWindowBehaviour.cpp 
b/src/servers/app/decorator/DefaultWindowBehaviour.cpp
index d6650d0..fd43f9c 100644
--- a/src/servers/app/decorator/DefaultWindowBehaviour.cpp
+++ b/src/servers/app/decorator/DefaultWindowBehaviour.cpp
@@ -232,7 +232,7 @@ struct DefaultWindowBehaviour::DragState : 
MouseTrackingState {
 
        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();
 
                        fBehavior.AlterDeltaForSnap(fWindow, delta, now);
@@ -241,7 +241,7 @@ struct DefaultWindowBehaviour::DragState : 
MouseTrackingState {
                        // constrain delta to true change in position
                        delta = fWindow->Frame().LeftTop() - oldLeftTop;
                } 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)
        {
-               if (!(fWindow->Flags() & B_NOT_RESIZABLE)) {
-                       if (fWindow->Flags() & B_NOT_V_RESIZABLE)
-                               delta.y = 0;
-                       if (fWindow->Flags() & B_NOT_H_RESIZABLE)
-                               delta.x = 0;
+               if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0) {
+                       if ((fWindow->Flags() & B_NOT_V_RESIZABLE) != 0)
+                               delta.y = 0.0f;
+                       if ((fWindow->Flags() & B_NOT_H_RESIZABLE) != 0)
+                               delta.x = 0.0f;
 
                        BPoint oldRightBottom = fWindow->Frame().RightBottom();
 
@@ -272,7 +272,7 @@ struct DefaultWindowBehaviour::ResizeState : 
MouseTrackingState {
                        // constrain delta to true change in size
                        delta = fWindow->Frame().RightBottom() - oldRightBottom;
                } else
-                       delta = BPoint(0, 0);
+                       delta = BPoint(0.0f, 0.0f);
        }
 };
 
@@ -300,9 +300,9 @@ struct DefaultWindowBehaviour::SlideTabState : 
MouseTrackingState {
                location += delta.x;
                AdjustMultiTabLocation(location, true);
                if (fDesktop->SetWindowTabLocation(fWindow, location, true))
-                       delta.y = 0;
+                       delta.y = 0.0f;
                else
-                       delta = BPoint(0, 0);
+                       delta = BPoint(0.0f, 0.0f);
        }
 
        void AdjustMultiTabLocation(float location, bool isShifting)
@@ -328,13 +328,17 @@ struct DefaultWindowBehaviour::SlideTabState : 
MouseTrackingState {
                        return;
 
                if (movingTab->tabOffset > location) {
-                       if (location >
-                               neighbourTab->tabOffset + 
neighbourTab->tabRect.Width() / 2)
+                       if (location
+                                       > neighbourTab->tabOffset + 
neighbourTab->tabRect.Width()
+                                       / 2) {
                                return;
+                       }
                } else {
-                       if (location + movingTab->tabRect.Width() <
-                               neighbourTab->tabOffset + 
neighbourTab->tabRect.Width() / 2)
+                       if (location + movingTab->tabRect.Width()
+                                       < neighbourTab->tabOffset + 
neighbourTab->tabRect.Width()
+                                       / 2) {
                                return;
+                       }
                }
                
                fWindow->MoveToStackPosition(neighbourIndex, isShifting);
@@ -915,7 +919,7 @@ DefaultWindowBehaviour::MouseMoved(BMessage* message, 
BPoint where, bool isFake)
        // change focus in FFM mode
        DesktopSettings desktopSettings(fDesktop);
        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
                // will cause the window that had focus last to retrieve it 
again - this
                // makes FFM much nicer to use with the keyboard.


Other related posts: