[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 211ca9f916: Fix drag-and-drop button button flags
From: |
Po Lu |
Subject: |
master 211ca9f916: Fix drag-and-drop button button flags |
Date: |
Sat, 16 Jul 2022 21:13:42 -0400 (EDT) |
branch: master
commit 211ca9f916a3fa8c0ad1dce1519462584bee4467
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix drag-and-drop button button flags
* src/xterm.c (x_dnd_send_position): Always send buttons
regardless of version. Fix bit indices.
(handle_one_xevent): Likewise.
---
src/xterm.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 94cfe6f010..3894da7ab6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4469,21 +4469,22 @@ x_dnd_send_position (struct frame *f, Window target,
int supported,
msg.xclient.data.l[0] = FRAME_X_WINDOW (f);
msg.xclient.data.l[1] = 0;
- if (supported >= 5)
+ /* This is problematic because it's not specified in the
+ freedesktop.org copy of the protocol specification, but the copy
+ maintained by the original author of the protocol specifies it
+ for all versions. Since at least one program supports these
+ flags, but uses protocol v4 (and not v5), set them for all
+ protocool versions. */
+ if (button >= 4 && button <= 7)
{
- if (button >= 4 && button <= 7)
- {
- msg.xclient.data.l[1] |= (1 << 9);
- msg.xclient.data.l[1] |= (button - 4) << 7;
- }
- else if (button)
- return;
-
- msg.xclient.data.l[1] |= state & 0x3f;
+ msg.xclient.data.l[1] |= (1 << 10);
+ msg.xclient.data.l[1] |= (button - 4) << 8;
}
else if (button)
return;
+ msg.xclient.data.l[1] |= state & 0xff;
+
msg.xclient.data.l[2] = (root_x << 16) | root_y;
msg.xclient.data.l[3] = 0;
msg.xclient.data.l[4] = 0;
@@ -4508,7 +4509,7 @@ x_dnd_send_position (struct frame *f, Window target, int
supported,
&& x_dnd_mouse_rect.height
/* Ignore the mouse rectangle if we're supposed to be sending a
button press instead. */
- && (supported < 5 || !button))
+ && button)
{
if (root_x >= x_dnd_mouse_rect.x
&& root_x < (x_dnd_mouse_rect.x
@@ -16449,7 +16450,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
/* Ignore the mouse rectangle if we're
supposed to be sending a button press
instead. */
- && (x_dnd_last_protocol_version < 5 || !button)
+ && !button
&& (root_x >= x_dnd_mouse_rect.x
&& root_x < (x_dnd_mouse_rect.x
+ x_dnd_mouse_rect.width)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 211ca9f916: Fix drag-and-drop button button flags,
Po Lu <=