diff --git a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp index abc9f53a32..41cb3430e2 100644 --- a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp +++ b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp @@ -1,7 +1,7 @@ /* * Copyright 2004-2006, Jérôme Duval. All rights reserved. * Copyright 2005-2008, Axel Dörfler, axeld@pinc-software.de. - * Copyright 2008, Stephan Aßmus, superstippi@gmx.de. + * Copyright 2008-2009, Stephan Aßmus, superstippi@gmx.de. * * 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; diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index e464fb252f..721efee296 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -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(target)) - view->KeyUp(string, strlen(string)); - else + if (BView* view = dynamic_cast(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; }