]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix generation of extra DND events while dragging on Haiku
authorPo Lu <luangruo@yahoo.com>
Mon, 4 Apr 2022 11:37:12 +0000 (11:37 +0000)
committerPo Lu <luangruo@yahoo.com>
Mon, 4 Apr 2022 11:37:12 +0000 (11:37 +0000)
* src/haiku_support.cc (be_drag_message): Set new DND flag.
(be_drag_and_drop_in_progress): New function.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_read_socket): Don't store DND motion
events if DND is in progress.

src/haiku_support.cc
src/haiku_support.h
src/haikuterm.c

index 64556ba51b6ccacf129ba6cee9ddff2c7ea343a4..40112e2b7178139a7d38f3e8585f9a7c34159b4e 100644 (file)
@@ -122,6 +122,7 @@ static int current_window_id;
 
 static void *grab_view = NULL;
 static BLocker grab_view_locker;
+static bool drag_and_drop_in_progress;
 
 /* This could be a private API, but it's used by (at least) the Qt
    port, so it's probably here to stay.  */
@@ -4111,6 +4112,8 @@ be_drag_message (void *view, void *message, bool allow_same_view,
   resume_thread (infos[1].object);
   unblock_input_function ();
 
+  drag_and_drop_in_progress = true;
+
   while (true)
     {
       block_input_function ();
@@ -4128,12 +4131,24 @@ be_drag_message (void *view, void *message, bool allow_same_view,
        process_pending_signals_function ();
 
       if (should_quit_function ())
-       return true;
+       {
+         drag_and_drop_in_progress = false;
+         return true;
+       }
 
       if (infos[1].events & B_EVENT_INVALID)
-       return false;
+       {
+         drag_and_drop_in_progress = false;
+         return false;
+       }
 
       infos[0].events = B_EVENT_READ;
       infos[1].events = B_EVENT_INVALID;
     }
 }
+
+bool
+be_drag_and_drop_in_progress (void)
+{
+  return drag_and_drop_in_progress;
+}
index ac3029fbf3f45f9169b3f1e0c9ec7c820be0333a..d0a78c693b96c32d621953bbc7c7583e853006f5 100644 (file)
@@ -951,6 +951,9 @@ extern "C"
                   void (*process_pending_signals_function) (void),
                   bool (*should_quit_function) (void));
 
+  extern bool
+  be_drag_and_drop_in_progress (void);
+
 #ifdef __cplusplus
   extern void *
   find_appropriate_view_for_draw (void *vw);
index 91e985e196a450700a5b385de110492a736a6e12..e2d6a9a4670a19ee900e88a98a511af8bdb23196 100644 (file)
@@ -3145,12 +3145,16 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
                       another program is dragging stuff over us.  */
 
                    do_help = -1;
-                   inev.kind = DRAG_N_DROP_EVENT;
-                   inev.arg = Qlambda;
 
-                   XSETINT (inev.x, b->x);
-                   XSETINT (inev.y, b->y);
-                   XSETFRAME (inev.frame_or_window, f);
+                   if (!be_drag_and_drop_in_progress ())
+                     {
+                       inev.kind = DRAG_N_DROP_EVENT;
+                       inev.arg = Qlambda;
+
+                       XSETINT (inev.x, b->x);
+                       XSETINT (inev.y, b->y);
+                       XSETFRAME (inev.frame_or_window, f);
+                     }
                    break;
                  }
              }