Add debugging info for Wintab activated by argument `--debug-wintab`.

Bonus: Added docs for `--debug-ghost`.

Differential Revision: https://developer.blender.org/D14610
This commit is contained in:
Nicholas Rishel 2021-06-22 17:30:10 -07:00
parent 213cd39b6d
commit bf80dc2bd4
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by issue #97743, OBJ/MTL import: opaque blend mode when d<1
Referenced by issue #97644, Regression: OBJ/MTL import: new 3.2 importer does not set EEVEE blend mode for illum values
Referenced by issue #97642, OBJ/MTL export: problems with map_d imfchan, d
17 changed files with 319 additions and 15 deletions

View File

@ -30,8 +30,10 @@ extern GHOST_SystemHandle GHOST_CreateSystem(void);
/**
* Specifies whether debug messages are to be enabled for the specific system handle.
* \param systemhandle: The handle to the system.
* \param debug: Flag for systems to debug.
*/
extern void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, int is_debug_enabled);
extern void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug);
/**
* Disposes the one and only system.

View File

@ -452,8 +452,9 @@ class GHOST_ISystem {
/**
* Specify whether debug messages are to be shown.
* \param debug: Flag for systems to debug.
*/
virtual void initDebug(bool is_debug_enabled) = 0;
virtual void initDebug(GHOST_Debug debug) = 0;
/**
* Check whether debug messages are to be shown.

View File

@ -573,6 +573,16 @@ typedef struct {
uint32_t frequency;
} GHOST_DisplaySetting;
typedef enum {
/** Axis that cursor grab will wrap. */
GHOST_kDebugDefault = (1 << 1),
GHOST_kDebugWintab = (1 << 2),
} GHOST_TDebugFlags;
typedef struct {
int flags;
} GHOST_Debug;
#ifdef _WIN32
typedef void *GHOST_TEmbedderWindowID;
#endif // _WIN32

View File

@ -30,11 +30,11 @@ GHOST_SystemHandle GHOST_CreateSystem(void)
return (GHOST_SystemHandle)system;
}
void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, int is_debug_enabled)
void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
system->initDebug(is_debug_enabled);
system->initDebug(debug);
}
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)

View File

@ -390,9 +390,9 @@ void GHOST_System::useWindowFocus(const bool use_focus)
m_windowFocus = use_focus;
}
void GHOST_System::initDebug(bool is_debug_enabled)
void GHOST_System::initDebug(GHOST_Debug debug)
{
m_is_debug_enabled = is_debug_enabled;
m_is_debug_enabled = debug.flags & GHOST_kDebugDefault;
}
bool GHOST_System::isDebugEnabled()

View File

