emacs-diffs
[Top][All Lists]
Advanced

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

master 3cbdd59146: Fix several more issues with running Lisp during drag


From: Po Lu
Subject: master 3cbdd59146: Fix several more issues with running Lisp during drag-and-drop
Date: Mon, 6 Jun 2022 04:02:08 -0400 (EDT)

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

    Fix several more issues with running Lisp during drag-and-drop
    
    * src/xterm.c (handle_one_xevent): Fix _NET_WM_PING cycle again
    and set mouse_moved flags during drag-and-drop so reading mouse
    events from Lisp continues to work.
---
 src/xterm.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 49 insertions(+), 4 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 450340c31e..27ee01dbce 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -15676,8 +15676,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                   mask specified by the EWMH.  To avoid an infinite
                   loop, make sure the client message's window is not
                   the root window if DND is in progress.  */
-               && (!x_dnd_in_progress
-                   || !x_dnd_waiting_for_finish
+               && (!(x_dnd_in_progress
+                     || x_dnd_waiting_for_finish)
                    || event->xclient.window != dpyinfo->root_window)
                && event->xclient.format == 32)
              {
@@ -17160,6 +17160,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
            xm_top_level_leave_message lmsg;
            xm_top_level_enter_message emsg;
            xm_drag_motion_message dmsg;
+           XRectangle *r;
 
            /* Always clear mouse face.  */
            clear_mouse_face (hlinfo);
@@ -17171,7 +17172,28 @@ handle_one_xevent (struct x_display_info *dpyinfo,
               visible manually.  */
 
            if (f)
-             XTtoggle_invisible_pointer (f, false);
+             {
+               XTtoggle_invisible_pointer (f, false);
+
+               r = &dpyinfo->last_mouse_glyph;
+
+               /* Also remember the mouse glyph and set
+                  mouse_moved.  */
+               if (f != dpyinfo->last_mouse_glyph_frame
+                   || event->xmotion.x < r->x
+                   || event->xmotion.x >= r->x + r->width
+                   || event->xmotion.y < r->y
+                   || event->xmotion.y >= r->y + r->height)
+                 {
+                   f->mouse_moved = true;
+                   f->last_mouse_device = Qnil;
+                   dpyinfo->last_mouse_scroll_bar = NULL;
+
+                   remember_mouse_glyph (f, event->xmotion.x,
+                                         event->xmotion.y, r);
+                   dpyinfo->last_mouse_glyph_frame = f;
+                 }
+             }
 
            target = x_dnd_get_target_window (dpyinfo,
                                              event->xmotion.x_root,
@@ -18814,6 +18836,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                {
                  Window target, toplevel;
                  int target_proto, motif_style;
+                 XRectangle *r;
 
                  /* Always clear mouse face.  */
                  clear_mouse_face (hlinfo);
@@ -18825,7 +18848,29 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                     visible manually.  */
 
                  if (f)
-                   XTtoggle_invisible_pointer (f, false);
+                   {
+                     XTtoggle_invisible_pointer (f, false);
+
+                     r = &dpyinfo->last_mouse_glyph;
+
+                     /* Also remember the mouse glyph and set
+                        mouse_moved.  */
+                     if (f != dpyinfo->last_mouse_glyph_frame
+                         || xev->event_x < r->x
+                         || xev->event_x >= r->x + r->width
+                         || xev->event_y < r->y
+                         || xev->event_y >= r->y + r->height)
+                       {
+                         f->mouse_moved = true;
+                         f->last_mouse_device = (source ? source->name
+                                                 : Qnil);
+                         dpyinfo->last_mouse_scroll_bar = NULL;
+
+                         remember_mouse_glyph (f, xev->event_x,
+                                               xev->event_y, r);
+                         dpyinfo->last_mouse_glyph_frame = f;
+                       }
+                   }
 
                  target = x_dnd_get_target_window (dpyinfo,
                                                    xev->root_x,



reply via email to

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