Relative mouse mode failing on older version of Linux

Hi,
Compiling SDL on Fedora 19, relative mouse mode fails on Fedora 14.
The problem appears to be Line 76 in SDL_x11xinput2.c:

minor = 2;

I believe this should be moved down so it happens after

xinput2_initialized = 1;

but before the check for multitouch support. It seems xinput2 can be
safely initialized even if multitouch support is not available. Does
this sound okay?–
Terry Welsh
www.reallyslick.com

minor = 2;

I believe this should be moved down so it happens after

xinput2_initialized = 1;

but before the check for multitouch support. It seems xinput2 can be
safely initialized even if multitouch support is not available. Does
this sound okay?

I think we have to call XIQueryVersion() twice to decide what level of
support we can get from the X server. Can you try the attached patch and
see if it fixes the issue?

–ryan.

-------------- next part --------------

HG changeset patch

User Ryan C. Gordon <@icculus>

Date 1385000246 18000

Node ID 5d85b2186aae8895498e48fd5e13ff1fb576cb2d

Parent cff03048babd5eee3eb847cd9b81dd9ebced26ac

Query version for X11 XInput2 multitouch separately from base XInput2.

diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
— a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -59,6 +59,18 @@
z++;
}
}+
+static SDL_bool
+xinput2_version_okay(Display *display, const int major, const int minor)
+{

  • int outmajor = major;
  • int outminor = minor;
  • if (X11_XIQueryVersion(display, &outmajor, &outminor) != Success) {
  •    return SDL_FALSE;
    
  • }
  • return ( ((outmajor * 1000) + outminor) >= ((major * 1000) + minor) );
    +}
    #endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */

void
@@ -70,11 +82,6 @@
XIEventMask eventmask;
unsigned char mask[3] = { 0,0,0 };
int event, err;

  • int major = 2, minor = 0;
  • int outmajor,outminor;
    -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
  • minor = 2;
    -#endif
    /*
  •    return;
    
  •    return; /* X server does not have XInput at all */
    
    }
  • outmajor = major;
  • outminor = minor;
  • if (X11_XIQueryVersion(data->display, &outmajor, &outminor) != Success) {
  •    return;
    
  • if (!xinput2_version_okay(data->display, 2, 0)) {
  •    return; /* X server does not support the version we want */
    
    }
  • /* Check supported version */
  • if(outmajor * 1000 + outminor < major * 1000 + minor) {
  •    /* X server does not support the version we want */
    
  •    return;
    
  • }
    xinput2_initialized = 1;

#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH

  • /* XInput 2.2 */
  • if(outmajor * 1000 + outminor >= major * 1000 + minor) {
  • if (xinput2_version_okay(data->display, 2, 2)) { /* Multitouch needs XInput 2.2 */
    xinput2_multitouch_supported = 1;
    }
    #endif

The patch works. Thanks Ryan.–
Terry Welsh
www.reallyslick.com

Cool, it’s in revision control now.

–ryan.On 11/21/13, 11:49 AM, Terry Welsh wrote:

The patch works. Thanks Ryan.