also copy modifiers and state in SanitizeEvents as we need them there

change MethodizeEvents to actually handle the method queue


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16347 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-02-11 15:11:28 +00:00
parent 7d0b5dc160
commit 36077365d1
+31 -9
View File
@@ -1445,6 +1445,25 @@ InputServer::_SanitizeEvents(EventList& events)
} }
case B_KEY_DOWN: case B_KEY_DOWN:
case B_UNMAPPED_KEY_DOWN: case B_UNMAPPED_KEY_DOWN:
// update or add modifiers
uint32 modifiers;
if (event->FindInt32("modifiers", (int32*)&modifiers) == B_OK)
fKeyInfo.modifiers = modifiers;
else
event->AddInt32("modifiers", fKeyInfo.modifiers);
// update or add key states
const uint8 *data;
ssize_t size;
if (event->FindData("states", B_UINT8_TYPE,
(const void**)&data, &size) == B_OK) {
PRINT(("updated keyinfo\n"));
if (size == sizeof(fKeyInfo.key_states))
memcpy(fKeyInfo.key_states, data, size);
} else {
event->AddData("states", B_UINT8_TYPE, fKeyInfo.key_states,
sizeof(fKeyInfo.key_states));
}
if (fActiveMethod == NULL) if (fActiveMethod == NULL)
break; break;
@@ -1493,9 +1512,19 @@ InputServer::_MethodizeEvents(EventList& events)
_FilterEvent(fActiveMethod, events, i, count); _FilterEvent(fActiveMethod, events, i, count);
} }
{
// move the method events into the event queue - they are not
// "methodized" either
BAutolock _(fEventQueueLock);
events.AddList(&fMethodQueue);
fMethodQueue.MakeEmpty();
}
int32 newCount = events.CountItems();
if (!fInputMethodAware) { if (!fInputMethodAware) {
// special handling for non-input-method-aware views // special handling for non-input-method-aware views
for (int32 i = 0; i < count; i++) { for (int32 i = count; i < newCount; i++) {
BMessage* event = events.ItemAt(i); BMessage* event = events.ItemAt(i);
if (event->what != B_INPUT_METHOD_EVENT) if (event->what != B_INPUT_METHOD_EVENT)
@@ -1530,18 +1559,12 @@ InputServer::_MethodizeEvents(EventList& events)
events.AddList(&newEvents, i); events.AddList(&newEvents, i);
i += newEvents.CountItems() - 1; i += newEvents.CountItems() - 1;
count = events.CountItems(); newCount = events.CountItems();
} }
} }
} }
} }
// move the method events into the event queue - they are not
// "methodized" either
BAutolock _(fEventQueueLock);
events.AddList(&fMethodQueue);
fMethodQueue.MakeEmpty();
return events.CountItems() > 0; return events.CountItems() > 0;
} }
@@ -1678,7 +1701,6 @@ InputServer::_DispatchEvent(BMessage* event)
sizeof(fKeyInfo.key_states)); sizeof(fKeyInfo.key_states));
} }
PRINT(("keyinfo %ld %ld\n", size, (ssize_t)sizeof(fKeyInfo.key_states)));
break; break;
} }