1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00

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.
This commit is contained in:
Po Lu 2022-06-15 14:46:21 +08:00
parent 5b7f24e58a
commit 36f96c351a
2 changed files with 28 additions and 0 deletions

View file

@ -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;
}

View file

@ -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