aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-03-25 13:41:30 +0000
committerPo Lu2022-03-25 13:41:30 +0000
commit4dfd42014b50aadd82b425747fe65fa97df28caa (patch)
tree083cd4a906024025b336b2c2c53323a7e764de67
parent8ba0f190642d20e8f9caa7472c12674c7ba65a69 (diff)
downloademacs-4dfd42014b50aadd82b425747fe65fa97df28caa.tar.gz
emacs-4dfd42014b50aadd82b425747fe65fa97df28caa.zip
Implement new drag and drop parameter on Haiku
* 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'.
-rw-r--r--lisp/term/haiku-win.el4
-rw-r--r--src/haiku_support.cc7
-rw-r--r--src/haiku_support.h2
-rw-r--r--src/haikuselect.c10
4 files changed, 15 insertions, 8 deletions
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el
index d04da2fdae4..2f106825c33 100644
--- a/lisp/term/haiku-win.el
+++ b/lisp/term/haiku-win.el
@@ -199,7 +199,7 @@ This is necessary because on Haiku `use-system-tooltip' doesn't
199take effect on menu items until the menu bar is updated again." 199take effect on menu items until the menu bar is updated again."
200 (force-mode-line-update t)) 200 (force-mode-line-update t))
201 201
202(defun x-begin-drag (targets &optional action frame _return-frame _allow-current-frame) 202(defun x-begin-drag (targets &optional action frame _return-frame allow-current-frame)
203 "SKIP: real doc in xfns.c." 203 "SKIP: real doc in xfns.c."
204 (unless haiku-dnd-selection-value 204 (unless haiku-dnd-selection-value
205 (error "No local value for XdndSelection")) 205 (error "No local value for XdndSelection"))
@@ -228,7 +228,7 @@ take effect on menu items until the menu bar is updated again."
228 action) 228 action)
229 'XdndActionCopy) 229 'XdndActionCopy)
230 (haiku-drag-message (or frame (selected-frame)) 230 (haiku-drag-message (or frame (selected-frame))
231 message)))) 231 message allow-current-frame))))
232 232
233(add-variable-watcher 'use-system-tooltips #'haiku-use-system-tooltips-watcher) 233(add-variable-watcher 'use-system-tooltips #'haiku-use-system-tooltips-watcher)
234 234
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index b58420fcb99..a1616258bc3 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -4068,7 +4068,7 @@ be_drag_message_thread_entry (void *thread_data)
4068} 4068}
4069 4069
4070bool 4070bool
4071be_drag_message (void *view, void *message, 4071be_drag_message (void *view, void *message, bool allow_same_view,
4072 void (*block_input_function) (void), 4072 void (*block_input_function) (void),
4073 void (*unblock_input_function) (void), 4073 void (*unblock_input_function) (void),
4074 void (*process_pending_signals_function) (void), 4074 void (*process_pending_signals_function) (void),
@@ -4083,7 +4083,10 @@ be_drag_message (void *view, void *message,
4083 ssize_t stat; 4083 ssize_t stat;
4084 4084
4085 block_input_function (); 4085 block_input_function ();
4086 msg->AddInt32 ("emacs:window_id", window->window_id); 4086
4087 if (!allow_same_view)
4088 msg->AddInt32 ("emacs:window_id", window->window_id);
4089
4087 if (!vw->LockLooper ()) 4090 if (!vw->LockLooper ())
4088 gui_abort ("Failed to lock view looper for drag"); 4091 gui_abort ("Failed to lock view looper for drag");
4089 4092
diff --git a/src/haiku_support.h b/src/haiku_support.h
index c978926e735..ae3ad6a68a8 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -944,7 +944,7 @@ extern "C"
944 BMessage_delete (void *message); 944 BMessage_delete (void *message);
945 945
946 extern bool 946 extern bool
947 be_drag_message (void *view, void *message, 947 be_drag_message (void *view, void *message, bool allow_same_view,
948 void (*block_input_function) (void), 948 void (*block_input_function) (void),
949 void (*unblock_input_function) (void), 949 void (*unblock_input_function) (void),
950 void (*process_pending_signals_function) (void), 950 void (*process_pending_signals_function) (void),
diff --git a/src/haikuselect.c b/src/haikuselect.c
index 5540f467c0d..f1aa4f20d96 100644
--- a/src/haikuselect.c
+++ b/src/haikuselect.c
@@ -585,7 +585,7 @@ haiku_should_quit_drag (void)
585} 585}
586 586
587DEFUN ("haiku-drag-message", Fhaiku_drag_message, Shaiku_drag_message, 587DEFUN ("haiku-drag-message", Fhaiku_drag_message, Shaiku_drag_message,
588 2, 2, 0, 588 2, 3, 0,
589 doc: /* Begin dragging MESSAGE from FRAME. 589 doc: /* Begin dragging MESSAGE from FRAME.
590 590
591MESSAGE an alist of strings, denoting message field names, to a list 591MESSAGE 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
606system message. 606system message.
607 607
608FRAME is a window system frame that must be visible, from which the 608FRAME is a window system frame that must be visible, from which the
609drag will originate. */) 609drag will originate.
610 (Lisp_Object frame, Lisp_Object message) 610
611ALLOW-SAME-FRAME, if nil or not specified, means that MESSAGE will be
612ignored if it is dropped on top of FRAME. */)
613 (Lisp_Object frame, Lisp_Object message, Lisp_Object allow_same_frame)
611{ 614{
612 specpdl_ref idx; 615 specpdl_ref idx;
613 void *be_message; 616 void *be_message;
@@ -625,6 +628,7 @@ drag will originate. */)
625 record_unwind_protect_ptr (BMessage_delete, be_message); 628 record_unwind_protect_ptr (BMessage_delete, be_message);
626 haiku_lisp_to_message (message, be_message); 629 haiku_lisp_to_message (message, be_message);
627 rc = be_drag_message (FRAME_HAIKU_VIEW (f), be_message, 630 rc = be_drag_message (FRAME_HAIKU_VIEW (f), be_message,
631 !NILP (allow_same_frame),
628 block_input, unblock_input, 632 block_input, unblock_input,
629 process_pending_signals, 633 process_pending_signals,
630 haiku_should_quit_drag); 634 haiku_should_quit_drag);