Blender  V3.3
Classes | Public Member Functions | Static Public Member Functions | List of all members
GHOST_Wintab Class Reference

#include <GHOST_Wintab.h>

Public Member Functions

 ~GHOST_Wintab ()
 
void enable ()
 
void disable ()
 
void gainFocus ()
 
void loseFocus ()
 
void leaveRange ()
 
void remapCoordinates ()
 
void mapWintabToSysCoordinates (int x_in, int y_in, int &x_out, int &y_out)
 
void updateCursorInfo ()
 
void processInfoChange (LPARAM lParam)
 
bool devicesPresent ()
 
void getInput (std::vector< GHOST_WintabInfoWin32 > &outWintabInfo)
 
bool trustCoordinates ()
 
bool testCoordinates (int sysX, int sysY, int wtX, int wtY)
 
GHOST_TabletData getLastTabletData ()
 

Static Public Member Functions

static GHOST_WintabloadWintab (HWND hwnd)
 
static void setDebug (bool debug)
 
static bool getDebug ()
 

Detailed Description

Definition at line 62 of file GHOST_Wintab.h.

Constructor & Destructor Documentation

◆ ~GHOST_Wintab()

GHOST_Wintab::~GHOST_Wintab ( )

Definition at line 202 of file GHOST_Wintab.cpp.

References WINTAB_PRINTF.

Member Function Documentation

◆ devicesPresent()

bool GHOST_Wintab::devicesPresent ( )

Whether Wintab devices are present.

Returns
True if Wintab devices are present.

Definition at line 297 of file GHOST_Wintab.cpp.

Referenced by GHOST_WindowWin32::usingTabletAPI().

◆ disable()

void GHOST_Wintab::disable ( )

Disables the Wintab context and unwinds Wintab state.

Definition at line 213 of file GHOST_Wintab.cpp.

References loseFocus().

Referenced by GHOST_SystemWin32::s_wndProc().

◆ enable()

void GHOST_Wintab::enable ( )

Enables Wintab context.

Definition at line 207 of file GHOST_Wintab.cpp.

Referenced by GHOST_WindowWin32::loadWintab(), loadWintab(), and GHOST_SystemWin32::s_wndProc().

◆ gainFocus()

void GHOST_Wintab::gainFocus ( )

Brings Wintab context to the top of the overlap order.

Definition at line 222 of file GHOST_Wintab.cpp.

Referenced by GHOST_WindowWin32::loadWintab(), and GHOST_SystemWin32::s_wndProc().

◆ getDebug()

bool GHOST_Wintab::getDebug ( )
static

Definition at line 489 of file GHOST_Wintab.cpp.

◆ getInput()

void GHOST_Wintab::getInput ( std::vector< GHOST_WintabInfoWin32 > &  outWintabInfo)

◆ getLastTabletData()

GHOST_TabletData GHOST_Wintab::getLastTabletData ( )

Retrieve the most recent tablet data, or none if pen is not in range.

Returns
Most recent tablet data, or none if pen is not in range.

Definition at line 302 of file GHOST_Wintab.cpp.

Referenced by GHOST_WindowWin32::getTabletData(), and GHOST_SystemWin32::processWintabEvent().

◆ leaveRange()

void GHOST_Wintab::leaveRange ( )

Clean up when Wintab leaves tracking range.

Definition at line 242 of file GHOST_Wintab.cpp.

References GHOST_TABLET_DATA_NONE.

Referenced by loseFocus(), and GHOST_SystemWin32::s_wndProc().

◆ loadWintab()

GHOST_Wintab * GHOST_Wintab::loadWintab ( HWND  hwnd)
static

Loads Wintab if available.

Parameters
hwndWindow to attach Wintab context to.
Returns
Pointer to the initialized GHOST_Wintab object, or null if initialization failed.

Definition at line 11 of file GHOST_Wintab.cpp.

References enable(), FALSE, min, and WINTAB_PRINTF.

Referenced by GHOST_WindowWin32::loadWintab().

◆ loseFocus()

void GHOST_Wintab::loseFocus ( )

Puts Wintab context at bottom of overlap order and unwinds Wintab state.

Definition at line 228 of file GHOST_Wintab.cpp.

References GHOST_TabletData::Active, GHOST_kTabletModeNone, and leaveRange().

Referenced by disable(), and GHOST_SystemWin32::s_wndProc().

◆ mapWintabToSysCoordinates()

void GHOST_Wintab::mapWintabToSysCoordinates ( int  x_in,
int  y_in,
int &  x_out,
int &  y_out 
)

Maps Wintab to Win32 display coordinates.

Parameters
x_inThe tablet x coordinate.
y_inThe tablet y coordinate.
x_outOutput for the Win32 mapped x coordinate.
y_outOutput for the Win32 mapped y coordinate.

Definition at line 433 of file GHOST_Wintab.cpp.

References blender::math::abs(), and usdtokens::out().

Referenced by GHOST_SystemWin32::processWintabEvent(), and testCoordinates().

◆ processInfoChange()

void GHOST_Wintab::processInfoChange ( LPARAM  lParam)

Handle Wintab info changes such as change in number of connected tablets.

Parameters
lParamLPARAM of the event.

Definition at line 288 of file GHOST_Wintab.cpp.

References WINTAB_PRINTF.

Referenced by GHOST_SystemWin32::s_wndProc().

◆ remapCoordinates()

void GHOST_Wintab::remapCoordinates ( )

Handle Wintab coordinate changes when DisplayChange events occur.

Definition at line 252 of file GHOST_Wintab.cpp.

Referenced by GHOST_SystemWin32::s_wndProc().

◆ setDebug()

void GHOST_Wintab::setDebug ( bool  debug)
static

Definition at line 484 of file GHOST_Wintab.cpp.

Referenced by GHOST_SystemWin32::initDebug().

◆ testCoordinates()

bool GHOST_Wintab::testCoordinates ( int  sysX,
int  sysY,
int  wtX,
int  wtY 
)

Tests whether Wintab coordinates can be trusted by comparing Win32 and Wintab reported cursor position.

Parameters
sysXSystem cursor x position.
sysYSystem cursor y position.
wtXWintab cursor x position.
wtYWintab cursor y position.
Returns
True if Win32 and Wintab cursor positions match within tolerance.

NOTE: Only test coordinates on button press, not release. This prevents issues when async mismatch causes mouse movement to replay and snap back, which is only an issue while drawing.

Definition at line 467 of file GHOST_Wintab.cpp.

References blender::math::abs(), and mapWintabToSysCoordinates().

Referenced by GHOST_SystemWin32::processWintabEvent().

◆ trustCoordinates()

bool GHOST_Wintab::trustCoordinates ( )

Whether Wintab coordinates should be trusted.

Returns
True if Wintab coordinates should be trusted.

Definition at line 462 of file GHOST_Wintab.cpp.

Referenced by GHOST_SystemWin32::processWintabEvent().

◆ updateCursorInfo()

void GHOST_Wintab::updateCursorInfo ( )

Updates cached Wintab properties for current cursor.

Definition at line 264 of file GHOST_Wintab.cpp.

References WINTAB_PRINTF.

Referenced by GHOST_SystemWin32::s_wndProc().


The documentation for this class was generated from the following files: