diff options
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/x11/SDL_x11pen.h')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/x11/SDL_x11pen.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/x11/SDL_x11pen.h b/contrib/SDL-3.2.8/src/video/x11/SDL_x11pen.h new file mode 100644 index 0000000..de75181 --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/x11/SDL_x11pen.h | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "../../SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_x11pen_h_ | ||
| 24 | #define SDL_x11pen_h_ | ||
| 25 | |||
| 26 | // Pressure-sensitive pen support for X11. | ||
| 27 | |||
| 28 | #include "SDL_x11video.h" | ||
| 29 | #include "../../events/SDL_pen_c.h" | ||
| 30 | |||
| 31 | // Prep pen support (never fails; pens simply won't be added if there's a problem). | ||
| 32 | extern void X11_InitPen(SDL_VideoDevice *_this); | ||
| 33 | |||
| 34 | // Clean up pen support. | ||
| 35 | extern void X11_QuitPen(SDL_VideoDevice *_this); | ||
| 36 | |||
| 37 | #ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 | ||
| 38 | |||
| 39 | // Forward definition for SDL_x11video.h | ||
| 40 | struct SDL_VideoData; | ||
| 41 | |||
| 42 | #define SDL_X11_PEN_AXIS_VALUATOR_MISSING -1 | ||
| 43 | |||
| 44 | typedef struct X11_PenHandle | ||
| 45 | { | ||
| 46 | SDL_PenID pen; | ||
| 47 | bool is_eraser; | ||
| 48 | int x11_deviceid; | ||
| 49 | int valuator_for_axis[SDL_PEN_AXIS_COUNT]; | ||
| 50 | float slider_bias; // shift value to add to PEN_AXIS_SLIDER (before normalisation) | ||
| 51 | float rotation_bias; // rotation to add to PEN_AXIS_ROTATION (after normalisation) | ||
| 52 | float axis_min[SDL_PEN_AXIS_COUNT]; | ||
| 53 | float axis_max[SDL_PEN_AXIS_COUNT]; | ||
| 54 | } X11_PenHandle; | ||
| 55 | |||
| 56 | // Converts XINPUT2 valuators into pen axis information, including normalisation. | ||
| 57 | extern void X11_PenAxesFromValuators(const X11_PenHandle *pen, | ||
| 58 | const double *input_values, const unsigned char *mask, int mask_len, | ||
| 59 | float axis_values[SDL_PEN_AXIS_COUNT]); | ||
| 60 | |||
| 61 | // Add a pen (if this function's further checks validate it). | ||
| 62 | extern X11_PenHandle *X11_MaybeAddPenByDeviceID(SDL_VideoDevice *_this, int deviceid); | ||
| 63 | |||
| 64 | // Remove a pen. It's okay if deviceid is bogus or not a pen, we'll check it. | ||
| 65 | extern void X11_RemovePenByDeviceID(int deviceid); | ||
| 66 | |||
| 67 | // Map X11 device ID to pen ID. | ||
| 68 | extern X11_PenHandle *X11_FindPenByDeviceID(int deviceid); | ||
| 69 | |||
| 70 | #endif // SDL_VIDEO_DRIVER_X11_XINPUT2 | ||
| 71 | |||
| 72 | #endif // SDL_x11pen_h_ | ||
