* Don't eat alt+space if there is only one input method available (the shortcut is meant to switch input methods)
Makes it useable in applications and less confusing. Fixes #6468. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42521 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1016,12 +1016,17 @@ InputServer::SetNextMethod(bool direction)
|
||||
gInputMethodListLocker.Lock();
|
||||
|
||||
int32 index = gInputMethodList.IndexOf(fActiveMethod);
|
||||
int32 oldIndex = index;
|
||||
|
||||
index += (direction ? 1 : -1);
|
||||
|
||||
if (index < -1)
|
||||
index = gInputMethodList.CountItems() - 1;
|
||||
if (index >= gInputMethodList.CountItems())
|
||||
index = -1;
|
||||
|
||||
if (index == oldIndex)
|
||||
return B_BAD_INDEX;
|
||||
|
||||
BInputServerMethod *method = &gKeymapMethod;
|
||||
|
||||
@@ -1460,6 +1465,9 @@ InputServer::_UpdateMouseAndKeys(EventList& events)
|
||||
// we scan for Alt+Space key down events which means we change
|
||||
// to next input method
|
||||
// (pressing "shift" will let us switch to the previous method)
|
||||
|
||||
// If there is only one input method, SetNextMethod will return
|
||||
// B_BAD_INDEX and the event will be forwarded to the user.
|
||||
|
||||
PRINT(("SanitizeEvents: %lx, %x\n", fKeyInfo.modifiers,
|
||||
fKeyInfo.key_states[KEY_Spacebar >> 3]));
|
||||
@@ -1470,12 +1478,13 @@ InputServer::_UpdateMouseAndKeys(EventList& events)
|
||||
|
||||
if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ')
|
||||
|| byte == B_HANKAKU_ZENKAKU) {
|
||||
SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY));
|
||||
|
||||
// this event isn't sent to the user
|
||||
events.RemoveItemAt(index);
|
||||
delete event;
|
||||
continue;
|
||||
if (SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)) == B_OK)
|
||||
{
|
||||
// this event isn't sent to the user
|
||||
events.RemoveItemAt(index);
|
||||
delete event;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user