Skip to content

Commit

Permalink
Reset cursor if kAcceptKeyboardFocusFlag is set.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jscipione committed Jan 25, 2013
1 parent 5a0b5a5 commit ae883c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/servers/app/decorator/DefaultWindowBehaviour.cpp
Expand Up @@ -702,8 +702,10 @@ DefaultWindowBehaviour::ManageWindowState::EnterState(State* previousState)
// Update the mouse cursor
if ((fWindow->Flags() & B_NOT_MOVABLE) == 0)
fBehavior._SetMoveCursor();
else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
fBehavior._ResetCursor();
else
fBehavior._SetNowAllowedCursor();
fBehavior._SetNotAllowedCursor();

_UpdateResizeArrows(fLastMousePosition);
}
Expand All @@ -730,8 +732,10 @@ DefaultWindowBehaviour::ManageWindowState::MouseDown(BMessage* message,
if ((fWindow->Flags() & B_NOT_RESIZABLE) == 0) {
fBehavior._NextState(new (std::nothrow) ResizeBorderState(
fBehavior, where, fHorizontal, fVertical));
} else
fBehavior._SetNowAllowedCursor();
} else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
fBehavior._ResetCursor();
else
fBehavior._SetNotAllowedCursor();
}

return true;
Expand All @@ -745,11 +749,13 @@ DefaultWindowBehaviour::ManageWindowState::MouseMoved(BMessage* message,
// Update the mouse cursor
if ((fDesktop->WindowAt(where)->Flags() & B_NOT_RESIZABLE) != 0
&& (message->FindInt32("buttons") & B_SECONDARY_MOUSE_BUTTON) != 0) {
fBehavior._SetNowAllowedCursor();
fBehavior._SetNotAllowedCursor();
} else if ((fDesktop->WindowAt(where)->Flags() & B_NOT_MOVABLE) == 0)
fBehavior._SetMoveCursor();
else if ((fWindow->Flags() & kAcceptKeyboardFocusFlag) != 0)
fBehavior._ResetCursor();
else
fBehavior._SetNowAllowedCursor();
fBehavior._SetNotAllowedCursor();

// If the cursor is still over our window, update the borders.
// Otherwise leave the state.
Expand Down Expand Up @@ -1182,7 +1188,7 @@ DefaultWindowBehaviour::_SetMoveCursor()


void
DefaultWindowBehaviour::_SetNowAllowedCursor()
DefaultWindowBehaviour::_SetNotAllowedCursor()
{
fDesktop->SetManagementCursor(
fDesktop->GetCursorManager().GetCursor(B_CURSOR_ID_NOT_ALLOWED));
Expand Down
2 changes: 1 addition & 1 deletion src/servers/app/decorator/DefaultWindowBehaviour.h
Expand Up @@ -96,7 +96,7 @@ class DefaultWindowBehaviour : public WindowBehaviour {
int8 vertical);

void _SetMoveCursor();
void _SetNowAllowedCursor();
void _SetNotAllowedCursor();
void _SetResizeCursor(int8 horizontal,
int8 vertical);
void _SetBorderResizeCursor(BPoint where);
Expand Down

0 comments on commit ae883c5

Please sign in to comment.