裁剪XIput2依赖

Signed-off-by: qibaijin <qibaijin@huawei.com>
Change-Id: Idae06767fc5363f0490cda7c335782f5704730f3
This commit is contained in:
qibaijin
2024-11-14 10:26:05 +08:00
parent 165445989a
commit c153c2d131
5 changed files with 18 additions and 1 deletions
+1
View File
@@ -157,6 +157,7 @@ ohos_shared_library("glfw") {
"Xrandr",
]
defines += [ "_GLFW_X11" ]
defines += [ "USE_DUMMPY_XINPUT2" ]
}
part_name = "glfw"
+1 -1
View File
@@ -18,7 +18,7 @@
"subsystem": "thirdparty",
"syscap": [],
"features": [],
"adapted_system_type": ["standard"],
"adapted_system_type": [ "standard" ],
"rom": "",
"ram": "",
"deps": {
+2
View File
@@ -637,8 +637,10 @@ static GLFWbool initExtensions(void)
{
_glfw.x11.xi.QueryVersion = (PFN_XIQueryVersion)
_glfwPlatformGetModuleSymbol(_glfw.x11.xi.handle, "XIQueryVersion");
#ifndef USE_DUMMPY_XINPUT2
_glfw.x11.xi.SelectEvents = (PFN_XISelectEvents)
_glfwPlatformGetModuleSymbol(_glfw.x11.xi.handle, "XISelectEvents");
#endif
if (XQueryExtension(_glfw.x11.display,
"XInputExtension",
+8
View File
@@ -45,7 +45,9 @@
#include <X11/extensions/Xinerama.h>
// The XInput extension provides raw mouse motion input
#ifndef USE_DUMMPY_XINPUT2
#include <X11/extensions/XInput2.h>
#endif
// The Shape extension provides custom window shapes
#include <X11/extensions/shape.h>
@@ -370,9 +372,13 @@ typedef Bool (* PFN_XF86VidModeGetGammaRampSize)(Display*,int,int*);
#define XF86VidModeGetGammaRampSize _glfw.x11.vidmode.GetGammaRampSize
typedef Status (* PFN_XIQueryVersion)(Display*,int*,int*);
#ifndef USE_DUMMPY_XINPUT2
typedef int (* PFN_XISelectEvents)(Display*,Window,XIEventMask*,int);
#endif
#define XIQueryVersion _glfw.x11.xi.QueryVersion
#ifndef USE_DUMMPY_XINPUT2
#define XISelectEvents _glfw.x11.xi.SelectEvents
#endif
typedef Bool (* PFN_XRenderQueryExtension)(Display*,int*,int*);
typedef Status (* PFN_XRenderQueryVersion)(Display*dpy,int*,int*);
@@ -847,7 +853,9 @@ typedef struct _GLFWlibraryX11
int major;
int minor;
PFN_XIQueryVersion QueryVersion;
#ifndef USE_DUMMPY_XINPUT2
PFN_XISelectEvents SelectEvents;
#endif
} xi;
struct {
+6
View File
@@ -497,6 +497,7 @@ static void releaseCursor(void)
//
static void enableRawMouseMotion(_GLFWwindow* window)
{
#ifndef USE_DUMMPY_XINPUT2
XIEventMask em;
unsigned char mask[XIMaskLen(XI_RawMotion)] = { 0 };
@@ -506,12 +507,14 @@ static void enableRawMouseMotion(_GLFWwindow* window)
XISetMask(mask, XI_RawMotion);
XISelectEvents(_glfw.x11.display, _glfw.x11.root, &em, 1);
#endif
}
// Disable XI2 raw mouse motion events
//
static void disableRawMouseMotion(_GLFWwindow* window)
{
#ifndef USE_DUMMPY_XINPUT2
XIEventMask em;
unsigned char mask[] = { 0 };
@@ -520,6 +523,7 @@ static void disableRawMouseMotion(_GLFWwindow* window)
em.mask = mask;
XISelectEvents(_glfw.x11.display, _glfw.x11.root, &em, 1);
#endif
}
// Apply disabled cursor mode to a focused window
@@ -1182,6 +1186,7 @@ static void processEvent(XEvent *event)
{
if (_glfw.x11.xi.available)
{
#ifndef USE_DUMMPY_XINPUT2
_GLFWwindow* window = _glfw.x11.disabledCursorWindow;
if (window &&
@@ -1211,6 +1216,7 @@ static void processEvent(XEvent *event)
}
XFreeEventData(_glfw.x11.display, &event->xcookie);
#endif
}
return;