@ -334,8 +334,9 @@ class GHOST_System : public GHOST_ISystem {
/**
* Specify whether debug messages are to be shown.
* \param debug: Flag for systems to debug.
*/
virtual void initDebug(bool is_debug_enabled);
virtual void initDebug(GHOST_Debug debug);
/**
* Check whether debug messages are to be shown.

View File

@ -872,6 +872,13 @@ GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type,
int msgPosY = GET_Y_LPARAM(msgPos);
system->pushEvent(new GHOST_EventCursor(
::GetMessageTime(), GHOST_kEventCursorMove, window, msgPosX, msgPosY, td));
if (type == GHOST_kEventButtonDown) {
WINTAB_PRINTF("HWND %p OS button down\n", window->getHWND());
}
else if (type == GHOST_kEventButtonUp) {
WINTAB_PRINTF("HWND %p OS button up\n", window->getHWND());
}
}
window->updateMouseCapture(type == GHOST_kEventButtonDown ? MousePressed : MouseReleased);
@ -914,6 +921,8 @@ void GHOST_SystemWin32::processWintabEvent(GHOST_WindowWin32 *window)
break;
}
case GHOST_kEventButtonDown: {
WINTAB_PRINTF("HWND %p Wintab button down", window->getHWND());
UINT message;
switch (info.button) {
case GHOST_kButtonMaskLeft:
@ -939,9 +948,12 @@ void GHOST_SystemWin32::processWintabEvent(GHOST_WindowWin32 *window)
/* Test for Win32/Wintab button down match. */
useWintabPos = wt->testCoordinates(msg.pt.x, msg.pt.y, info.x, info.y);
if (!useWintabPos) {
WINTAB_PRINTF(" ... but associated system button mismatched position\n");
continue;
}
WINTAB_PRINTF(" ... associated to system button\n");
/* Steal the Win32 event which was previously peeked. */
PeekMessage(&msg, window->getHWND(), message, message, PM_REMOVE | PM_NOYIELD);
@ -958,9 +970,14 @@ void GHOST_SystemWin32::processWintabEvent(GHOST_WindowWin32 *window)
mouseMoveHandled = true;
break;
}
else {
WINTAB_PRINTF(" ... but no system button\n");
}
}
case GHOST_kEventButtonUp: {
WINTAB_PRINTF("HWND %p Wintab button up", window->getHWND());
if (!useWintabPos) {
WINTAB_PRINTF(" ... but Wintab position isn't trusted\n");
continue;
}
@ -986,10 +1003,14 @@ void GHOST_SystemWin32::processWintabEvent(GHOST_WindowWin32 *window)
if (PeekMessage(&msg, window->getHWND(), message, message, PM_REMOVE | PM_NOYIELD) &&
msg.message != WM_QUIT) {
WINTAB_PRINTF(" ... associated to system button\n");
window->updateMouseCapture(MouseReleased);
system->pushEvent(
new GHOST_EventButton(info.time, info.type, window, info.button, info.tabletData));
}
else {
WINTAB_PRINTF(" ... but no system button\n");
}
break;
}
default:
@ -1318,6 +1339,12 @@ void GHOST_SystemWin32::setTabletAPI(GHOST_TTabletAPI api)
}
}
void GHOST_SystemWin32::initDebug(GHOST_Debug debug)
{
GHOST_System::initDebug(debug);
GHOST_Wintab::setDebug(debug.flags & GHOST_kDebugWintab);
}
void GHOST_SystemWin32::processMinMaxInfo(MINMAXINFO *minmax)
{
minmax->ptMinTrackSize.x = 320;
@ -1593,6 +1620,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
// Wintab events, processed
////////////////////////////////////////////////////////////////////////
case WT_CSRCHANGE: {
WINTAB_PRINTF("HWND %p HCTX %p WT_CSRCHANGE\n", window->getHWND(), (void *)lParam);
GHOST_Wintab *wt = window->getWintab();
if (wt) {
wt->updateCursorInfo();
@ -1601,6 +1629,20 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
}
case WT_PROXIMITY: {
WINTAB_PRINTF("HWND %p HCTX %p WT_PROXIMITY\n", window->getHWND(), (void *)wParam);
if (LOWORD(lParam)) {
WINTAB_PRINTF(" Cursor entering context.\n");
}
else {
WINTAB_PRINTF(" Cursor leaving context.\n");
}
if (HIWORD(lParam)) {
WINTAB_PRINTF(" Cursor entering or leaving hardware proximity.\n");
}
else {
WINTAB_PRINTF(" Cursor neither entering nor leaving hardware proximity.\n");
}
GHOST_Wintab *wt = window->getWintab();
if (wt) {
bool inRange = LOWORD(lParam);
@ -1616,6 +1658,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
}
case WT_INFOCHANGE: {
WINTAB_PRINTF("HWND %p HCTX %p WT_INFOCHANGE\n", window->getHWND(), (void *)wParam);
GHOST_Wintab *wt = window->getWintab();
if (wt) {
wt->processInfoChange(lParam);
@ -1632,6 +1675,32 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
eventHandled = true;
break;
////////////////////////////////////////////////////////////////////////
// Wintab events, debug
////////////////////////////////////////////////////////////////////////
case WT_CTXOPEN:
WINTAB_PRINTF("HWND %p HCTX %p WT_CTXOPEN\n", window->getHWND(), (void *)wParam);
break;
case WT_CTXCLOSE:
WINTAB_PRINTF("HWND %p HCTX %p WT_CTXCLOSE\n", window->getHWND(), (void *)wParam);
break;
case WT_CTXUPDATE:
WINTAB_PRINTF("HWND %p HCTX %p WT_CTXUPDATE\n", window->getHWND(), (void *)wParam);
break;
case WT_CTXOVERLAP:
WINTAB_PRINTF("HWND %p HCTX %p WT_CTXOVERLAP", window->getHWND(), (void *)wParam);
switch (lParam) {
case CXS_DISABLED:
WINTAB_PRINTF(" CXS_DISABLED\n");
break;
case CXS_OBSCURED:
WINTAB_PRINTF(" CXS_OBSCURED\n");
break;
case CXS_ONTOP:
WINTAB_PRINTF(" CXS_ONTOP\n");
break;
}
break;
////////////////////////////////////////////////////////////////////////
// Pointer events, processed
////////////////////////////////////////////////////////////////////////
case WM_POINTERUPDATE:
@ -1692,6 +1761,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_MOUSEMOVE:
if (!window->m_mousePresent) {
WINTAB_PRINTF("HWND %p mouse enter\n", window->getHWND());
TRACKMOUSEEVENT tme = {sizeof(tme)};
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
@ -1740,6 +1810,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
break;
case WM_MOUSELEAVE: {
WINTAB_PRINTF("HWND %p mouse leave\n", window->getHWND());
window->m_mousePresent = false;
if (window->getTabletData().Active == GHOST_kTabletModeNone) {
event = processCursorEvent(window);

View File

@ -259,6 +259,16 @@ class GHOST_SystemWin32 : public GHOST_System {
*/
void setTabletAPI(GHOST_TTabletAPI api) override;
/***************************************************************************************
** Debug Info
***************************************************************************************/
/**
* Specify which debug messages are to be shown.
* \param debug: Flag for systems to debug.
*/
void initDebug(GHOST_Debug debug) override;
protected:
/**
* Initializes the system.

View File

@ -960,6 +960,7 @@ GHOST_Wintab *GHOST_WindowWin32::getWintab() const
void GHOST_WindowWin32::loadWintab(bool enable)
{
if (!m_wintab) {
WINTAB_PRINTF("Loading Wintab for window %p\n", m_hWnd);
if (m_wintab = GHOST_Wintab::loadWintab(m_hWnd)) {
if (enable) {
m_wintab->enable();
@ -982,6 +983,7 @@ void GHOST_WindowWin32::loadWintab(bool enable)
void GHOST_WindowWin32::closeWintab()
{
WINTAB_PRINTF("Closing Wintab for window %p\n", m_hWnd);
delete m_wintab;
m_wintab = NULL;
}

View File

@ -11,7 +11,6 @@
GHOST_Wintab *GHOST_Wintab::loadWintab(HWND hwnd)
{
/* Load Wintab library if available. */
auto handle = unique_hmodule(::LoadLibrary("Wintab32.dll"), &::FreeLibrary);
if (!handle) {
return nullptr;
@ -116,6 +115,11 @@ GHOST_Wintab *GHOST_Wintab::loadWintab(HWND hwnd)
}
}
int sanityQueueSize = queueSizeGet(hctx.get());
WINTAB_PRINTF("HCTX %p %s queueSize: %d, queueSizeGet: %d\n", hctx.get(), __func__, queueSize, sanityQueueSize);
WINTAB_PRINTF("Loaded Wintab context %p\n", hctx.get());
return new GHOST_Wintab(std::move(handle),
info,
get,
@ -183,7 +187,17 @@ GHOST_Wintab::GHOST_Wintab(unique_hmodule handle,
m_pkts{queueSize}
{
m_fpInfo(WTI_INTERFACE, IFC_NDEVICES, &m_numDevices);
WINTAB_PRINTF("Wintab Devices: %d\n", m_numDevices);
updateCursorInfo();
/* Debug info. */
printContextDebugInfo();
}
GHOST_Wintab::~GHOST_Wintab()
{
WINTAB_PRINTF("Closing Wintab context %p\n", m_context.get());
}
void GHOST_Wintab::enable()
@ -249,6 +263,7 @@ void GHOST_Wintab::updateCursorInfo()
BOOL pressureSupport = m_fpInfo(WTI_DEVICES, DVC_NPRESSURE, &Pressure);
m_maxPressure = pressureSupport ? Pressure.axMax : 0;
WINTAB_PRINTF("HCTX %p %s maxPressure: %d\n", m_context.get(), __func__, m_maxPressure);
BOOL tiltSupport = m_fpInfo(WTI_DEVICES, DVC_ORIENTATION, &Orientation);
/* Check if tablet supports azimuth [0] and altitude [1], encoded in axResolution. */
@ -259,6 +274,7 @@ void GHOST_Wintab::updateCursorInfo()
else {
m_maxAzimuth = m_maxAltitude = 0;
}
WINTAB_PRINTF("HCTX %p %s maxAzimuth: %d, maxAltitude: %d\n", m_context.get(), __func__, m_maxAzimuth, m_maxAltitude);
}
void GHOST_Wintab::processInfoChange(LPARAM lParam)
@ -266,6 +282,7 @@ void GHOST_Wintab::processInfoChange(LPARAM lParam)
/* Update number of connected Wintab digitizers. */
if (LOWORD(lParam) == WTI_INTERFACE && HIWORD(lParam) == IFC_NDEVICES) {
m_fpInfo(WTI_INTERFACE, IFC_NDEVICES, &m_numDevices);
WINTAB_PRINTF("HCTX %p %s numDevices: %d\n", m_context.get(), __func__, m_numDevices);
}
}
@ -456,3 +473,144 @@ bool GHOST_Wintab::testCoordinates(int sysX, int sysY, int wtX, int wtY)
return false;
}
}
bool GHOST_Wintab::m_debug = false;
void GHOST_Wintab::setDebug(bool debug)
{
m_debug = debug;
}
bool GHOST_Wintab::getDebug()
{
return m_debug;
}
void GHOST_Wintab::printContextDebugInfo()
{
if (!m_debug) {
return;
}
/* Print button maps. */
BYTE logicalButtons[32] = {0};
BYTE systemButtons[32] = {0};
for (int i = 0; i < 3; i++) {
printf("initializeWintab cursor %d buttons\n", i);
UINT lbut = m_fpInfo(WTI_CURSORS + i, CSR_BUTTONMAP, &logicalButtons);
if (lbut) {
printf("%d", logicalButtons[0]);
for (int j = 1; j < lbut; j++) {
printf(", %d", logicalButtons[j]);
}
printf("\n");
}
else {
printf("logical button error\n");
}
UINT sbut = m_fpInfo(WTI_CURSORS + i, CSR_SYSBTNMAP, &systemButtons);
if (sbut) {
printf("%d", systemButtons[0]);
for (int j = 1; j < sbut; j++) {
printf(", %d", systemButtons[j]);
}
printf("\n");
}
else {
printf("system button error\n");
}
}
/* Print context information. */
/* Print open context constraints. */
UINT maxcontexts, opencontexts;
m_fpInfo(WTI_INTERFACE, IFC_NCONTEXTS, &maxcontexts);
m_fpInfo(WTI_STATUS, STA_CONTEXTS, &opencontexts);
printf("%u max contexts, %u open contexts\n", maxcontexts, opencontexts);
/* Print system information. */
printf("left: %d, top: %d, width: %d, height: %d\n",
::GetSystemMetrics(SM_XVIRTUALSCREEN),
::GetSystemMetrics(SM_YVIRTUALSCREEN),
::GetSystemMetrics(SM_CXVIRTUALSCREEN),
::GetSystemMetrics(SM_CYVIRTUALSCREEN));
auto printContextRanges = [](LOGCONTEXT &lc) {
printf("lcInOrgX: %d, lcInOrgY: %d, lcInExtX: %d, lcInExtY: %d\n",
lc.lcInOrgX,
lc.lcInOrgY,
lc.lcInExtX,
lc.lcInExtY);
printf("lcOutOrgX: %d, lcOutOrgY: %d, lcOutExtX: %d, lcOutExtY: %d\n",
lc.lcOutOrgX,
lc.lcOutOrgY,
lc.lcOutExtX,
lc.lcOutExtY);
printf("lcSysOrgX: %d, lcSysOrgY: %d, lcSysExtX: %d, lcSysExtY: %d\n",
lc.lcSysOrgX,
lc.lcSysOrgY,
lc.lcSysExtX,
lc.lcSysExtY);
};
LOGCONTEXT lc;
/* Print system context. */
m_fpInfo(WTI_DEFSYSCTX, 0, &lc);
printf("WTI_DEFSYSCTX\n");
printContextRanges(lc);
/* Print system context, manually populated. */
m_fpInfo(WTI_DEFSYSCTX, CTX_INORGX, &lc.lcInOrgX);
m_fpInfo(WTI_DEFSYSCTX, CTX_INORGY, &lc.lcInOrgY);
m_fpInfo(WTI_DEFSYSCTX, CTX_INEXTX, &lc.lcInExtX);
m_fpInfo(WTI_DEFSYSCTX, CTX_INEXTY, &lc.lcInExtY);
m_fpInfo(WTI_DEFSYSCTX, CTX_OUTORGX, &lc.lcOutOrgX);
m_fpInfo(WTI_DEFSYSCTX, CTX_OUTORGY, &lc.lcOutOrgY);
m_fpInfo(WTI_DEFSYSCTX, CTX_OUTEXTX, &lc.lcOutExtX);
m_fpInfo(WTI_DEFSYSCTX, CTX_OUTEXTY, &lc.lcOutExtY);
m_fpInfo(WTI_DEFSYSCTX, CTX_SYSORGX, &lc.lcSysOrgX);
m_fpInfo(WTI_DEFSYSCTX, CTX_SYSORGY, &lc.lcSysOrgY);
m_fpInfo(WTI_DEFSYSCTX, CTX_SYSEXTX, &lc.lcSysExtX);
m_fpInfo(WTI_DEFSYSCTX, CTX_SYSEXTY, &lc.lcSysExtY);
printf("WTI_DEFSYSCTX CTX_*\n");
printContextRanges(lc);
for (unsigned int i = 0; i < m_numDevices; i++) {
/* Print individual device system context. */
m_fpInfo(WTI_DSCTXS + i, 0, &lc);
printf("WTI_DSCTXS %u\n", i);
printContextRanges(lc);
/* Print individual device system context, manually populated. */
m_fpInfo(WTI_DSCTXS + i, CTX_INORGX, &lc.lcInOrgX);
m_fpInfo(WTI_DSCTXS + i, CTX_INORGY, &lc.lcInOrgY);
m_fpInfo(WTI_DSCTXS + i, CTX_INEXTX, &lc.lcInExtX);
m_fpInfo(WTI_DSCTXS + i, CTX_INEXTY, &lc.lcInExtY);
m_fpInfo(WTI_DSCTXS + i, CTX_OUTORGX, &lc.lcOutOrgX);
m_fpInfo(WTI_DSCTXS + i, CTX_OUTORGY, &lc.lcOutOrgY);
m_fpInfo(WTI_DSCTXS + i, CTX_OUTEXTX, &lc.lcOutExtX);
m_fpInfo(WTI_DSCTXS + i, CTX_OUTEXTY, &lc.lcOutExtY);
m_fpInfo(WTI_DSCTXS + i, CTX_SYSORGX, &lc.lcSysOrgX);
m_fpInfo(WTI_DSCTXS + i, CTX_SYSORGY, &lc.lcSysOrgY);
m_fpInfo(WTI_DSCTXS + i, CTX_SYSEXTX, &lc.lcSysExtX);
m_fpInfo(WTI_DSCTXS + i, CTX_SYSEXTY, &lc.lcSysExtY);
printf("WTI_DSCTX %u CTX_*\n", i);
printContextRanges(lc);
/* Print device axis. */
AXIS axis_x, axis_y;
m_fpInfo(WTI_DEVICES + i, DVC_X, &axis_x);
m_fpInfo(WTI_DEVICES + i, DVC_Y, &axis_y);
printf("WTI_DEVICES %u axis_x org: %d, axis_y org: %d axis_x ext: %d, axis_y ext: %d\n",
i,
axis_x.axMin,
axis_y.axMin,
axis_x.axMax - axis_x.axMin + 1,
axis_y.axMax - axis_y.axMin + 1);
}
/* Other stuff while we have a logcontext. */
printf("sysmode %d\n", lc.lcSysMode);
}

View File

@ -13,6 +13,7 @@
#pragma once
#include <memory>
#include <stdio.h>
#include <vector>
#include <wtypes.h>
@ -25,6 +26,14 @@
#define PACKETMODE 0
#include <pktdef.h>
#define WINTAB_PRINTF(x, ...) \
{ \
if (GHOST_Wintab::getDebug()) { \
printf(x, __VA_ARGS__); \
} \
} \
(void)0
/* Typedefs for Wintab functions to allow dynamic loading. */
typedef UINT(API *GHOST_WIN32_WTInfo)(UINT, UINT, LPVOID);
typedef BOOL(API *GHOST_WIN32_WTGet)(HCTX, LPLOGCONTEXTA);
@ -55,9 +64,12 @@ class GHOST_Wintab {
/**
* Loads Wintab if available.
* \param hwnd: Window to attach Wintab context to.
* \return Pointer to the initialized GHOST_Wintab object, or null if initialization failed.
*/
static GHOST_Wintab *loadWintab(HWND hwnd);
~GHOST_Wintab();
/**
* Enables Wintab context.
*/
@ -146,6 +158,16 @@ class GHOST_Wintab {
*/
GHOST_TabletData getLastTabletData();
/* Sets Wintab debugging.
* \param debug: True to enable Wintab debugging.
*/
static void setDebug(bool debug);
/* Returns whether Wintab logging should occur.
* \return True if Wintab logging should occur.
*/
static bool getDebug();
private:
/** Wintab DLL handle. */
unique_hmodule m_handle;
@ -200,6 +222,9 @@ class GHOST_Wintab {
/** Most recently received tablet data, or none if pen is not in range. */
GHOST_TabletData m_lastTabletData = GHOST_TABLET_DATA_NONE;
/** Whether Wintab logging is enabled. */
static bool m_debug;
GHOST_Wintab(unique_hmodule handle,
GHOST_WIN32_WTInfo info,
GHOST_WIN32_WTGet get,
@ -233,4 +258,7 @@ class GHOST_Wintab {
* \param system: System coordinates.
*/
static void extractCoordinates(LOGCONTEXT &lc, Coord &tablet, Coord &system);
/* Prints Wintab Context information. */
void printContextDebugInfo();
};

@ -1 +1 @@
Subproject commit 716dc02ec30c0810513f7b4adc4ae865ae50c4e6
Subproject commit 63699f968344db7dc853d2c5972325beea44900c

@ -1 +1 @@
Subproject commit 787ea78f7fa6f0373d80ba1247768402df93f8ad
Subproject commit baa581415c7ed23d7c45ef873631748135672683

View File

@ -195,12 +195,13 @@ enum {
G_DEBUG_XR = (1 << 19), /* XR/OpenXR messages */
G_DEBUG_XR_TIME = (1 << 20), /* XR/OpenXR timing messages */
G_DEBUG_GHOST = (1 << 21), /* Debug GHOST module. */
G_DEBUG_GHOST = (1 << 21), /* Debug GHOST module. */
G_DEBUG_WINTAB = (1 << 22), /* Debug Wintab. */
};
#define G_DEBUG_ALL \
(G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
G_DEBUG_FREESTYLE | G_DEBUG_DEPSGRAPH | G_DEBUG_IO | G_DEBUG_GHOST)
G_DEBUG_FREESTYLE | G_DEBUG_DEPSGRAPH | G_DEBUG_IO | G_DEBUG_GHOST | G_DEBUG_WINTAB)
/** #Global.fileflags */
enum {

View File

@ -1541,7 +1541,15 @@ void wm_ghost_init(bContext *C)
}
g_system = GHOST_CreateSystem();
GHOST_SystemInitDebug(g_system, G.debug & G_DEBUG_GHOST);
GHOST_Debug debug = {0};
if (G.debug & G_DEBUG_GHOST) {
debug.flags |= GHOST_kDebugDefault;
}
if (G.debug & G_DEBUG_WINTAB) {
debug.flags |= GHOST_kDebugWintab;
}
GHOST_SystemInitDebug(g_system, debug);
if (C != NULL) {
GHOST_AddEventConsumer(g_system, consumer);

View File

@ -576,6 +576,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
BLI_args_print_arg_doc(ba, "--debug-depsgraph-pretty");
BLI_args_print_arg_doc(ba, "--debug-depsgraph-uuid");
BLI_args_print_arg_doc(ba, "--debug-ghost");
BLI_args_print_arg_doc(ba, "--debug-wintab");
BLI_args_print_arg_doc(ba, "--debug-gpu");
BLI_args_print_arg_doc(ba, "--debug-gpu-force-workarounds");
BLI_args_print_arg_doc(ba, "--debug-wm");
@ -943,6 +944,12 @@ static const char arg_handle_debug_mode_generic_set_doc_wm[] =
"\n\t"
"Enable debug messages for the window manager, shows all operators in search, shows "
"keymap errors.";
static const char arg_handle_debug_mode_generic_set_doc_ghost[] =
"\n\t"
"Enable debug messages for Ghost (Linux only).";
static const char arg_handle_debug_mode_generic_set_doc_wintab[] =
"\n\t"
"Enable debug messages for Wintab.";
# ifdef WITH_XR_OPENXR
static const char arg_handle_debug_mode_generic_set_doc_xr[] =
"\n\t"
@ -2130,8 +2137,13 @@ void main_args_setup(bContext *C, bArgs *ba)
BLI_args_add(ba,
NULL,
"--debug-ghost",
CB_EX(arg_handle_debug_mode_generic_set, handlers),
CB_EX(arg_handle_debug_mode_generic_set, ghost),
(void *)G_DEBUG_GHOST);
BLI_args_add(ba,
NULL,
"--debug-wintab",
CB_EX(arg_handle_debug_mode_generic_set, wintab),
(void *)G_DEBUG_WINTAB);
BLI_args_add(ba, NULL, "--debug-all", CB(arg_handle_debug_mode_all), NULL);
BLI_args_add(ba, NULL, "--debug-io", CB(arg_handle_debug_mode_io), NULL);

@ -1 +1 @@
Subproject commit 1e658ca996f11e5ff3398d89bd81f5b719304a57
Subproject commit 4c1e01e3e309282beb1af3b1eddb2c7f9a666b5d