From 4b2b3c45d39721a60f8ed63c2a3e3ec9ff7e5004 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 18 Apr 2022 08:25:45 +0800 Subject: [PATCH] Some minor fixes to Motif DND support * src/xterm.c (xm_write_drag_initiator_info): Swap cardinal values if wrong byteorder. (xm_setup_dnd_targets): Read LONG_MAX amount of drag targets. --- src/xterm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 4241b4d0d6b..e00b38a6817 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1353,6 +1353,12 @@ xm_write_drag_initiator_info (Display *dpy, Window wdesc, buf[0] = info->byteorder; buf[1] = info->protocol; + if (info->byteorder != XM_BYTE_ORDER_CUR_FIRST) + { + SWAPCARD16 (info->table_index); + SWAPCARD16 (info->selection); + } + *((uint16_t *) (buf + 2)) = info->table_index; *((uint32_t *) (buf + 4)) = info->selection; @@ -1473,8 +1479,7 @@ xm_setup_dnd_targets (struct x_display_info *dpyinfo, XGrabServer (dpyinfo->display); rc = XGetWindowProperty (dpyinfo->display, drag_window, dpyinfo->Xatom_MOTIF_DRAG_TARGETS, - /* Do larger values occur in practice? */ - 0L, 20000L, False, + 0L, LONG_MAX, False, dpyinfo->Xatom_MOTIF_DRAG_TARGETS, &actual_type, &actual_format, &nitems, &bytes_remaining, &tmp_data) == Success; -- 2.39.2