video, x11: fix linkage if SDL_VIDEO_DRIVER_X11_XINPUT2 isn't defined.

This commit is contained in:
Ozkan Sezer 2024-08-10 15:55:00 +03:00
parent 8a6fd058b4
commit f93920a4f1
2 changed files with 22 additions and 11 deletions

View File

@ -20,14 +20,14 @@
*/
#include "../../SDL_internal.h"
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
#include "../../events/SDL_pen_c.h"
#include "../SDL_sysvideo.h"
#include "SDL_x11pen.h"
#include "SDL_x11video.h"
#include "SDL_x11xinput2.h"
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
/* Does this device have a valuator for pressure sensitivity? */
static SDL_bool X11_XInput2DeviceIsPen(SDL_VideoDevice *_this, const XIDeviceInfo *dev)
{
@ -416,5 +416,17 @@ void X11_PenAxesFromValuators(const X11_PenHandle *pen,
X11_XInput2NormalizePenAxes(pen, axis_values);
}
#else
void X11_InitPen(SDL_VideoDevice *_this)
{
(void) _this;
}
void X11_QuitPen(SDL_VideoDevice *_this)
{
(void) _this;
}
#endif // SDL_VIDEO_DRIVER_X11_XINPUT2

View File

@ -25,11 +25,17 @@
// Pressure-sensitive pen support for X11.
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
#include "SDL_x11video.h"
#include "../../events/SDL_pen_c.h"
// Prep pen support (never fails; pens simply won't be added if there's a problem).
extern void X11_InitPen(SDL_VideoDevice *_this);
// Clean up pen support.
extern void X11_QuitPen(SDL_VideoDevice *_this);
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
// Forward definition for SDL_x11video.h
struct SDL_VideoData;
@ -47,12 +53,6 @@ typedef struct X11_PenHandle
float axis_max[SDL_PEN_NUM_AXES];
} X11_PenHandle;
// Prep pen support (never fails; pens simply won't be added if there's a problem).
extern void X11_InitPen(SDL_VideoDevice *_this);
// Clean up pen support.
extern void X11_QuitPen(SDL_VideoDevice *_this);
// Converts XINPUT2 valuators into pen axis information, including normalisation.
extern void X11_PenAxesFromValuators(const X11_PenHandle *pen,
const double *input_values, const unsigned char *mask, const int mask_len,
@ -70,4 +70,3 @@ extern X11_PenHandle *X11_FindPenByDeviceID(int deviceid);
#endif // SDL_VIDEO_DRIVER_X11_XINPUT2
#endif // SDL_x11pen_h_