]> git.eshelyaron.com Git - emacs.git/commitdiff
Some minor fixes to Motif DND support
authorPo Lu <luangruo@yahoo.com>
Mon, 18 Apr 2022 00:25:45 +0000 (08:25 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 18 Apr 2022 00:26:38 +0000 (08:26 +0800)
* 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

index 4241b4d0d6b57070bbe267bddc1f62db5d77cbce..e00b38a6817a7acb9988767b1ff403b70fa8a6f1 100644 (file)
@@ -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;