* Cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34111 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-11-18 12:38:59 +00:00
parent 842aad23f9
commit bac2cf0b57
@@ -1,6 +1,6 @@
/* /*
* Copyright 2004-2006, Jérôme Duval. All rights reserved. * Copyright 2004-2006, Jérôme Duval. All rights reserved.
* Copyright 2005-2008, Axel Dörfler, [email protected]. * Copyright 2005-2009, Axel Dörfler, [email protected].
* Copyright 2008-2009, Stephan Aßmus, [email protected]. * Copyright 2008-2009, Stephan Aßmus, [email protected].
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@@ -27,50 +27,52 @@
#undef TRACE #undef TRACE
//#define TRACE_KEYBOARD_DEVICE //#define TRACE_KEYBOARD_DEVICE
#ifdef TRACE_KEYBOARD_DEVICE #ifdef TRACE_KEYBOARD_DEVICE
class FunctionTracer { class FunctionTracer {
public: public:
FunctionTracer(const void* pointer, const char* className, FunctionTracer(const void* pointer, const char* className,
const char* functionName, const char* functionName)
int32& depth) :
: fFunctionName(), fFunctionName(),
fPrepend(), fPrepend(),
fFunctionDepth(depth), fPointer(pointer)
fPointer(pointer) {
{ sFunctionDepth++;
fFunctionDepth++; fPrepend.Append(' ', sFunctionDepth * 2);
fPrepend.Append(' ', fFunctionDepth * 2); fFunctionName << className << "::" << functionName << "()";
fFunctionName << className << "::" << functionName << "()";
debug_printf("%p -> %s%s {\n", fPointer, fPrepend.String(), debug_printf("%p -> %s%s {\n", fPointer, fPrepend.String(),
fFunctionName.String()); fFunctionName.String());
} }
~FunctionTracer() ~FunctionTracer()
{ {
debug_printf("%p -> %s}\n", fPointer, fPrepend.String()); debug_printf("%p -> %s}\n", fPointer, fPrepend.String());
fFunctionDepth--; sFunctionDepth--;
} }
private: static int32 Depth() const { return sFunctionDepth; }
BString fFunctionName;
BString fPrepend;
int32& fFunctionDepth;
const void* fPointer;
};
private:
BString fFunctionName;
BString fPrepend;
const void* fPointer;
static int32 sFunctionDepth = -1; static int32 sFunctionDepth = -1;
# define KD_CALLED(x...) FunctionTracer _ft(this, "KeyboardDevice", \ };
__FUNCTION__, sFunctionDepth)
# define KID_CALLED(x...) FunctionTracer _ft(this, "KeyboardInputDevice", \ # define KD_CALLED(x...) \
__FUNCTION__, sFunctionDepth) FunctionTracer _ft(this, "KeyboardDevice", __FUNCTION__)
# define TRACE(x...) do { BString _to; \ # define KID_CALLED(x...) \
_to.Append(' ', (sFunctionDepth + 1) * 2); \ FunctionTracer _ft(this, "KeyboardInputDevice", __FUNCTION__)
debug_printf("%p -> %s", this, _to.String()); \ # define TRACE(x...) \
debug_printf(x); } while (0) 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...) do {} while (0) # define LOG_EVENT(text...) do {} while (0)
# define LOG_ERR(text...) TRACE(text) # define LOG_ERR(text...) TRACE(text)
#else #else
@@ -713,7 +715,8 @@ KeyboardDevice::_ControlThread()
char* string = NULL; char* string = NULL;
char* rawString = NULL; char* rawString = NULL;
int32 numBytes = 0, rawNumBytes = 0; int32 numBytes = 0, rawNumBytes = 0;
fKeymap.GetChars(keycode, fModifiers, activeDeadKey, &string, &numBytes); fKeymap.GetChars(keycode, fModifiers, activeDeadKey, &string,
&numBytes);
fKeymap.GetChars(keycode, 0, 0, &rawString, &rawNumBytes); fKeymap.GetChars(keycode, 0, 0, &rawString, &rawNumBytes);
BMessage* msg = new BMessage; BMessage* msg = new BMessage;
@@ -1085,12 +1088,3 @@ KeyboardInputDevice::_RecursiveScan(const char* directory)
_AddDevice(path.Path()); _AddDevice(path.Path());
} }
} }