]> git.eshelyaron.com Git - emacs.git/commitdiff
Implement new drag and drop parameter on Haiku
authorPo Lu <luangruo@yahoo.com>
Fri, 25 Mar 2022 13:41:30 +0000 (13:41 +0000)
committerPo Lu <luangruo@yahoo.com>
Fri, 25 Mar 2022 13:41:30 +0000 (13:41 +0000)
* lisp/term/haiku-win.el (x-begin-drag): Implement
`allow-current-frame'.
* src/haiku_support.cc (be_drag_message): New argument
`allow_same_view'.
* src/haiku_support.h: Update prototypes.
* src/haikuselect.c (Fhaiku_drag_message): New parameter
`allow-same-frame'.

lisp/term/haiku-win.el
src/haiku_support.cc
src/haiku_support.h
src/haikuselect.c

index d04da2fdae402016a3f24f2917e2037bb35015b5..2f106825c33288546b7328fb23cb6a1097894569 100644 (file)
@@ -199,7 +199,7 @@ This is necessary because on Haiku `use-system-tooltip' doesn't
 take effect on menu items until the menu bar is updated again."
   (force-mode-line-update t))
 
-(defun x-begin-drag (targets &optional action frame _return-frame _allow-current-frame)
+(defun x-begin-drag (targets &optional action frame _return-frame allow-current-frame)
   "SKIP: real doc in xfns.c."
   (unless haiku-dnd-selection-value
     (error "No local value for XdndSelection"))
@@ -228,7 +228,7 @@ take effect on menu items until the menu bar is updated again."
                     action)
                'XdndActionCopy)
       (haiku-drag-message (or frame (selected-frame))
-                          message))))
+                          message allow-current-frame))))
 
 (add-variable-watcher 'use-system-tooltips #'haiku-use-system-tooltips-watcher)
 
index b58420fcb99b09a54fbd5b920588302a80c1947b..a1616258bc361f4a0c3a436cbbb67a000a7bb13a 100644 (file)
@@ -4068,7 +4068,7 @@ be_drag_message_thread_entry (void *thread_data)
 }
 
 bool
-be_drag_message (void *view, void *message,
+be_drag_message (void *view, void *message, bool allow_same_view,
                 void (*block_input_function) (void),
                 void (*unblock_input_function) (void),
                 void (*process_pending_signals_function) (void),
@@ -4083,7 +4083,10 @@ be_drag_message (void *view, void *message,
   ssize_t stat;
 
   block_input_function ();
-  msg->AddInt32 ("emacs:window_id", window->window_id);
+
+  if (!allow_same_view)
+    msg->AddInt32 ("emacs:window_id", window->window_id);
+
   if (!vw->LockLooper ())
     gui_abort ("Failed to lock view looper for drag");
 
index c978926e735aaf768bc2d8c26c2565fd2ac8eb93..ae3ad6a68a8ec6fe3083f17c024d84164038df7b 100644 (file)
@@ -944,7 +944,7 @@ extern "C"
   BMessage_delete (void *message);
 
   extern bool
-  be_drag_message (void *view, void *message,
+  be_drag_message (void *view, void *message, bool allow_same_view,
                   void (*block_input_function) (void),
                   void (*unblock_input_function) (void),
                   void (*process_pending_signals_function) (void),
index 5540f467c0db1e32191dd13f5dcbc50fd45b8306..f1aa4f20d964964a2796868f87bd6ef10bbac470 100644 (file)
@@ -585,7 +585,7 @@ haiku_should_quit_drag (void)
 }
 
 DEFUN ("haiku-drag-message", Fhaiku_drag_message, Shaiku_drag_message,
-       2, 2, 0,
+       2, 3, 0,
        doc: /* Begin dragging MESSAGE from FRAME.
 
 MESSAGE an alist of strings, denoting message field names, to a list
@@ -606,8 +606,11 @@ associates to a 32-bit unsigned integer describing the type of the
 system message.
 
 FRAME is a window system frame that must be visible, from which the
-drag will originate.  */)
-  (Lisp_Object frame, Lisp_Object message)
+drag will originate.
+
+ALLOW-SAME-FRAME, if nil or not specified, means that MESSAGE will be
+ignored if it is dropped on top of FRAME.  */)
+  (Lisp_Object frame, Lisp_Object message, Lisp_Object allow_same_frame)
 {
   specpdl_ref idx;
   void *be_message;
@@ -625,6 +628,7 @@ drag will originate.  */)
   record_unwind_protect_ptr (BMessage_delete, be_message);
   haiku_lisp_to_message (message, be_message);
   rc = be_drag_message (FRAME_HAIKU_VIEW (f), be_message,
+                       !NILP (allow_same_frame),
                        block_input, unblock_input,
                        process_pending_signals,
                        haiku_should_quit_drag);