mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Made XInput2 optional at compile-time.
This is required for RHEL 5, CentOS 5 and Cygwin-X. Fixes #314.
This commit is contained in:
parent
93855ae6ab
commit
f4c127f75a
@ -273,19 +273,19 @@ if (_GLFW_X11)
|
|||||||
list(APPEND glfw_PKG_DEPS "xinerama")
|
list(APPEND glfw_PKG_DEPS "xinerama")
|
||||||
|
|
||||||
# Check for XInput (high-resolution cursor motion)
|
# Check for XInput (high-resolution cursor motion)
|
||||||
if (NOT X11_Xinput_FOUND)
|
if (X11_Xinput_FOUND)
|
||||||
message(FATAL_ERROR "The XInput library and headers were not found")
|
list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}")
|
||||||
endif()
|
list(APPEND glfw_PKG_DEPS "xi")
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}")
|
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()
|
||||||
|
|
||||||
if (X11_Xinput_LIB)
|
set(_GLFW_HAS_XINPUT TRUE)
|
||||||
list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}")
|
|
||||||
else()
|
|
||||||
# Backwards compatibility (bug in CMake 2.8.7)
|
|
||||||
list(APPEND glfw_LIBRARIES Xi)
|
|
||||||
endif()
|
endif()
|
||||||
list(APPEND glfw_PKG_DEPS "xi")
|
|
||||||
|
|
||||||
# Check for Xf86VidMode (fallback gamma control)
|
# Check for Xf86VidMode (fallback gamma control)
|
||||||
if (NOT X11_xf86vmode_FOUND)
|
if (NOT X11_xf86vmode_FOUND)
|
||||||
|
@ -64,6 +64,7 @@ GLFW bundles a number of dependencies in the `deps/` directory.
|
|||||||
|
|
||||||
- [Cocoa] Bugfix: `glfwSetWindowSize` did not change the video mode for full
|
- [Cocoa] Bugfix: `glfwSetWindowSize` did not change the video mode for full
|
||||||
screen windows
|
screen windows
|
||||||
|
- [X11] Made XInput2 optional at compile-time
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
@ -302,6 +302,11 @@ point retrieval mechanism.
|
|||||||
- `_GLFW_HAS_GLXGETPROCADDRESSEXT` to use `glXGetProcAddressEXT` (legacy)
|
- `_GLFW_HAS_GLXGETPROCADDRESSEXT` to use `glXGetProcAddressEXT` (legacy)
|
||||||
- `_GLFW_HAS_DLOPEN` to do manual retrieval with `dlopen` (fallback)
|
- `_GLFW_HAS_DLOPEN` to do manual retrieval with `dlopen` (fallback)
|
||||||
|
|
||||||
|
In addition, support for the following X11 extensions can be enabled:
|
||||||
|
|
||||||
|
- `_GLFW_HAS_XINPUT` to use XInput2 for high-resolution cursor motion
|
||||||
|
(recommended)
|
||||||
|
|
||||||
If you are using the Cocoa window creation API, the following options are
|
If you are using the Cocoa window creation API, the following options are
|
||||||
available:
|
available:
|
||||||
|
|
||||||
|
@ -62,6 +62,8 @@
|
|||||||
// Define this to 1 to force use of high-performance GPU on Optimus systems
|
// Define this to 1 to force use of high-performance GPU on Optimus systems
|
||||||
#cmakedefine _GLFW_USE_OPTIMUS_HPG
|
#cmakedefine _GLFW_USE_OPTIMUS_HPG
|
||||||
|
|
||||||
|
// Define this to 1 if the XInput X11 extension is available
|
||||||
|
#cmakedefine _GLFW_HAS_XINPUT
|
||||||
// Define this to 1 if glXGetProcAddress is available
|
// Define this to 1 if glXGetProcAddress is available
|
||||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
|
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
|
||||||
// Define this to 1 if glXGetProcAddressARB is available
|
// Define this to 1 if glXGetProcAddressARB is available
|
||||||
|
@ -535,6 +535,7 @@ static GLboolean initExtensions(void)
|
|||||||
_glfw.x11.xinerama.available = GL_TRUE;
|
_glfw.x11.xinerama.available = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_GLFW_HAS_XINPUT)
|
||||||
if (XQueryExtension(_glfw.x11.display,
|
if (XQueryExtension(_glfw.x11.display,
|
||||||
"XInputExtension",
|
"XInputExtension",
|
||||||
&_glfw.x11.xi.majorOpcode,
|
&_glfw.x11.xi.majorOpcode,
|
||||||
@ -551,6 +552,7 @@ static GLboolean initExtensions(void)
|
|||||||
_glfw.x11.xi.available = GL_TRUE;
|
_glfw.x11.xi.available = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /*_GLFW_HAS_XINPUT*/
|
||||||
|
|
||||||
// Check if Xkb is supported on this display
|
// Check if Xkb is supported on this display
|
||||||
_glfw.x11.xkb.versionMajor = 1;
|
_glfw.x11.xkb.versionMajor = 1;
|
||||||
|
@ -43,15 +43,17 @@
|
|||||||
// The XRandR extension provides mode setting and gamma control
|
// The XRandR extension provides mode setting and gamma control
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
|
||||||
// The XInput2 extension provides improved input events
|
|
||||||
#include <X11/extensions/XInput2.h>
|
|
||||||
|
|
||||||
// The Xkb extension provides improved keyboard support
|
// The Xkb extension provides improved keyboard support
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
|
|
||||||
// The Xinerama extension provides legacy monitor indices
|
// The Xinerama extension provides legacy monitor indices
|
||||||
#include <X11/extensions/Xinerama.h>
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
|
||||||
|
#if defined(_GLFW_HAS_XINPUT)
|
||||||
|
// The XInput2 extension provides improved input events
|
||||||
|
#include <X11/extensions/XInput2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "posix_tls.h"
|
#include "posix_tls.h"
|
||||||
|
|
||||||
#if defined(_GLFW_GLX)
|
#if defined(_GLFW_GLX)
|
||||||
@ -188,15 +190,6 @@ typedef struct _GLFWlibraryX11
|
|||||||
int versionMinor;
|
int versionMinor;
|
||||||
} xkb;
|
} xkb;
|
||||||
|
|
||||||
struct {
|
|
||||||
GLboolean available;
|
|
||||||
int majorOpcode;
|
|
||||||
int eventBase;
|
|
||||||
int errorBase;
|
|
||||||
int versionMajor;
|
|
||||||
int versionMinor;
|
|
||||||
} xi;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int count;
|
int count;
|
||||||
int timeout;
|
int timeout;
|
||||||
@ -215,6 +208,17 @@ typedef struct _GLFWlibraryX11
|
|||||||
int versionMinor;
|
int versionMinor;
|
||||||
} xinerama;
|
} xinerama;
|
||||||
|
|
||||||
|
#if defined(_GLFW_HAS_XINPUT)
|
||||||
|
struct {
|
||||||
|
GLboolean available;
|
||||||
|
int majorOpcode;
|
||||||
|
int eventBase;
|
||||||
|
int errorBase;
|
||||||
|
int versionMajor;
|
||||||
|
int versionMinor;
|
||||||
|
} xi;
|
||||||
|
#endif /*_GLFW_HAS_XINPUT*/
|
||||||
|
|
||||||
} _GLFWlibraryX11;
|
} _GLFWlibraryX11;
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,6 +412,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
XFree(hint);
|
XFree(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_GLFW_HAS_XINPUT)
|
||||||
if (_glfw.x11.xi.available)
|
if (_glfw.x11.xi.available)
|
||||||
{
|
{
|
||||||
// Select for XInput2 events
|
// Select for XInput2 events
|
||||||
@ -426,6 +427,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
|
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
|
||||||
}
|
}
|
||||||
|
#endif /*_GLFW_HAS_XINPUT*/
|
||||||
|
|
||||||
if (_glfw.x11.XdndAware)
|
if (_glfw.x11.XdndAware)
|
||||||
{
|
{
|
||||||
@ -1310,6 +1312,7 @@ static void processEvent(XEvent *event)
|
|||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if defined(_GLFW_HAS_XINPUT)
|
||||||
case GenericEvent:
|
case GenericEvent:
|
||||||
{
|
{
|
||||||
if (event->xcookie.extension == _glfw.x11.xi.majorOpcode &&
|
if (event->xcookie.extension == _glfw.x11.xi.majorOpcode &&
|
||||||
@ -1355,6 +1358,7 @@ static void processEvent(XEvent *event)
|
|||||||
XFreeEventData(_glfw.x11.display, &event->xcookie);
|
XFreeEventData(_glfw.x11.display, &event->xcookie);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif /*_GLFW_HAS_XINPUT*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user