Extended input method protocol a bit: you can now set "be:inline_only" to true, which
means that no bottomline window will be opened in case the current view is not input method aware. Instead, only the confirmed B_INPUT_METHOD_CHANGE event will be translated to a message the view will understand - this message must be part of the event in the "be:translated" member. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3956f772e1
commit
b735e46de3
@ -1541,28 +1541,43 @@ InputServer::_MethodizeEvents(EventList& events)
|
||||
|
||||
int32 opcode;
|
||||
if (event->FindInt32("be:opcode", &opcode) == B_OK) {
|
||||
if (fInputMethodWindow == NULL
|
||||
&& opcode == B_INPUT_METHOD_STARTED)
|
||||
fInputMethodWindow = new (nothrow) BottomlineWindow();
|
||||
bool inlineOnly;
|
||||
if (event->FindBool("be:inline_only", &inlineOnly) != B_OK)
|
||||
inlineOnly = false;
|
||||
|
||||
if (fInputMethodWindow != NULL) {
|
||||
EventList newEvents;
|
||||
fInputMethodWindow->HandleInputMethodEvent(event, newEvents);
|
||||
|
||||
// replace event with new events (but don't scan them again
|
||||
// for input method messages)
|
||||
events.RemoveItemAt(i--);
|
||||
delete event;
|
||||
newCount--;
|
||||
|
||||
if (!newEvents.IsEmpty()) {
|
||||
events.AddList(&newEvents);
|
||||
opcode = B_INPUT_METHOD_STOPPED;
|
||||
if (inlineOnly) {
|
||||
BMessage translated;
|
||||
bool confirmed;
|
||||
if (opcode == B_INPUT_METHOD_CHANGED
|
||||
&& event->FindBool("be:confirmed", &confirmed) == B_OK && confirmed
|
||||
&& event->FindMessage("be:translated", &translated) == B_OK) {
|
||||
// translate event for the non-aware view
|
||||
*event = translated;
|
||||
}
|
||||
} else {
|
||||
if (fInputMethodWindow == NULL
|
||||
&& opcode == B_INPUT_METHOD_STARTED)
|
||||
fInputMethodWindow = new (nothrow) BottomlineWindow();
|
||||
|
||||
if (opcode == B_INPUT_METHOD_STOPPED) {
|
||||
fInputMethodWindow->PostMessage(B_QUIT_REQUESTED);
|
||||
fInputMethodWindow = NULL;
|
||||
if (fInputMethodWindow != NULL) {
|
||||
EventList newEvents;
|
||||
fInputMethodWindow->HandleInputMethodEvent(event, newEvents);
|
||||
|
||||
// replace event with new events (but don't scan them again
|
||||
// for input method messages)
|
||||
events.RemoveItemAt(i--);
|
||||
delete event;
|
||||
newCount--;
|
||||
|
||||
if (!newEvents.IsEmpty()) {
|
||||
events.AddList(&newEvents);
|
||||
opcode = B_INPUT_METHOD_STOPPED;
|
||||
}
|
||||
|
||||
if (opcode == B_INPUT_METHOD_STOPPED) {
|
||||
fInputMethodWindow->PostMessage(B_QUIT_REQUESTED);
|
||||
fInputMethodWindow = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user