diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 5 | ||||
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 14 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 7 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.cpp | 13 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.h | 16 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 10 |
6 files changed, 64 insertions, 1 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 720929ce945..ba46a868df6 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -59,6 +59,11 @@ typedef int (*GHOST_EventCallbackProcPtr)(GHOST_EventHandle event, GHOST_TUserDa extern GHOST_SystemHandle GHOST_CreateSystem(void); /** + * Specifies whether debug messages are to be enabled for the specific system handle. + */ +extern void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, int is_debug_enabled); + +/** * Disposes the one and only system. * \param systemhandle The handle to the system * \return An indication of success. diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index b781de266bc..4634eb1bc66 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -458,6 +458,20 @@ class GHOST_ISystem { const char * /*link*/, GHOST_DialogOptions /*dialog_options*/) const = 0; + /*************************************************************************************** + * Debugging + ***************************************************************************************/ + + /** + * Specify whether debug messages are to be shown. + */ + virtual void initDebug(bool is_debug_enabled) = 0; + + /** + * Check whether debug messages are to be shown. + */ + virtual bool isDebugEnabled() = 0; + protected: /** * Initialize the system. diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index eeb23ea7471..1bed7afdfc4 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -40,6 +40,13 @@ GHOST_SystemHandle GHOST_CreateSystem(void) return (GHOST_SystemHandle)system; } +void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, int is_debug_enabled) +{ + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + + system->initDebug(is_debug_enabled); +} + GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle) { GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp index 21935abed9c..fc9ce1f66e1 100644 --- a/intern/ghost/intern/GHOST_System.cpp +++ b/intern/ghost/intern/GHOST_System.cpp @@ -46,7 +46,8 @@ GHOST_System::GHOST_System() #ifdef WITH_INPUT_NDOF m_ndofManager(0), #endif - m_tabletAPI(GHOST_kTabletAutomatic) + m_tabletAPI(GHOST_kTabletAutomatic), + m_is_debug_enabled(false) { } @@ -388,3 +389,13 @@ void GHOST_System::useWindowFocus(const bool use_focus) { m_windowFocus = use_focus; } + +void GHOST_System::initDebug(bool is_debug_enabled) +{ + m_is_debug_enabled = is_debug_enabled; +} + +bool GHOST_System::isDebugEnabled() +{ + return m_is_debug_enabled; +} diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index 893592e3cf5..26b566e6b7e 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -328,6 +328,20 @@ class GHOST_System : public GHOST_ISystem { return GHOST_kFailure; }; + /*************************************************************************************** + * Debugging + ***************************************************************************************/ + + /** + * Specify whether debug messages are to be shown. + */ + virtual void initDebug(bool is_debug_enabled); + + /** + * Check whether debug messages are to be shown. + */ + virtual bool isDebugEnabled(); + protected: /** * Initialize the system. @@ -378,6 +392,8 @@ class GHOST_System : public GHOST_ISystem { /** Which tablet API to use. */ GHOST_TTabletAPI m_tabletAPI; + + bool m_is_debug_enabled; }; inline GHOST_TimerManager *GHOST_System::getTimerManager() const diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index cb2a04a8a87..72c0ad761a4 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -2383,6 +2383,11 @@ GHOST_TSuccess GHOST_SystemX11::pushDragDropEvent(GHOST_TEventType eventType, */ int GHOST_X11_ApplicationErrorHandler(Display *display, XErrorEvent *event) { + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + if (!system->isDebugEnabled()) { + return 0; + } + char error_code_str[512]; XGetErrorText(display, event->error_code, error_code_str, sizeof(error_code_str)); @@ -2404,6 +2409,11 @@ int GHOST_X11_ApplicationErrorHandler(Display *display, XErrorEvent *event) int GHOST_X11_ApplicationIOErrorHandler(Display * /*display*/) { + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + if (!system->isDebugEnabled()) { + return 0; + } + fprintf(stderr, "Ignoring Xlib error: error IO\n"); /* No exit! - but keep lint happy */ |