(if mouse-drag-and-drop-region-cut-when-buffers-differ
'XdndActionMove
'XdndActionCopy)
- (posn-window (event-end event)) 'now)
+ (posn-window (event-end event)) 'now
+ ;; On platforms where we know
+ ;; `return-frame' doesn't
+ ;; work, allow dropping on
+ ;; the drop frame.
+ (eq window-system 'haiku))
(quit nil))))
(when (framep drag-action-or-frame)
;; With some window managers `x-begin-drag'
take effect on menu items until the menu bar is updated again."
(force-mode-line-update t))
+;; Note that `mouse-position' can't return the actual frame the mouse
+;; pointer is under, so this only works for the frame where the drop
+;; started.
+(defun haiku-dnd-drag-handler ()
+ "Handle mouse movement during drag-and-drop."
+ (let ((track-mouse 'drag-source)
+ (mouse-position (mouse-pixel-position)))
+ (when (car mouse-position)
+ (dnd-handle-movement (posn-at-x-y (cadr mouse-position)
+ (cddr mouse-position)
+ (car mouse-position)))
+ (redisplay))))
+
+(setq haiku-drag-track-function #'haiku-dnd-drag-handler)
+
(defun x-begin-drag (targets &optional action frame _return-frame allow-current-frame)
"SKIP: real doc in xfns.c."
(unless haiku-dnd-selection-value
MouseMoved (BPoint point, uint32 transit, const BMessage *drag_msg)
{
struct haiku_mouse_motion_event rq;
+ int32 windowid;
+ EmacsWindow *window;
+ window = (EmacsWindow *) Window ();
rq.just_exited_p = transit == B_EXITED_VIEW;
rq.x = point.x;
rq.y = point.y;
- rq.window = this->Window ();
+ rq.window = window;
rq.time = system_time ();
- rq.dnd_message = drag_msg != NULL;
+
+ if (drag_msg && (drag_msg->IsSourceRemote ()
+ || drag_msg->FindInt32 ("emacs:window_id",
+ &windowid) != B_OK
+ || windowid != window->window_id))
+ rq.dnd_message = true;
+ else
+ rq.dnd_message = false;
if (ToolTip ())
ToolTip ()->SetMouseRelativeLocation (BPoint (-(point.x - tt_absl_pos.x),
return unbind_to (idx, Qnil);
}
+static Lisp_Object
+haiku_note_drag_motion_1 (void *data)
+{
+ if (!NILP (Vhaiku_drag_track_function))
+ return call0 (Vhaiku_drag_track_function);
+
+ return Qnil;
+}
+
+static Lisp_Object
+haiku_note_drag_motion_2 (enum nonlocal_exit exit, Lisp_Object error)
+{
+ return Qnil;
+}
+
+void
+haiku_note_drag_motion (void)
+{
+ internal_catch_all (haiku_note_drag_motion_1, NULL,
+ haiku_note_drag_motion_2);
+}
+
void
syms_of_haikuselect (void)
{
system message failed. */);
haiku_signal_invalid_refs = true;
+ DEFVAR_LISP ("haiku-drag-track-function", Vhaiku_drag_track_function,
+ doc: /* If non-nil, a function to call upon mouse movement while dragging a message.
+The function is called without any arguments. `mouse-position' can be
+used to retrieve the current position of the mouse. */);
+ Vhaiku_drag_track_function = Qnil;
+
DEFSYM (QSECONDARY, "SECONDARY");
DEFSYM (QCLIPBOARD, "CLIPBOARD");
DEFSYM (QSTRING, "STRING");
XSETINT (inev.y, b->y);
XSETFRAME (inev.frame_or_window, f);
}
+ else
+ haiku_note_drag_motion ();
+
break;
}
}
extern Lisp_Object haiku_menu_show (struct frame *f, int x, int y, int menu_flags,
Lisp_Object title, const char **error_name);
extern Lisp_Object haiku_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents);
+extern void haiku_note_drag_motion (void);
extern void initialize_frame_menubar (struct frame *f);