mirror of
				https://github.com/glfw/glfw.git
				synced 2025-11-03 22:04:15 +00:00 
			
		
		
		
	Remove XInput2 XI_Motion support
Sadly, this interferes with the Steam overlay. Fixes #304.
This commit is contained in:
		
							parent
							
								
									a10caa4631
								
							
						
					
					
						commit
						bda18bc899
					
				@ -234,21 +234,6 @@ if (_GLFW_X11)
 | 
			
		||||
    list(APPEND glfw_LIBRARIES "${X11_Xinerama_LIB}")
 | 
			
		||||
    list(APPEND glfw_PKG_DEPS "xinerama")
 | 
			
		||||
 | 
			
		||||
    # Check for XInput (high-resolution cursor motion)
 | 
			
		||||
    if (X11_Xinput_FOUND)
 | 
			
		||||
        list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}")
 | 
			
		||||
        list(APPEND glfw_PKG_DEPS "xi")
 | 
			
		||||
 | 
			
		||||
        if (X11_Xinput_LIB)
 | 
			
		||||
            list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}")
 | 
			
		||||
        else()
 | 
			
		||||
            # Backwards compatibility (bug in CMake 2.8.7)
 | 
			
		||||
            list(APPEND glfw_LIBRARIES Xi)
 | 
			
		||||
        endif()
 | 
			
		||||
 | 
			
		||||
        set(_GLFW_HAS_XINPUT TRUE)
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    # Check for Xf86VidMode (fallback gamma control)
 | 
			
		||||
    if (X11_xf86vmode_FOUND)
 | 
			
		||||
        list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}")
 | 
			
		||||
 | 
			
		||||
@ -104,6 +104,7 @@ does not find Doxygen, the documentation will not be generated.
 | 
			
		||||
 - [X11] Bugfix: Monitor connection and disconnection events were not reported
 | 
			
		||||
 - [X11] Bugfix: Decoding of UTF-8 text from XIM could continue past the end
 | 
			
		||||
 - [X11] Bugfix: An XKB structure was leaked during `glfwInit`
 | 
			
		||||
 - [X11] Bugfix: XInput2 `XI_Motion` events interfered with the Steam overlay
 | 
			
		||||
 - [POSIX] Bugfix: An unrelated TLS key could be deleted by `glfwTerminate`
 | 
			
		||||
 - [WGL] Changed extension loading to only be performed once
 | 
			
		||||
 - [WGL] Removed dependency on external WGL headers
 | 
			
		||||
 | 
			
		||||
@ -63,10 +63,6 @@ GLFW uses the
 | 
			
		||||
to provide file drop events.  If the application originating the drag does not
 | 
			
		||||
support this protocol, drag and drop will not work.
 | 
			
		||||
 | 
			
		||||
GLFW uses the XInput 2 extension to provide sub-pixel cursor motion events.  If
 | 
			
		||||
the running X server does not support this version of this extension, cursor
 | 
			
		||||
motion will be snapped to the pixel grid.
 | 
			
		||||
 | 
			
		||||
GLFW uses the XRandR 1.3 extension to provide multi-monitor support.  If the
 | 
			
		||||
running X server does not support this version of this extension, multi-monitor
 | 
			
		||||
support will not function and only a single, desktop-spanning monitor will be
 | 
			
		||||
 | 
			
		||||
@ -274,8 +274,6 @@ must also define `_GLFW_BUILD_DLL`.  Otherwise, you must not define it.
 | 
			
		||||
If you are using the X11 window creation API, support for the following X11
 | 
			
		||||
extensions can be enabled:
 | 
			
		||||
 | 
			
		||||
 - `_GLFW_HAS_XINPUT` to use XInput2 for high-resolution cursor motion
 | 
			
		||||
 (recommended)
 | 
			
		||||
 - `_GLFW_HAS_XF86VM` to use Xxf86vm as a fallback when RandR gamma is broken
 | 
			
		||||
 (recommended)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -60,8 +60,6 @@
 | 
			
		||||
// Define this to 1 to force use of high-performance GPU on hybrid systems
 | 
			
		||||
#cmakedefine _GLFW_USE_HYBRID_HPG
 | 
			
		||||
 | 
			
		||||
// Define this to 1 if the XInput X11 extension is available
 | 
			
		||||
#cmakedefine _GLFW_HAS_XINPUT
 | 
			
		||||
// Define this to 1 if the Xxf86vm X11 extension is available
 | 
			
		||||
