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:
Axel Dörfler 2006-10-25 10:45:45 +00:00
parent 3956f772e1
commit b735e46de3

View File

@ -1541,28 +1541,43 @@ InputServer::_MethodizeEvents(EventList& events)
int32 opcode; int32 opcode;
if (event->FindInt32("be:opcode", &opcode) == B_OK) { if (event->FindInt32("be:opcode", &opcode) == B_OK) {
if (fInputMethodWindow == NULL bool inlineOnly;
&& opcode == B_INPUT_METHOD_STARTED) if (event->FindBool("be:inline_only", &inlineOnly) != B_OK)
fInputMethodWindow = new (nothrow) BottomlineWindow(); inlineOnly = false;
if (fInputMethodWindow != NULL) { if (inlineOnly) {
EventList newEvents; BMessage translated;
fInputMethodWindow->HandleInputMethodEvent(event, newEvents); bool confirmed;
if (opcode == B_INPUT_METHOD_CHANGED
// replace event with new events (but don't scan them again && event->FindBool("be:confirmed", &confirmed) == B_OK && confirmed
// for input method messages) && event->FindMessage("be:translated", &translated) == B_OK) {
events.RemoveItemAt(i--); // translate event for the non-aware view
delete event; *event = translated;
newCount--;
if (!newEvents.IsEmpty()) {
events.AddList(&newEvents);
opcode = B_INPUT_METHOD_STOPPED;
} }
} else {
if (fInputMethodWindow == NULL
&& opcode == B_INPUT_METHOD_STARTED)
fInputMethodWindow = new (nothrow) BottomlineWindow();
if (opcode == B_INPUT_METHOD_STOPPED) { if (fInputMethodWindow != NULL) {
fInputMethodWindow->PostMessage(B_QUIT_REQUESTED); EventList newEvents;
fInputMethodWindow = NULL; 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;
}
} }
} }
} }