Fix 2 shortcut bugs, one in Web+, one in S&T

It's really 2 instances of the same bug, we only want to consider a
fixed set of modifier keys ignoring the lock keys and left/right keys.
This commit is contained in:
John Scipione
2014-02-14 18:51:13 -05:00
parent 480a333cff
commit ceafe5b48a
2 changed files with 9 additions and 2 deletions
+5 -1
View File
@@ -124,6 +124,10 @@ enum {
};
static const int32 kModifiers = B_SHIFT_KEY | B_COMMAND_KEY
| B_CONTROL_KEY | B_OPTION_KEY | B_MENU_KEY;
static BLayoutItem*
layoutItemFor(BView* view)
{
@@ -650,7 +654,7 @@ BrowserWindow::DispatchMessage(BMessage* message, BHandler* target)
if ((message->what == B_KEY_DOWN || message->what == B_UNMAPPED_KEY_DOWN)
&& message->FindString("bytes", &bytes) == B_OK
&& message->FindInt32("modifiers", &modifierKeys) == B_OK) {
modifierKeys = (int32)((uint32)modifierKeys & 0x000000ff);
modifierKeys = (int32)((uint32)modifierKeys & kModifiers);
BTextView* textView = dynamic_cast<BTextView*>(CurrentFocus());
if (bytes[0] == B_LEFT_ARROW && modifierKeys == B_COMMAND_KEY) {
if (textView != NULL)
@@ -29,6 +29,9 @@ static const int32 kUpArrowKey = 0x57;
static const int32 kRightArrowKey = 0x63;
static const int32 kDownArrowKey = 0x62;
static const int32 kModifiers = B_SHIFT_KEY | B_COMMAND_KEY
| B_CONTROL_KEY | B_OPTION_KEY | B_MENU_KEY;
using namespace std;
@@ -135,7 +138,7 @@ StackAndTile::KeyPressed(uint32 what, int32 key, int32 modifiers)
// switch to and from stacking and snapping mode
bool wasPressed = fSATKeyPressed;
fSATKeyPressed = (what == B_MODIFIERS_CHANGED
&& (modifiers & 0xff) == B_OPTION_KEY)
&& (modifiers & kModifiers) == B_OPTION_KEY)
|| (what == B_UNMAPPED_KEY_DOWN && key == kRightOptionKey);
if (wasPressed && !fSATKeyPressed)
_StopSAT();