diff --git a/src/add-ons/input_server/devices/virtualkeyboard/Jamfile b/src/add-ons/input_server/devices/virtualkeyboard/Jamfile
index ed18600d34..9cb16eafbe 100644
--- a/src/add-ons/input_server/devices/virtualkeyboard/Jamfile
+++ b/src/add-ons/input_server/devices/virtualkeyboard/Jamfile
@@ -6,6 +6,7 @@ UsePrivateSystemHeaders ;
AddResources virtualkeyboard : VirtualKeyboard.rdef ;
Addon virtualkeyboard :
+
KeyboardLayout.cpp
KeyboardLayoutView.cpp
Keymap.cpp
diff --git a/src/add-ons/input_server/devices/virtualkeyboard/KeyboardLayoutView.cpp b/src/add-ons/input_server/devices/virtualkeyboard/KeyboardLayoutView.cpp
index 732b40454d..36bb32c6a3 100644
--- a/src/add-ons/input_server/devices/virtualkeyboard/KeyboardLayoutView.cpp
+++ b/src/add-ons/input_server/devices/virtualkeyboard/KeyboardLayoutView.cpp
@@ -6,8 +6,11 @@
#include "KeyboardLayoutView.h"
+#include
+#include
#include
#include
+#include
#include
#include
@@ -26,6 +29,69 @@ static const rgb_color kDeadKeyColor = {152, 203, 255, 255};
static const rgb_color kLitIndicatorColor = {116, 212, 83, 255};
+#undef TRACE
+
+//#define TRACE_KEYBOARD_DEVICE
+#ifdef TRACE_KEYBOARD_DEVICE
+
+static int32 sFunctionDepth = -1;
+
+class FunctionTracer {
+public:
+ FunctionTracer(const void* pointer, const char* className,
+ const char* functionName)
+ :
+ fFunctionName(),
+ fPrepend(),
+ fPointer(pointer)
+ {
+ sFunctionDepth++;
+ fPrepend.Append(' ', sFunctionDepth * 2);
+ fFunctionName << className << "::" << functionName << "()";
+
+ debug_printf("%p -> %s%s {\n", fPointer, fPrepend.String(),
+ fFunctionName.String());
+ }
+
+ ~FunctionTracer()
+ {
+ debug_printf("%p -> %s}\n", fPointer, fPrepend.String());
+ sFunctionDepth--;
+ }
+
+ static int32 Depth() { return sFunctionDepth; }
+
+private:
+ BString fFunctionName;
+ BString fPrepend;
+ const void* fPointer;
+};
+
+# define KD_CALLED(x...) \
+ FunctionTracer _ft(this, "LayoutView", __FUNCTION__)
+# define KID_CALLED(x...) \
+ FunctionTracer _ft(this, "LayoutView", __FUNCTION__)
+# define TRACE(x...) \
+ do { BString _to; \
+ _to.Append(' ', (FunctionTracer::Depth() + 1) * 2); \
+ debug_printf("%p -> %s", this, _to.String()); \
+ debug_printf(x); } while (0)
+# define LOG_EVENT(text...) debug_printf(text)
+# define LOG_ERR(text...) TRACE(text)
+#else
+# define TRACE(x...) do {} while (0)
+# define KD_CALLED(x...) TRACE(x)
+# define KID_CALLED(x...) TRACE(x)
+# define LOG_ERR(text...) debug_printf(text)
+# define LOG_EVENT(text...) TRACE(x)
+#endif
+
+
+
+
+
+
+
KeyboardLayoutView::KeyboardLayoutView(const char* name,
BInputServerDevice* dev)
:
@@ -1077,12 +1143,15 @@ KeyboardLayoutView::_EvaluateDropTarget(BPoint point)
void
KeyboardLayoutView::_SendKeyDown(const Key* key)
{
+ KID_CALLED();
+
BMessage* message = new BMessage(B_KEY_DOWN);
message->AddInt64("when", system_time());
message->AddData("states", B_UINT8_TYPE, &fKeyState,
sizeof(fKeyState));
message->AddInt32("key", key->code);
message->AddInt32("modifiers", fModifiers);
+ message->AddInt32("be:key_repeat", 1);
//message.AddPointer("keymap", fKeymap);
char* string;
@@ -1101,6 +1170,6 @@ KeyboardLayoutView::_SendKeyDown(const Key* key)
delete[] string;
}
- if (fDevice->EnqueueMessage(message) == B_OK)
+ if (fDevice->EnqueueMessage(message) != B_OK)
delete message;
}