Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Rishel <rishel.nick@gmail.com>2021-06-23 03:30:10 +0300
committerNicholas Rishel <rishel.nick@gmail.com>2022-04-18 01:21:59 +0300
commitbf80dc2bd4ac9fab125982a08d616e248f329701 (patch)
tree1045ef4027b23beba2498f066c4a3942044e79e4
parent213cd39b6db387bd88f12589fd50ff0e6563cf56 (diff)
Add debugging info for Wintab activated by argument `--debug-wintab`.
Bonus: Added docs for `--debug-ghost`. Differential Revision: https://developer.blender.org/D14610
-rw-r--r--intern/ghost/GHOST_C-api.h4
-rw-r--r--intern/ghost/GHOST_ISystem.h3
-rw-r--r--intern/ghost/GHOST_Types.h10
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp4
-rw-r--r--intern/ghost/intern/GHOST_System.cpp4
-rw-r--r--intern/ghost/intern/GHOST_System.h3
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp71
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h10
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_Wintab.cpp160
-rw-r--r--intern/ghost/intern/GHOST_Wintab.h28
m---------release/datafiles/locale0
m---------release/scripts/addons0
-rw-r--r--source/blender/blenkernel/BKE_global.h5
-rw-r--r--source/blender/windowmanager/intern/wm_window.c10
-rw-r--r--source/creator/creator_args.c14
m---------source/tools0
17 files changed, 316 insertions, 12 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index a82f634183d..ec641938f1f 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -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.
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index ed193ee7e5d..bb91abbadec 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -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.
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index c654367072f..85913fbd10c 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -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
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index e3d01c24283..93e94893162 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -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)
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index 3df85e18bc7..0d0d41972fd 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -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()
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 0e1e3f734ae..4a3cded1fbd 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -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.
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index e588c7485b4..83869188b65 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -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);
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 16ad5f041ca..9f8d52f9ca3 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -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.
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 11a3c097958..2ce224b666b 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -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;
}
diff --git a/intern/ghost/intern/GHOST_Wintab.cpp b/intern/ghost/intern/GHOST_Wintab.cpp
index 2547a38c0d1..be1a0a4b314 100644
--- a/intern/ghost/intern/GHOST_Wintab.cpp
+++ b/intern/ghost/intern/GHOST_Wintab.cpp
@@ -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);
+} \ No newline at end of file
diff --git a/intern/ghost/intern/GHOST_Wintab.h b/intern/ghost/intern/GHOST_Wintab.h
index a793d2d8f63..86a0143ecc0 100644
--- a/intern/ghost/intern/GHOST_Wintab.h
+++ b/intern/ghost/intern/GHOST_Wintab.h
@@ -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();
};
diff --git a/release/datafiles/locale b/release/datafiles/locale
-Subproject 716dc02ec30c0810513f7b4adc4ae865ae50c4e
+Subproject 63699f968344db7dc853d2c5972325beea44900
diff --git a/release/scripts/addons b/release/scripts/addons
-Subproject 787ea78f7fa6f0373d80ba1247768402df93f8a
+Subproject baa581415c7ed23d7c45ef87363174813567268
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index d82e7460071..2070584a8a0 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -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 {
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 89bb6906a22..382a37e09e5 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -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);
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 05b7f1bcb85..b3f5d24ee8c 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -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);
diff --git a/source/tools b/source/tools
-Subproject 1e658ca996f11e5ff3398d89bd81f5b719304a5
+Subproject 4c1e01e3e309282beb1af3b1eddb2c7f9a666b5