struct haiku_drag_and_drop_event rq;
if (msg->FindInt32 ("emacs:window_id", &windowid) == B_OK
+ && !msg->IsSourceRemote ()
&& windowid == this->window_id)
return;
}
void
- MouseMoved (BPoint point, uint32 transit, const BMessage *msg)
+ MouseMoved (BPoint point, uint32 transit, const BMessage *drag_msg)
{
struct haiku_mouse_motion_event rq;
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)));
return 0;
}
-void
+bool
be_drag_message (void *view, void *message,
void (*block_input_function) (void),
void (*unblock_input_function) (void),
- void (*process_pending_signals_function) (void))
+ void (*process_pending_signals_function) (void),
+ bool (*should_quit_function) (void))
{
EmacsView *vw = (EmacsView *) view;
EmacsWindow *window = (EmacsWindow *) vw->Window ();
unblock_input_function ();
if (infos[1].object < B_OK)
- return;
+ return false;
block_input_function ();
resume_thread (infos[1].object);
if (infos[0].events & B_EVENT_READ)
process_pending_signals_function ();
+ if (should_quit_function ())
+ return true;
+
if (infos[1].events & B_EVENT_INVALID)
- return;
+ return false;
infos[0].events = B_EVENT_READ;
infos[1].events = B_EVENT_INVALID;
extern void
BMessage_delete (void *message);
- extern void
+ extern bool
be_drag_message (void *view, void *message,
void (*block_input_function) (void),
void (*unblock_input_function) (void),
- void (*process_pending_signals_function) (void));
+ void (*process_pending_signals_function) (void),
+ bool (*should_quit_function) (void));
#ifdef __cplusplus
extern void *
CHECK_LIST_END (tem, obj);
}
+static bool
+haiku_should_quit_drag (void)
+{
+ return !NILP (Vquit_flag);
+}
+
DEFUN ("haiku-drag-message", Fhaiku_drag_message, Shaiku_drag_message,
2, 2, 0,
doc: /* Begin dragging MESSAGE from FRAME.
specpdl_ref idx;
void *be_message;
struct frame *f;
+ bool rc;
idx = SPECPDL_INDEX ();
f = decode_window_system_frame (frame);
record_unwind_protect_ptr (BMessage_delete, be_message);
haiku_lisp_to_message (message, be_message);
- be_drag_message (FRAME_HAIKU_VIEW (f), be_message,
- block_input, unblock_input,
- process_pending_signals);
+ rc = be_drag_message (FRAME_HAIKU_VIEW (f), be_message,
+ block_input, unblock_input,
+ process_pending_signals,
+ haiku_should_quit_drag);
FRAME_DISPLAY_INFO (f)->grabbed = 0;
+ if (rc)
+ quit ();
+
return unbind_to (idx, Qnil);
}