[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f703232: Use XI2 calls to warp the client pointer
From: |
Po Lu |
Subject: |
master f703232: Use XI2 calls to warp the client pointer |
Date: |
Tue, 21 Dec 2021 22:15:11 -0500 (EST) |
branch: master
commit f703232b7ff3453640179c6c1e9415e9ff1af987
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Use XI2 calls to warp the client pointer
* src/xfns.c (Fx_set_mouse_absolute_pixel_position):
* src/xterm.c (frame_set_mouse_pixel_position): Replace
calls to XWarpPointer with calls to XIWarpPointer with
the client pointer explictly specified. This avoids the
odd situation where the client pointer of the root window
is not the client pointer of the frame.
---
src/xfns.c | 19 +++++++++++++++++--
src/xterm.c | 19 +++++++++++++++++--
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/src/xfns.c b/src/xfns.c
index 30ed358..168debc 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5643,8 +5643,23 @@ The coordinates X and Y are interpreted in pixels
relative to a position
int yval = check_integer_range (y, INT_MIN, INT_MAX);
block_input ();
- XWarpPointer (FRAME_X_DISPLAY (f), None, DefaultRootWindow (FRAME_X_DISPLAY
(f)),
- 0, 0, 0, 0, xval, yval);
+#ifdef HAVE_XINPUT2
+ int deviceid;
+
+ if (FRAME_DISPLAY_INFO (f)->supports_xi2)
+ {
+ if (XIGetClientPointer (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ &deviceid))
+ {
+ XIWarpPointer (FRAME_X_DISPLAY (f), deviceid, None,
+ DefaultRootWindow (FRAME_X_DISPLAY (f)),
+ 0, 0, 0, 0, xval, yval);
+ }
+ }
+ else
+#endif
+ XWarpPointer (FRAME_X_DISPLAY (f), None, DefaultRootWindow
(FRAME_X_DISPLAY (f)),
+ 0, 0, 0, 0, xval, yval);
unblock_input ();
return Qnil;
diff --git a/src/xterm.c b/src/xterm.c
index 33396cc..070ee7d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -13223,9 +13223,24 @@ void
frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
{
block_input ();
+#ifdef HAVE_XINPUT2
+ int deviceid;
- XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
- 0, 0, 0, 0, pix_x, pix_y);
+ if (FRAME_DISPLAY_INFO (f)->supports_xi2)
+ {
+ if (XIGetClientPointer (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ &deviceid))
+ {
+ XIWarpPointer (FRAME_X_DISPLAY (f),
+ deviceid, None,
+ FRAME_X_WINDOW (f),
+ 0, 0, 0, 0, pix_x, pix_y);
+ }
+ }
+ else
+#endif
+ XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
+ 0, 0, 0, 0, pix_x, pix_y);
unblock_input ();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master f703232: Use XI2 calls to warp the client pointer,
Po Lu <=