minor changes to ghost

- use WITH_ASSERT_ABORT define, so GHOST_ASSERT will abort.
- rename XTablet -> GHOST_TabletX11, was confusing since it was named like an xlib struct.
This commit is contained in:
Campbell Barton 2013-01-16 01:10:06 +00:00
parent 761ac89877
commit f2cfe4b2e9
3 changed files with 22 additions and 9 deletions

@ -58,12 +58,23 @@
# define GHOST_PRINTF(x, ...) # define GHOST_PRINTF(x, ...)
#endif // GHOST_DEBUG #endif // GHOST_DEBUG
#ifdef WITH_ASSERT_ABORT
#ifdef GHOST_DEBUG # include <stdio.h> //for fprintf()
# include <stdlib.h> //for abort()
# define GHOST_ASSERT(x, info) \
{ \
if (!(x)) { \
fprintf(stderr, "GHOST_ASSERT failed: "); \
fprintf(stderr, info); \
fprintf(stderr, "\n"); \
abort(); \
} \
} (void)0
#elif defined(GHOST_DEBUG)
# define GHOST_ASSERT(x, info) \ # define GHOST_ASSERT(x, info) \
{ \ { \
if (!(x)) { \ if (!(x)) { \
GHOST_PRINT("assertion failed: "); \ GHOST_PRINT("GHOST_ASSERT failed: "); \
GHOST_PRINT(info); \ GHOST_PRINT(info); \
GHOST_PRINT("\n"); \ GHOST_PRINT("\n"); \
} \ } \

@ -196,9 +196,8 @@ public:
getXWindow( getXWindow(
); );
#ifdef WITH_X11_XINPUT #ifdef WITH_X11_XINPUT
class XTablet typedef struct GHOST_TabletX11
{ {
public:
GHOST_TabletData CommonData; GHOST_TabletData CommonData;
XDevice *StylusDevice; XDevice *StylusDevice;
@ -212,9 +211,9 @@ public:
int PressureLevels; int PressureLevels;
int XtiltLevels, YtiltLevels; int XtiltLevels, YtiltLevels;
}; } GHOST_TabletX11;
XTablet& GetXTablet() GHOST_TabletX11 &GetXTablet()
{ {
return m_xtablet; return m_xtablet;
} }
@ -388,7 +387,7 @@ private:
#ifdef WITH_X11_XINPUT #ifdef WITH_X11_XINPUT
/* Tablet devices */ /* Tablet devices */
XTablet m_xtablet; GHOST_TabletX11 m_xtablet;
#endif #endif
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)

@ -2756,7 +2756,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* initialize and copy state (only mouse x y and modifiers) */ /* initialize and copy state (only mouse x y and modifiers) */
event = *evt; event = *evt;
switch (type) { switch (type) {
/* mouse move, also to inactive window (X11 does this) */ /* mouse move, also to inactive window (X11 does this) */
case GHOST_kEventCursorMove: case GHOST_kEventCursorMove:
@ -3100,4 +3100,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
} }
#if 0
WM_event_print(&event);
#endif
} }