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

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 25 Jan 2013 09:03:51 +0100 (CET)

hrev45201 adds 1 changeset to branch 'master'
old head: ae883c5f1597be8a7098bfab659b43251839998f
new head: 70171c2634284513118df15f152d0763a5be195f
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=70171c2+%5Eae883c5

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

70171c2: A few changes to make this more robust.
  
  I am able to get stuck in window management mode without ctrl+alt
  held down somehow but it's not reproducable. These changes should
  hopefully make this a bit more robust.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

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

Revision:    hrev45201
Commit:      70171c2634284513118df15f152d0763a5be195f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=70171c2
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Jan 25 08:01:53 2013 UTC

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

1 file changed, 23 insertions(+), 25 deletions(-)
.../app/decorator/DefaultWindowBehaviour.cpp     | 48 ++++++++++----------

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

diff --git a/src/servers/app/decorator/DefaultWindowBehaviour.cpp 
b/src/servers/app/decorator/DefaultWindowBehaviour.cpp
index dd16b5c..f28d366 100644
--- a/src/servers/app/decorator/DefaultWindowBehaviour.cpp
+++ b/src/servers/app/decorator/DefaultWindowBehaviour.cpp
@@ -700,12 +700,12 @@ void
 DefaultWindowBehaviour::ManageWindowState::EnterState(State* previousState)
 {
        // Update the mouse cursor
-       if ((fWindow->Flags() & B_NOT_MOVABLE) == 0)
-               fBehavior._SetMoveCursor();
+       if ((fWindow->Flags() & B_NOT_MOVABLE) != 0)
+               fBehavior._SetNotAllowedCursor();
        else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
                fBehavior._ResetCursor();
        else
-               fBehavior._SetNotAllowedCursor();
+               fBehavior._SetMoveCursor();
 
        _UpdateResizeArrows(fLastMousePosition);
 }
@@ -747,15 +747,14 @@ 
DefaultWindowBehaviour::ManageWindowState::MouseMoved(BMessage* message,
        BPoint where, bool isFake)
 {
        // Update the mouse cursor
-       if ((fDesktop->WindowAt(where)->Flags() & B_NOT_RESIZABLE) != 0
-               && (message->FindInt32("buttons") & B_SECONDARY_MOUSE_BUTTON) 
!= 0) {
+       if ((fDesktop->WindowAt(where)->Flags() & B_NOT_MOVABLE) != 0
+               || ((fDesktop->WindowAt(where)->Flags() & B_NOT_RESIZABLE) != 0
+               && (message->FindInt32("buttons") & B_SECONDARY_MOUSE_BUTTON) 
!= 0)) {
                fBehavior._SetNotAllowedCursor();
-       } else if ((fDesktop->WindowAt(where)->Flags() & B_NOT_MOVABLE) == 0)
-               fBehavior._SetMoveCursor();
-       else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
+       } else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
                fBehavior._ResetCursor();
        else
-               fBehavior._SetNotAllowedCursor();
+               fBehavior._SetMoveCursor();
 
        // If the cursor is still over our window, update the borders.
        // Otherwise leave the state.
@@ -772,15 +771,13 @@ 
DefaultWindowBehaviour::ManageWindowState::ModifiersChanged(BPoint where,
        int32 modifiers)
 {
        fBehavior.fLastModifiers = modifiers;
-       if (!fBehavior._IsWindowModifier(modifiers)) {
-               if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0
-                       && fBehavior._IsControlModifier(modifiers)) {
-                       fBehavior._SetBorderResizeCursor(where);
-               } else
-                       fBehavior._ResetCursor();
+       if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0
+               && fBehavior._IsControlModifier(modifiers)) {
+               fBehavior._SetBorderResizeCursor(where);
+       } else
+               fBehavior._ResetCursor();
 
-               fBehavior._NextState(NULL);
-       }
+       fBehavior._NextState(NULL);
 }
 
 
@@ -1043,12 +1040,12 @@ DefaultWindowBehaviour::MouseMoved(BMessage* message, 
BPoint where,
        if (fState != NULL) {
                fState->MouseMoved(message, where, isFake);
        } else {
-               int32 modifiers = message->FindInt32("modifiers");
-               if (_IsWindowModifier(modifiers)) {
+               fLastModifiers = message->FindInt32("modifiers");
+               if (_IsWindowModifier(fLastModifiers)) {
                        // Enter the window management state.
                        _NextState(new(std::nothrow) ManageWindowState(*this, 
where));
                } else if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0
-                       && _IsControlModifier(modifiers)) {
+                       && _IsControlModifier(fLastModifiers)) {
                        _SetBorderResizeCursor(where);
                } else
                        _ResetCursor();
@@ -1072,12 +1069,12 @@ DefaultWindowBehaviour::MouseUp(BMessage* message, 
BPoint where)
        if (fState != NULL)
                fState->MouseUp(message, where);
        else {
-               int32 modifiers = message->FindInt32("modifiers");
-               if (_IsWindowModifier(modifiers)) {
+               fLastModifiers = message->FindInt32("modifiers");
+               if (_IsWindowModifier(fLastModifiers)) {
                        // Enter the window management state.
                        _NextState(new(std::nothrow) ManageWindowState(*this, 
where));
                } else if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0
-                       && _IsControlModifier(modifiers)) {
+                       && _IsControlModifier(fLastModifiers)) {
                        _SetBorderResizeCursor(where);
                } else
                        _ResetCursor();
@@ -1095,11 +1092,12 @@ DefaultWindowBehaviour::ModifiersChanged(int32 
modifiers)
        if (fState != NULL) {
                fState->ModifiersChanged(where, modifiers);
        } else {
-               if (_IsWindowModifier(modifiers)) {
+               fLastModifiers = modifiers;
+               if (_IsWindowModifier(fLastModifiers)) {
                        // Enter the window management state.
                        _NextState(new(std::nothrow) ManageWindowState(*this, 
where));
                } else if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0
-                       && _IsControlModifier(modifiers)) {
+                       && _IsControlModifier(fLastModifiers)) {
                        _SetBorderResizeCursor(where);
                } else
                        _ResetCursor();


Other related posts:

  • » [haiku-commits] haiku: hrev45201 - src/servers/app/decorator - jscipione