[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 36f96c351a: Handle coordinates for the old KDE drop protocol
From: |
Po Lu |
Subject: |
master 36f96c351a: Handle coordinates for the old KDE drop protocol |
Date: |
Wed, 15 Jun 2022 02:47:22 -0400 (EDT) |
branch: master
commit 36f96c351a97bb2d068e8541167d94803dde6ab8
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Handle coordinates for the old KDE drop protocol
* src/xterm.c (x_atom_refs): Add DndProtocol and _DND_PROTOCOL.
(x_coords_from_dnd_message): Handle the old KDE protocol.
* src/xterm.h (struct x_display_info): New atoms.
---
src/xterm.c | 21 +++++++++++++++++++++
src/xterm.h | 7 +++++++
2 files changed, 28 insertions(+)
diff --git a/src/xterm.c b/src/xterm.c
index bf8a33f70c..b1e7ee578a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1008,6 +1008,9 @@ static const struct x_atom_ref x_atom_refs[] =
Xatom_MOTIF_DRAG_RECEIVER_INFO)
ATOM_REFS_INIT ("XmTRANSFER_SUCCESS", Xatom_XmTRANSFER_SUCCESS)
ATOM_REFS_INIT ("XmTRANSFER_FAILURE", Xatom_XmTRANSFER_FAILURE)
+ /* Old OffiX (a.k.a. old KDE) drop protocol support. */
+ ATOM_REFS_INIT ("DndProtocol", Xatom_DndProtocol)
+ ATOM_REFS_INIT ("_DND_PROTOCOL", Xatom_DND_PROTOCOL)
};
enum
@@ -15893,6 +15896,7 @@ x_coords_from_dnd_message (struct x_display_info
*dpyinfo,
xm_drag_motion_reply dreply;
xm_drop_start_message smsg;
xm_drop_start_reply reply;
+ unsigned long kde_data;
if (event->type != ClientMessage)
return false;
@@ -15943,6 +15947,23 @@ x_coords_from_dnd_message (struct x_display_info
*dpyinfo,
}
}
+ if (((event->xclient.message_type
+ == dpyinfo->Xatom_DndProtocol)
+ || (event->xclient.message_type
+ == dpyinfo->Xatom_DND_PROTOCOL))
+ && event->xclient.format == 32
+ /* Check that the version of the old KDE protocol is new
+ enough to include coordinates. */
+ && event->xclient.data.l[4])
+ {
+ kde_data = (unsigned long) event->xclient.data.l[3];
+
+ *x_out = (kde_data & 0xffff);
+ *y_out = (kde_data >> 16 & 0xffff);
+
+ return true;
+ }
+
return false;
}
diff --git a/src/xterm.h b/src/xterm.h
index 82b4308041..d710069fad 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -443,12 +443,19 @@ struct x_display_info
/* Atom used to determine whether or not the screen is composited. */
Atom Xatom_NET_WM_CM_Sn;
+ /* Atoms used by the Motif drag and drop protocols. */
Atom Xatom_MOTIF_WM_HINTS, Xatom_MOTIF_DRAG_WINDOW,
Xatom_MOTIF_DRAG_TARGETS, Xatom_MOTIF_DRAG_AND_DROP_MESSAGE,
Xatom_MOTIF_DRAG_INITIATOR_INFO, Xatom_MOTIF_DRAG_RECEIVER_INFO;
+ /* Special selections used by the Motif drop protocol to indicate
+ success or failure. */
Atom Xatom_XmTRANSFER_SUCCESS, Xatom_XmTRANSFER_FAILURE;
+ /* Atoms used by both versions of the OffiX DND protocol (the "old
+ KDE" protocol in x-dnd.el). */
+ Atom Xatom_DndProtocol, Xatom_DND_PROTOCOL;
+
/* The frame (if any) which has the X window that has keyboard focus.
Zero if none. This is examined by Ffocus_frame in xfns.c. Note
that a mere EnterNotify event can set this; if you need to know the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 36f96c351a: Handle coordinates for the old KDE drop protocol,
Po Lu <=