diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_Wintab.h')
-rw-r--r-- | intern/ghost/intern/GHOST_Wintab.h | 28 |
1 files changed, 28 insertions, 0 deletions
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(); }; |