mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 15:25:50 +00:00
Remove XInput2 XI_Motion support
Sadly, this interferes with the Steam overlay. Fixes #304.
This commit is contained in:
@@ -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*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user