mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 05:36:35 +00:00
Add tablet termination and global cursor
This commit is contained in:
parent
04cf328ca6
commit
92d93ede90
@ -875,8 +875,11 @@ static float * getDeviceCoordinateTransformationMatrix(Display *display, int dev
|
||||
//
|
||||
static void initPenTablet(Display *display)
|
||||
{
|
||||
_glfw.x11.xi.tablet_cursor = 0;
|
||||
_glfw.x11.xi.stylus_deviceid = 0;
|
||||
_glfw.x11.xi.eraser_deviceid = 0;
|
||||
_glfw.x11.xi.stylus_CTMatrix = NULL;
|
||||
_glfw.x11.xi.eraser_CTMatrix = NULL;
|
||||
|
||||
if (_glfw.x11.xi.available)
|
||||
{
|
||||
@ -927,6 +930,23 @@ static void initPenTablet(Display *display)
|
||||
}
|
||||
}
|
||||
|
||||
// XInput2 terminate pen tablet
|
||||
//
|
||||
static void terminatePenTablet(void)
|
||||
{
|
||||
if (_glfw.x11.xi.stylus_CTMatrix)
|
||||
{
|
||||
XFree(_glfw.x11.xi.stylus_CTMatrix);
|
||||
_glfw.x11.xi.stylus_CTMatrix = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.x11.xi.eraser_CTMatrix)
|
||||
{
|
||||
XFree(_glfw.x11.xi.eraser_CTMatrix);
|
||||
_glfw.x11.xi.eraser_CTMatrix = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
@ -1086,6 +1106,8 @@ int _glfwPlatformInit(void)
|
||||
|
||||
void _glfwPlatformTerminate(void)
|
||||
{
|
||||
terminatePenTablet();
|
||||
|
||||
if (_glfw.x11.helperWindowHandle)
|
||||
{
|
||||
if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) ==
|
||||
|
@ -394,6 +394,7 @@ typedef struct _GLFWlibraryX11
|
||||
XIValuatorClassInfo stylus_ClassInfo[32];
|
||||
float *stylus_CTMatrix;
|
||||
float *eraser_CTMatrix;
|
||||
unsigned int tablet_cursor;
|
||||
int stylus_deviceid;
|
||||
int eraser_deviceid;
|
||||
} xi;
|
||||
|
@ -1238,7 +1238,6 @@ static void processEvent(XEvent *event)
|
||||
if (re->deviceid == _glfw.x11.xi.stylus_deviceid ||
|
||||
re->deviceid == _glfw.x11.xi.eraser_deviceid)
|
||||
{
|
||||
static unsigned int s_cursor = 0;
|
||||
unsigned int cursor = re->deviceid == _glfw.x11.xi.stylus_deviceid ? 1 : 2;
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
@ -1246,10 +1245,10 @@ static void processEvent(XEvent *event)
|
||||
double tiltx = 0.0;
|
||||
double tilty = 0.0;
|
||||
|
||||
if (cursor != s_cursor)
|
||||
if (cursor != _glfw.x11.xi.tablet_cursor)
|
||||
{
|
||||
_glfwInputPenTabletCursor(cursor);
|
||||
s_cursor = cursor;
|
||||
_glfw.x11.xi.tablet_cursor = cursor;
|
||||
}
|
||||
|
||||
if (XIMaskIsSet(re->valuators.mask, 0))
|
||||
|
Loading…
Reference in New Issue
Block a user