Fix window behavior when default button is present
* Don't intercept Enter key press in a window when there is default button and another BControl focused. * Current behavior was basically breaking every window using default button. Even if there was a button focused (using Tab key), when Enter was hit, default button handled the message, therefore instead of i.e. 'Revert' 'Apply' was pressed. * Fixes #10792. Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
This commit is contained in:
parent
c0b833b10a
commit
273109e004
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2011, Haiku.
|
||||
* Copyright 2001-2014, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -3287,9 +3287,11 @@ BWindow::_DetermineTarget(BMessage* message, BHandler* target)
|
||||
case B_KEY_UP:
|
||||
{
|
||||
// if we have a default button, it might want to hear
|
||||
// about pressing the <enter> key
|
||||
// about pressing the <enter> key, but it shouldn't
|
||||
// intercept it if another BControl is focused
|
||||
int32 rawChar;
|
||||
if (DefaultButton() != NULL
|
||||
&& dynamic_cast<BControl*>(CurrentFocus()) == NULL
|
||||
&& message->FindInt32("raw_char", &rawChar) == B_OK
|
||||
&& rawChar == B_ENTER)
|
||||
return DefaultButton();
|
||||
|
Loading…
Reference in New Issue
Block a user