aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-03-19 07:00:11 +0000
committerPo Lu2022-03-19 07:00:28 +0000
commit43ee6f291d88453f0d6dec76fe80f4e7503abc81 (patch)
tree5973c33811255eb222be8f3337d094f541eb1ba7 /src
parent5781f0af7dae91097f797e93a63cb733b2b66f1d (diff)
downloademacs-43ee6f291d88453f0d6dec76fe80f4e7503abc81.tar.gz
emacs-43ee6f291d88453f0d6dec76fe80f4e7503abc81.zip
Ignore drag source frame on Haiku in line with documentation
* src/haiku_support.cc (class EmacsWindow): New field `window_id'. (MessageReceived): Ignore dropped messages with same window id. (be_drag_message): Add source frame's window ID to message.
Diffstat (limited to 'src')
-rw-r--r--src/haiku_support.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 8c45a7adcb1..26b7ebed246 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -117,6 +117,7 @@ static BLocker movement_locker;
117 117
118static BMessage volatile *popup_track_message; 118static BMessage volatile *popup_track_message;
119static int32 volatile alert_popup_value; 119static int32 volatile alert_popup_value;
120static int current_window_id;
120 121
121static void *grab_view = NULL; 122static void *grab_view = NULL;
122static BLocker grab_view_locker; 123static BLocker grab_view_locker;
@@ -414,11 +415,12 @@ public:
414 pthread_mutex_t menu_update_mutex = PTHREAD_MUTEX_INITIALIZER; 415 pthread_mutex_t menu_update_mutex = PTHREAD_MUTEX_INITIALIZER;
415 pthread_cond_t menu_update_cv = PTHREAD_COND_INITIALIZER; 416 pthread_cond_t menu_update_cv = PTHREAD_COND_INITIALIZER;
416 bool menu_updated_p = false; 417 bool menu_updated_p = false;
418 int window_id;
417 419
418 EmacsWindow () : BWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK, 420 EmacsWindow () : BWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK,
419 B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS) 421 B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS)
420 { 422 {
421 423 window_id = current_window_id++;
422 } 424 }
423 425
424 ~EmacsWindow () 426 ~EmacsWindow ()
@@ -639,8 +641,13 @@ public:
639 if (msg->WasDropped ()) 641 if (msg->WasDropped ())
640 { 642 {
641 BPoint whereto; 643 BPoint whereto;
644 int32 windowid;
642 struct haiku_drag_and_drop_event rq; 645 struct haiku_drag_and_drop_event rq;
643 646
647 if (msg->FindInt32 ("emacs:window_id", &windowid) == B_OK
648 && windowid == this->window_id)
649 return;
650
644 if (msg->FindPoint ("_drop_point_", &whereto) == B_OK) 651 if (msg->FindPoint ("_drop_point_", &whereto) == B_OK)
645 { 652 {
646 this->ConvertFromScreen (&whereto); 653 this->ConvertFromScreen (&whereto);
@@ -3960,6 +3967,7 @@ be_drag_message (void *view, void *message,
3960 void (*process_pending_signals_function) (void)) 3967 void (*process_pending_signals_function) (void))
3961{ 3968{
3962 EmacsView *vw = (EmacsView *) view; 3969 EmacsView *vw = (EmacsView *) view;
3970 EmacsWindow *window = (EmacsWindow *) vw->Window ();
3963 BMessage *msg = (BMessage *) message; 3971 BMessage *msg = (BMessage *) message;
3964 BMessage wait_for_release; 3972 BMessage wait_for_release;
3965 BMessenger messenger (vw); 3973 BMessenger messenger (vw);
@@ -3967,6 +3975,7 @@ be_drag_message (void *view, void *message,
3967 ssize_t stat; 3975 ssize_t stat;
3968 3976
3969 block_input_function (); 3977 block_input_function ();
3978 msg->AddInt32 ("emacs:window_id", window->window_id);
3970 if (!vw->LockLooper ()) 3979 if (!vw->LockLooper ())
3971 gui_abort ("Failed to lock view looper for drag"); 3980 gui_abort ("Failed to lock view looper for drag");
3972 3981