Procházet zdrojové kódy

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

Ozkan Sezer před 8 měsíci
rodič
revize
f93920a4f1
2 změnil soubory, kde provedl 22 přidání a 11 odebrání
  1. 14 2
      src/video/x11/SDL_x11pen.c
  2. 8 9
      src/video/x11/SDL_x11pen.h

+ 14 - 2
src/video/x11/SDL_x11pen.c

@@ -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
 

+ 8 - 9
src/video/x11/SDL_x11pen.h

@@ -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_
-