src/video/x11/SDL_x11xinput2.c
changeset 6375 93f9a24d1c02
parent 6318 49b2cb56db6e
child 6432 de49d33b829e
equal deleted inserted replaced
6374:d4ed97e63c22 6375:93f9a24d1c02
    27 #include "../../events/SDL_mouse_c.h"
    27 #include "../../events/SDL_mouse_c.h"
    28 #include "../../events/SDL_touch_c.h"
    28 #include "../../events/SDL_touch_c.h"
    29 
    29 
    30 #define MAX_AXIS 16
    30 #define MAX_AXIS 16
    31 
    31 
       
    32 #if SDL_VIDEO_DRIVER_X11_XINPUT2
    32 static int xinput2_initialized = 0;
    33 static int xinput2_initialized = 0;
       
    34 
       
    35 #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
    33 static int xinput2_multitouch_supported = 0;
    36 static int xinput2_multitouch_supported = 0;
    34 /* Opcode returned XQueryExtension 
    37 #endif
       
    38 
       
    39 /* Opcode returned XQueryExtension
    35  * It will be used in event processing
    40  * It will be used in event processing
    36  * to know that the event came from
    41  * to know that the event came from
    37  * this extension */ 
    42  * this extension */ 
    38 static int xinput2_opcode;
    43 static int xinput2_opcode;
    39 
    44 
    40 
       
    41 #if SDL_VIDEO_DRIVER_X11_XINPUT2
       
    42 static void parse_valuators(const double *input_values,unsigned char *mask,int mask_len,
    45 static void parse_valuators(const double *input_values,unsigned char *mask,int mask_len,
    43                             double *output_values,int output_values_len) {
    46                             double *output_values,int output_values_len) {
    44     int i = 0,z = 0;
    47     int i = 0,z = 0;
    45     int top = mask_len * 8;
    48     int top = mask_len * 8;
    46     if (top > MAX_AXIS)
    49     if (top > MAX_AXIS)
   235 }
   238 }
   236 
   239 
   237 
   240 
   238 int 
   241 int 
   239 X11_Xinput2IsInitialized() {
   242 X11_Xinput2IsInitialized() {
       
   243 #if SDL_VIDEO_DRIVER_X11_XINPUT2
   240     return xinput2_initialized;
   244     return xinput2_initialized;
       
   245 #else
       
   246     return 0;
       
   247 #endif
   241 }
   248 }
   242 
   249 
   243 int
   250 int
   244 X11_Xinput2IsMutitouchSupported() {
   251 X11_Xinput2IsMutitouchSupported() {
       
   252 #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
   245     return xinput2_initialized && xinput2_multitouch_supported;
   253     return xinput2_initialized && xinput2_multitouch_supported;
       
   254 #else
       
   255     return 0;
       
   256 #endif
   246 }
   257 }
   247 
   258 
   248 #endif /* SDL_VIDEO_DRIVER_X11 */
   259 #endif /* SDL_VIDEO_DRIVER_X11 */
   249 
   260 
   250 /* vi: set ts=4 sw=4 expandtab: */
   261 /* vi: set ts=4 sw=4 expandtab: */