emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master cce197c630: Fix instances of not using a usable Motif drag atom


From: Po Lu
Subject: master cce197c630: Fix instances of not using a usable Motif drag atom
Date: Fri, 17 Jun 2022 00:58:50 -0400 (EDT)

branch: master
commit cce197c630ed3913ef4b5d39bdcb1d684c861a87
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix instances of not using a usable Motif drag atom
    
    * src/xterm.c (xm_get_drag_atom_1): If another frame owns an
    atom, use it anyway.
---
 src/xterm.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index e26cd58679..9d5e1babf3 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1063,6 +1063,7 @@ static void x_frame_rehighlight (struct x_display_info *);
 static void x_clip_to_row (struct window *, struct glyph_row *,
                           enum glyph_row_area, GC);
 static struct scroll_bar *x_window_to_scroll_bar (Display *, Window, int);
+static struct frame *x_window_to_frame (struct x_display_info *, int);
 static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
                                         enum scroll_bar_part *,
                                         Lisp_Object *, Lisp_Object *,
@@ -2197,6 +2198,7 @@ xm_get_drag_atom_1 (struct x_display_info *dpyinfo,
   int rc, actual_format;
   unsigned long i;
   char *buffer;
+  Window owner;
 
   /* Make sure this operation is done atomically.  */
   XGrabServer (dpyinfo->display);
@@ -2221,11 +2223,18 @@ xm_get_drag_atom_1 (struct x_display_info *dpyinfo,
 
       for (i = 0; i < nitems; ++i)
        {
-         if (XGetSelectionOwner (dpyinfo->display,
-                                 atoms[i]) == None
-             && !x_had_errors_p (dpyinfo->display))
+         owner = XGetSelectionOwner (dpyinfo->display, atoms[i]);
+
+         if (!x_had_errors_p (dpyinfo->display)
+             && (owner == None
+                 /* If we already own this selection (even if another
+                    frame owns it), use it.  There is no way of
+                    knowing when ownership was asserted, so it still
+                    has to be owned again.  */
+                 || x_window_to_frame (dpyinfo, owner)))
            {
              atom = atoms[i];
+
              break;
            }
        }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]