mirror of
https://github.com/brl/mutter.git
synced 2025-01-23 09:59:03 +00:00
debug: Add a macro for checking debug flags
This commit is contained in:
parent
459a6bb24c
commit
213bd1eab4
@ -8520,7 +8520,7 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
|
||||
ClutterActor *actor = CLUTTER_ACTOR (scriptable);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_SCRIPT))
|
||||
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (SCRIPT)))
|
||||
{
|
||||
gchar *tmp = g_strdup_value_contents (value);
|
||||
|
||||
|
@ -38,51 +38,53 @@ typedef enum {
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
|
||||
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||
{ g_message ("[" #type "] " G_STRLOC ": " x, ##a); } \
|
||||
} G_STMT_END
|
||||
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* Try the GCC extension for valists in macros */
|
||||
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
|
||||
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
|
||||
g_message ("[" #type "] " G_STRLOC ": " x, ##a); \
|
||||
} } G_STMT_END
|
||||
|
||||
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
|
||||
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
|
||||
g_message ("[" #type "]" " %li:" G_STRLOC ": " \
|
||||
x, clutter_get_timestamp(), ##a); \
|
||||
} } G_STMT_END
|
||||
|
||||
#else /* !__GNUC__ */
|
||||
|
||||
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
|
||||
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||
{ g_message ("[" #type "]" " %li:" G_STRLOC ": " \
|
||||
x, clutter_get_timestamp(), ##a); } \
|
||||
} G_STMT_END
|
||||
#else
|
||||
/* Try the C99 version; unfortunately, this does not allow us to pass
|
||||
* empty arguments to the macro, which means we have to
|
||||
* do an intemediate printf.
|
||||
*/
|
||||
#define CLUTTER_NOTE(type,...) G_STMT_START { \
|
||||
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||
{ \
|
||||
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
||||
g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \
|
||||
g_free (_fmt); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
#define CLUTTER_NOTE(type,...) G_STMT_START { \
|
||||
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
|
||||
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
||||
g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \
|
||||
g_free (_fmt); } } G_STMT_END
|
||||
|
||||
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \
|
||||
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||
{ \
|
||||
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
||||
g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \
|
||||
clutter_get_timestamp(), _fmt); \
|
||||
g_free (_fmt); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
#endif
|
||||
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \
|
||||
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
|
||||
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
||||
g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \
|
||||
clutter_get_timestamp(), _fmt); \
|
||||
g_free (_fmt); \
|
||||
} } G_STMT_END
|
||||
|
||||
#define CLUTTER_MARK() CLUTTER_NOTE(MISC, "== mark ==")
|
||||
#define CLUTTER_DBG(x) { a }
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define CLUTTER_MARK() CLUTTER_NOTE(MISC, "== mark ==")
|
||||
#define CLUTTER_DBG(x) { a }
|
||||
|
||||
#define CLUTTER_GLERR() G_STMT_START { \
|
||||
if (clutter_debug_flags & CLUTTER_DEBUG_GL) \
|
||||
{ GLenum _err = glGetError (); /* roundtrip */ \
|
||||
if (_err != GL_NO_ERROR) \
|
||||
g_warning (G_STRLOC ": GL Error %x", _err); \
|
||||
} } G_STMT_END
|
||||
if (clutter_debug_flags & CLUTTER_DEBUG_GL) { \
|
||||
GLenum _err = glGetError (); /* roundtrip */ \
|
||||
if (_err != GL_NO_ERROR) \
|
||||
g_warning (G_STRLOC ": GL Error %x", _err); \
|
||||
} } G_STMT_END
|
||||
|
||||
|
||||
#else /* !CLUTTER_ENABLE_DEBUG */
|
||||
@ -92,6 +94,7 @@ typedef enum {
|
||||
#define CLUTTER_DBG(x) G_STMT_START { } G_STMT_END
|
||||
#define CLUTTER_GLERR() G_STMT_START { } G_STMT_END
|
||||
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { } G_STMT_END
|
||||
#define CLUTTER_HAS_DEBUG(type) FALSE
|
||||
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
|
@ -612,7 +612,7 @@ _clutter_do_pick (ClutterStage *stage,
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
||||
|
||||
if (clutter_debug_flags & CLUTTER_DEBUG_NOP_PICKING)
|
||||
if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_NOP_PICKING))
|
||||
return CLUTTER_ACTOR (stage);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_PROFILE
|
||||
|
Loading…
x
Reference in New Issue
Block a user