#cmakedefine _GLFW_HAS_XF86VM
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -544,25 +544,6 @@ static GLFWbool initExtensions(void)
 | 
			
		||||
            _glfw.x11.xinerama.available = GLFW_TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if defined(_GLFW_HAS_XINPUT)
 | 
			
		||||
    if (XQueryExtension(_glfw.x11.display,
 | 
			
		||||
                        "XInputExtension",
 | 
			
		||||
                        &_glfw.x11.xi.majorOpcode,
 | 
			
		||||
                        &_glfw.x11.xi.eventBase,
 | 
			
		||||
                        &_glfw.x11.xi.errorBase))
 | 
			
		||||
    {
 | 
			
		||||
        _glfw.x11.xi.major = 2;
 | 
			
		||||
        _glfw.x11.xi.minor = 0;
 | 
			
		||||
 | 
			
		||||
        if (XIQueryVersion(_glfw.x11.display,
 | 
			
		||||
                           &_glfw.x11.xi.major,
 | 
			
		||||
                           &_glfw.x11.xi.minor) != BadRequest)
 | 
			
		||||
        {
 | 
			
		||||
            _glfw.x11.xi.available = GLFW_TRUE;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif /*_GLFW_HAS_XINPUT*/
 | 
			
		||||
 | 
			
		||||
    // Check if Xkb is supported on this display
 | 
			
		||||
    _glfw.x11.xkb.major = 1;
 | 
			
		||||
    _glfw.x11.xkb.minor = 0;
 | 
			
		||||
@ -856,9 +837,6 @@ const char* _glfwPlatformGetVersionString(void)
 | 
			
		||||
#if defined(__linux__)
 | 
			
		||||
        " /dev/js"
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(_GLFW_HAS_XINPUT)
 | 
			
		||||
        " XI"
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(_GLFW_HAS_XF86VM)
 | 
			
		||||
        " Xf86vm"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -47,11 +47,6 @@
 | 
			
		||||
// The Xinerama extension provides legacy monitor indices
 | 
			
		||||
#include <X11/extensions/Xinerama.h>
 | 
			
		||||
 | 
			
		||||
#if defined(_GLFW_HAS_XINPUT)
 | 
			
		||||
 // The XInput2 extension provides improved input events
 | 
			
		||||
 #include <X11/extensions/XInput2.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(_GLFW_HAS_XF86VM)
 | 
			
		||||
 // The Xf86VidMode extension provides fallback gamma control
 | 
			
		||||
 #include <X11/extensions/xf86vmode.h>
 | 
			
		||||
@ -250,17 +245,6 @@ typedef struct _GLFWlibraryX11
 | 
			
		||||
        XGETXCBCONNECTION_T XGetXCBConnection;
 | 
			
		||||
    } x11xcb;
 | 
			
		||||
 | 
			
		||||
#if defined(_GLFW_HAS_XINPUT)
 | 
			
		||||
    struct {
 | 
			
		||||
        GLFWbool    available;
 | 
			
		||||
        int         majorOpcode;
 | 
			
		||||
        int         eventBase;
 | 
			
		||||
        int         errorBase;
 | 
			
		||||
        int         major;
 | 
			
		||||
        int         minor;
 | 
			
		||||
    } xi;
 | 
			
		||||
#endif /*_GLFW_HAS_XINPUT*/
 | 
			
		||||
 | 
			
		||||
#if defined(_GLFW_HAS_XF86VM)
 | 
			
		||||
    struct {
 | 
			
		||||
        GLFWbool    available;
 | 
			
		||||
 | 
			
		||||
@ -469,23 +469,6 @@ static GLFWbool createWindow(_GLFWwindow* window,
 | 
			
		||||
        XFree(hint);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if defined(_GLFW_HAS_XINPUT)
 | 
			
		||||
    if (_glfw.x11.xi.available)
 | 
			
		||||
    {
 | 
			
		||||
        // Select for XInput2 events
 | 
			
		||||
 | 
			
		||||
        XIEventMask eventmask;
 | 
			
		||||
        unsigned char mask[] = { 0 };
 | 
			
		||||
 | 
			
		||||
        eventmask.deviceid = 2;
 | 
			
		||||
        eventmask.mask_len = sizeof(mask);
 | 
			
		||||
        eventmask.mask = mask;
 | 
			
		||||
        XISetMask(mask, XI_Motion);
 | 
			
		||||
 | 
			
		||||
        XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
 | 
			
		||||
    }
 | 
			
		||||
#endif /*_GLFW_HAS_XINPUT*/
 | 
			
		||||
 | 
			
		||||
    if (_glfw.x11.XdndAware)
 | 
			
		||||
    {
 | 
			
		||||
        // Announce support for Xdnd (drag and drop)
 | 
			
		||||
@ -1388,54 +1371,6 @@ static void processEvent(XEvent *event)
 | 
			
		||||
 | 
			
		||||
        case DestroyNotify:
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
#if defined(_GLFW_HAS_XINPUT)
 | 
			
		||||
        case GenericEvent:
 | 
			
		||||
        {
 | 
			
		||||
            if (event->xcookie.extension == _glfw.x11.xi.majorOpcode &&
 | 
			
		||||
                XGetEventData(_glfw.x11.display, &event->xcookie))
 | 
			
		||||
            {
 | 
			
		||||
                if (event->xcookie.evtype == XI_Motion)
 | 
			
		||||
                {
 | 
			
		||||
                    XIDeviceEvent* data = (XIDeviceEvent*) event->xcookie.data;
 | 
			
		||||
 | 
			
		||||
                    window = findWindowByHandle(data->event);
 | 
			
		||||
                    if (window)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (data->event_x != window->x11.warpPosX ||
 | 
			
		||||
                            data->event_y != window->x11.warpPosY)
 | 
			
		||||
                        {
 | 
			
		||||
                            // The cursor was moved by something other than GLFW
 | 
			
		||||
 | 
			
		||||
                            double x, y;
 | 
			
		||||
 | 
			
		||||
                            if (window->cursorMode == GLFW_CURSOR_DISABLED)
 | 
			
		||||
                            {
 | 
			
		||||
                                if (_glfw.cursorWindow != window)
 | 
			
		||||
                                    return;
 | 
			
		||||
 | 
			
		||||
                                x = data->event_x - window->x11.cursorPosX;
 | 
			
		||||
                                y = data->event_y - window->x11.cursorPosY;
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                x = data->event_x;
 | 
			
		||||
                                y = data->event_y;
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            _glfwInputCursorMotion(window, x, y);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        window->x11.cursorPosX = data->event_x;
 | 
			
		||||
                        window->x11.cursorPosY = data->event_y;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            XFreeEventData(_glfw.x11.display, &event->xcookie);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
#endif /*_GLFW_HAS_XINPUT*/
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user