Reset cursor if kAcceptKeyboardFocusFlag is set.

This basically affects menus which are not movable, and not
resizable but have that flag set because they take input anyway.
This change shows the regular cursor over menu windows even
in window management mode when ctrl+alt are held down.

Also rename _SetNowAllowedCursor to _SetNotAllowedCursor, typo.
This commit is contained in:
John Scipione 2013-01-25 01:27:46 -05:00
parent 5a0b5a5d52
commit ae883c5f15
2 changed files with 13 additions and 7 deletions

View File

@ -702,8 +702,10 @@ DefaultWindowBehaviour::ManageWindowState::EnterState(State* previousState)
// Update the mouse cursor // Update the mouse cursor
if ((fWindow->Flags() & B_NOT_MOVABLE) == 0) if ((fWindow->Flags() & B_NOT_MOVABLE) == 0)
fBehavior._SetMoveCursor(); fBehavior._SetMoveCursor();
else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
fBehavior._ResetCursor();
else else
fBehavior._SetNowAllowedCursor(); fBehavior._SetNotAllowedCursor();
_UpdateResizeArrows(fLastMousePosition); _UpdateResizeArrows(fLastMousePosition);
} }
@ -730,8 +732,10 @@ DefaultWindowBehaviour::ManageWindowState::MouseDown(BMessage* message,
if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0) { if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0) {
fBehavior._NextState(new (std::nothrow) ResizeBorderState( fBehavior._NextState(new (std::nothrow) ResizeBorderState(
fBehavior, where, fHorizontal, fVertical)); fBehavior, where, fHorizontal, fVertical));
} else } else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
fBehavior._SetNowAllowedCursor(); fBehavior._ResetCursor();
else
fBehavior._SetNotAllowedCursor();
} }
return true; return true;
@ -745,11 +749,13 @@ DefaultWindowBehaviour::ManageWindowState::MouseMoved(BMessage* message,
// Update the mouse cursor // Update the mouse cursor
if ((fDesktop->WindowAt(where)->Flags() & B_NOT_RESIZABLE) != 0 if ((fDesktop->WindowAt(where)->Flags() & B_NOT_RESIZABLE) != 0
&& (message->FindInt32("buttons") & B_SECONDARY_MOUSE_BUTTON) != 0) { && (message->FindInt32("buttons") & B_SECONDARY_MOUSE_BUTTON) != 0) {
fBehavior._SetNowAllowedCursor(); fBehavior._SetNotAllowedCursor();
} else if ((fDesktop->WindowAt(where)->Flags() & B_NOT_MOVABLE) == 0) } else if ((fDesktop->WindowAt(where)->Flags() & B_NOT_MOVABLE) == 0)
fBehavior._SetMoveCursor(); fBehavior._SetMoveCursor();
else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
fBehavior._ResetCursor();
else else
fBehavior._SetNowAllowedCursor(); fBehavior._SetNotAllowedCursor();
// If the cursor is still over our window, update the borders. // If the cursor is still over our window, update the borders.
// Otherwise leave the state. // Otherwise leave the state.
@ -1182,7 +1188,7 @@ DefaultWindowBehaviour::_SetMoveCursor()
void void
DefaultWindowBehaviour::_SetNowAllowedCursor() DefaultWindowBehaviour::_SetNotAllowedCursor()
{ {
fDesktop->SetManagementCursor( fDesktop->SetManagementCursor(
fDesktop->GetCursorManager().GetCursor(B_CURSOR_ID_NOT_ALLOWED)); fDesktop->GetCursorManager().GetCursor(B_CURSOR_ID_NOT_ALLOWED));

View File

@ -96,7 +96,7 @@ private:
int8 vertical); int8 vertical);
void _SetMoveCursor(); void _SetMoveCursor();
void _SetNowAllowedCursor(); void _SetNotAllowedCursor();
void _SetResizeCursor(int8 horizontal, void _SetResizeCursor(int8 horizontal,
int8 vertical); int8 vertical);
void _SetBorderResizeCursor(BPoint where); void _SetBorderResizeCursor(BPoint where);