From 9f54cb5f8f0df79468546b9431a0fe72ee2f1a52 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 30 Mar 2022 08:13:35 +0000 Subject: [PATCH] Prevent signals when dragging nonexistent files on Haiku * lisp/term/haiku-win.el (x-begin-drag): Bind `haiku-signal-invalid-refs' to nil. * src/haiku_support.cc (MouseMoved): Send motion events while dragging as well. * src/haikuselect.c (haiku_lisp_to_message): Respect new variable. (syms_of_haikuselect): New variable `haiku-signal-invalid-refs'. --- lisp/term/haiku-win.el | 4 +++- src/haiku_support.cc | 3 --- src/haikuselect.c | 9 ++++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el index f9dcd0d1922..738cf56caaa 100644 --- a/lisp/term/haiku-win.el +++ b/lisp/term/haiku-win.el @@ -44,6 +44,7 @@ (defvar x-command-line-resources) (defvar haiku-initialized) +(defvar haiku-signal-invalid-refs) (defvar haiku-dnd-selection-value nil "The local value of the special `XdndSelection' selection.") @@ -277,7 +278,8 @@ take effect on menu items until the menu bar is updated again." "SKIP: real doc in xfns.c." (unless haiku-dnd-selection-value (error "No local value for XdndSelection")) - (let ((message nil)) + (let ((message nil) + (haiku-signal-invalid-refs nil)) (dolist (target targets) (let ((selection-converter (cdr (assoc (intern target) haiku-dnd-selection-converters)))) diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 39df06e4366..dd27d6317c5 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -1530,9 +1530,6 @@ public: rq.window = this->Window (); rq.time = system_time (); - if (drag_msg && transit != B_EXITED_VIEW) - return; - if (ToolTip ()) ToolTip ()->SetMouseRelativeLocation (BPoint (-(point.x - tt_absl_pos.x), -(point.y - tt_absl_pos.y))); diff --git a/src/haikuselect.c b/src/haikuselect.c index 38d4933948f..77dcff42a61 100644 --- a/src/haikuselect.c +++ b/src/haikuselect.c @@ -520,7 +520,8 @@ haiku_lisp_to_message (Lisp_Object obj, void *message) case 'RREF': CHECK_STRING (data); - if (be_add_refs_data (message, SSDATA (name), SSDATA (data))) + if (be_add_refs_data (message, SSDATA (name), SSDATA (data)) + && haiku_signal_invalid_refs) signal_error ("Invalid file name", data); break; @@ -787,6 +788,12 @@ ignored if it is dropped on top of FRAME. */) void syms_of_haikuselect (void) { + DEFVAR_BOOL ("haiku-signal-invalid-refs", haiku_signal_invalid_refs, + doc: /* If nil, silently ignore invalid file names in system messages. +Otherwise, an error will be signalled if adding a file reference to a +system message failed. */); + haiku_signal_invalid_refs = true; + DEFSYM (QSECONDARY, "SECONDARY"); DEFSYM (QCLIPBOARD, "CLIPBOARD"); DEFSYM (QSTRING, "STRING"); -- 2.39.2