Fixed EnqueueMethodMessage() so that Eventloop port is released

WatchPort process adapted to this behavior :
we go through message processing without messages. in fact method messages musn't be processed as device messages.
Even if buggy, Canna method is now working with StyledEdit (with Input Method aware views typically).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10712 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2005-01-13 13:13:14 +00:00
parent 0bfacfc2a9
commit b1c75e39b3
+30 -18
View File
@@ -957,6 +957,8 @@ InputServer::EnqueueMethodMessage(BMessage *message)
fMethodQueue.AddItem(message);
write_port_etc(fEventLooperPort, 0, NULL, 0, B_RELATIVE_TIMEOUT, 0);
UnlockMethodQueue();
return B_OK;
@@ -1479,6 +1481,9 @@ InputServer::MethodizeEvents(BList *events,
if (fActiveMethod) {
BList newList;
newList.AddList(&fMethodQueue);
fMethodQueue.MakeEmpty();
for (int32 i=0; i<events->CountItems(); i++) {
BMessage *item = (BMessage *)events->ItemAt(i);
BList filterList;
@@ -1717,33 +1722,40 @@ InputServer::WatchPort()
}
continue;
}
if (length == 0) {
BList list;
DispatchEvents(&list);
continue;
}
BMessage *event = new BMessage;
if ((err = event->Unflatten(buffer)) < 0) {
PRINTERR(("[InputServer] Unflatten() error: (0x%lx) %s\n", err, strerror(err)));
delete event;
} else {
// This is where the message should be processed.
continue;
}
// This is where the message should be processed.
// here we test for a message coming from app_server, screen resolution change could have happened
if (event->what == FAST_MOUSE_MOVED) {
BRect frame = fScreen.Frame();
if (frame != fFrame) {
fMousePos.x = fMousePos.x * frame.Width() / fFrame.Width();
fMousePos.y = fMousePos.y * frame.Height() / fFrame.Height();
fFrame = frame;
}
// here we test for a message coming from app_server, screen resolution change could have happened
if (event->what == FAST_MOUSE_MOVED) {
BRect frame = fScreen.Frame();
if (frame != fFrame) {
fMousePos.x = fMousePos.x * frame.Width() / fFrame.Width();
fMousePos.y = fMousePos.y * frame.Height() / fFrame.Height();
fFrame = frame;
}
HandleSetMousePosition(event, event);
BList list;
list.AddItem(event);
DispatchEvents(&list);
PRINT(("Event written to port\n"));
}
HandleSetMousePosition(event, event);
BList list;
list.AddItem(event);
DispatchEvents(&list);
PRINT(("Event written to port\n"));
}
}