Work based on a patch by Joshua R. Elsasser:
* Some key-sequences cause \0 chars in the "bytes" data which is supposed to be passed to BView::KeyDown() and BView::KeyUp(). Therefor, one cannot use string methods for adding/extracting the data to/from the events. For example, Control-Space now works in the Terminal. Thanks a lot for the original patch, Joshua! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33338 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2004-2006, Jérôme Duval. All rights reserved.
|
||||
* Copyright 2005-2008, Axel Dörfler, [email protected].
|
||||
* Copyright 2008, Stephan Aßmus, [email protected].
|
||||
* Copyright 2008-2009, Stephan Aßmus, [email protected].
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@@ -43,17 +43,17 @@
|
||||
fFunctionDepth++;
|
||||
fPrepend.Append(' ', fFunctionDepth * 2);
|
||||
fFunctionName << className << "::" << functionName << "()";
|
||||
|
||||
|
||||
debug_printf("%p -> %s%s {\n", fPointer, fPrepend.String(),
|
||||
fFunctionName.String());
|
||||
}
|
||||
|
||||
|
||||
~FunctionTracer()
|
||||
{
|
||||
debug_printf("%p -> %s}\n", fPointer, fPrepend.String());
|
||||
fFunctionDepth--;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
BString fFunctionName;
|
||||
BString fPrepend;
|
||||
@@ -733,10 +733,9 @@ KeyboardDevice::_ControlThread()
|
||||
msg->AddInt32("modifiers", fModifiers);
|
||||
msg->AddData("states", B_UINT8_TYPE, states, 16);
|
||||
if (numBytes > 0) {
|
||||
for (int i = 0; i < numBytes; i++) {
|
||||
for (int i = 0; i < numBytes; i++)
|
||||
msg->AddInt8("byte", (int8)string[i]);
|
||||
}
|
||||
msg->AddString("bytes", string);
|
||||
msg->AddData("bytes", B_STRING_TYPE, string, numBytes);
|
||||
|
||||
if (rawNumBytes <= 0) {
|
||||
rawNumBytes = 1;
|
||||
|
||||
@@ -1114,8 +1114,11 @@ FrameMoved(origin);
|
||||
// different font encoding per view (it's supposed to be
|
||||
// converted by _HandleKeyDown() one day)
|
||||
const char* string;
|
||||
if (msg->FindString("bytes", &string) == B_OK)
|
||||
view->KeyDown(string, strlen(string));
|
||||
ssize_t bytes;
|
||||
if (msg->FindData("bytes", B_STRING_TYPE,
|
||||
(const void**)&string, &bytes) == B_OK) {
|
||||
view->KeyDown(string, bytes);
|
||||
}
|
||||
} else
|
||||
target->MessageReceived(msg);
|
||||
}
|
||||
@@ -1124,13 +1127,15 @@ FrameMoved(origin);
|
||||
|
||||
case B_KEY_UP:
|
||||
{
|
||||
const char* string = NULL;
|
||||
msg->FindString("bytes", &string);
|
||||
|
||||
// TODO: same as above
|
||||
if (BView* view = dynamic_cast<BView*>(target))
|
||||
view->KeyUp(string, strlen(string));
|
||||
else
|
||||
if (BView* view = dynamic_cast<BView*>(target)) {
|
||||
const char* string;
|
||||
ssize_t bytes;
|
||||
if (msg->FindData("bytes", B_STRING_TYPE,
|
||||
(const void**)&string, &bytes) == B_OK) {
|
||||
view->KeyUp(string, bytes);
|
||||
}
|
||||
} else
|
||||
target->MessageReceived(msg);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user