forked from bartvdbraak/blender
GHOST: add back-trace handler to the API
Add a back-trace handler to GHOST, so error handlers can include a back-trace (when supported). No functional changes.
This commit is contained in:
parent
eb9fa052a1
commit
2601b9832d
@ -906,6 +906,11 @@ extern int GHOST_UseNativePixels(void);
|
||||
*/
|
||||
extern int GHOST_SupportsCursorWarp(void);
|
||||
|
||||
/**
|
||||
* Assign the callback which generates a back-trace (may be NULL).
|
||||
*/
|
||||
extern void GHOST_SetBacktraceHandler(GHOST_TBacktraceFn backtrace_fn);
|
||||
|
||||
/**
|
||||
* Focus window after opening, or put them in the background.
|
||||
*/
|
||||
|
@ -133,6 +133,9 @@ class GHOST_ISystem {
|
||||
*/
|
||||
static GHOST_ISystem *getSystem();
|
||||
|
||||
static GHOST_TBacktraceFn getBacktraceFn();
|
||||
static void setBacktraceFn(GHOST_TBacktraceFn backtrace_fn);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Constructor.
|
||||
@ -482,6 +485,9 @@ class GHOST_ISystem {
|
||||
/** The one and only system */
|
||||
static GHOST_ISystem *m_system;
|
||||
|
||||
/** Function to call that sets the back-trace. */
|
||||
static GHOST_TBacktraceFn m_backtrace_fn;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_ISystem")
|
||||
#endif
|
||||
|
@ -42,6 +42,8 @@ GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
|
||||
GHOST_DECLARE_HANDLE(GHOST_ContextHandle);
|
||||
GHOST_DECLARE_HANDLE(GHOST_XrContextHandle);
|
||||
|
||||
typedef void (*GHOST_TBacktraceFn)(void *file_handle);
|
||||
|
||||
typedef struct {
|
||||
int flags;
|
||||
} GHOST_GLSettings;
|
||||
|
@ -835,6 +835,11 @@ int GHOST_SupportsCursorWarp(void)
|
||||
return system->supportsCursorWarp();
|
||||
}
|
||||
|
||||
void GHOST_SetBacktraceHandler(GHOST_TBacktraceFn backtrace_fn)
|
||||
{
|
||||
GHOST_ISystem::setBacktraceFn(backtrace_fn);
|
||||
}
|
||||
|
||||
void GHOST_UseWindowFocus(int use_focus)
|
||||
{
|
||||
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
GHOST_ISystem *GHOST_ISystem::m_system = nullptr;
|
||||
|
||||
GHOST_TBacktraceFn GHOST_ISystem::m_backtrace_fn = nullptr;
|
||||
|
||||
GHOST_TSuccess GHOST_ISystem::createSystem()
|
||||
{
|
||||
GHOST_TSuccess success;
|
||||
@ -89,3 +91,13 @@ GHOST_ISystem *GHOST_ISystem::getSystem()
|
||||
{
|
||||
return m_system;
|
||||
}
|
||||
|
||||
GHOST_TBacktraceFn GHOST_ISystem::getBacktraceFn()
|
||||
{
|
||||
return GHOST_ISystem::m_backtrace_fn;
|
||||
}
|
||||
|
||||
void GHOST_ISystem::setBacktraceFn(GHOST_TBacktraceFn backtrace_fn)
|
||||
{
|
||||
GHOST_ISystem::m_backtrace_fn = backtrace_fn;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_system.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
@ -1536,6 +1537,8 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
|
||||
GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(ghost_event_proc, &ps);
|
||||
|
||||
GHOST_SetBacktraceHandler((GHOST_TBacktraceFn)BLI_system_backtrace);
|
||||
|
||||
g_WS.ghost_system = GHOST_CreateSystem();
|
||||
GHOST_AddEventConsumer(g_WS.ghost_system, consumer);
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_system.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
@ -1543,6 +1544,8 @@ void wm_ghost_init(bContext *C)
|
||||
consumer = GHOST_CreateEventConsumer(ghost_event_proc, C);
|
||||
}
|
||||
|
||||
GHOST_SetBacktraceHandler((GHOST_TBacktraceFn)BLI_system_backtrace);
|
||||
|
||||
g_system = GHOST_CreateSystem();
|
||||
|
||||
GHOST_Debug debug = {0};
|
||||
|
Loading…
Reference in New Issue
Block a user