aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/haiku_support.cc32
-rw-r--r--src/haikuselect.c45
-rw-r--r--src/haikuterm.c3
-rw-r--r--src/haikuterm.h1
4 files changed, 62 insertions, 19 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 1f7f372a9b4..098739cd98b 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -189,10 +189,6 @@ static BMessage volatile *popup_track_message;
189 number. */ 189 number. */
190static int32 volatile alert_popup_value; 190static int32 volatile alert_popup_value;
191 191
192/* The current window ID. This is increased every time a frame is
193 created. */
194static int current_window_id;
195
196/* The view that has the passive grab. */ 192/* The view that has the passive grab. */
197static void *grab_view; 193static void *grab_view;
198 194
@@ -698,7 +694,6 @@ public:
698 was_shown_p (false), 694 was_shown_p (false),
699 menu_bar_active_p (false), 695 menu_bar_active_p (false),
700 override_redirect_p (false), 696 override_redirect_p (false),
701 window_id (current_window_id),
702 menus_begun (NULL), 697 menus_begun (NULL),
703 z_group (Z_GROUP_NONE), 698 z_group (Z_GROUP_NONE),
704 tooltip_p (false), 699 tooltip_p (false),
@@ -941,12 +936,11 @@ public:
941 if (msg->WasDropped ()) 936 if (msg->WasDropped ())
942 { 937 {
943 BPoint whereto; 938 BPoint whereto;
944 int32 windowid; 939 int64 threadid;
945 struct haiku_drag_and_drop_event rq; 940 struct haiku_drag_and_drop_event rq;
946 941
947 if (msg->FindInt32 ("emacs:window_id", &windowid) == B_OK 942 if (msg->FindInt64 ("emacs:thread_id", &threadid) == B_OK
948 && !msg->IsSourceRemote () 943 && threadid == find_thread (NULL))
949 && windowid == this->window_id)
950 return; 944 return;
951 945
952 whereto = msg->DropPoint (); 946 whereto = msg->DropPoint ();
@@ -1794,7 +1788,7 @@ public:
1794 MouseMoved (BPoint point, uint32 transit, const BMessage *drag_msg) 1788 MouseMoved (BPoint point, uint32 transit, const BMessage *drag_msg)
1795 { 1789 {
1796 struct haiku_mouse_motion_event rq; 1790 struct haiku_mouse_motion_event rq;
1797 int32 windowid; 1791 int64 threadid;
1798 EmacsWindow *window; 1792 EmacsWindow *window;
1799 1793
1800 window = (EmacsWindow *) Window (); 1794 window = (EmacsWindow *) Window ();
@@ -1810,9 +1804,9 @@ public:
1810 rq.time = system_time (); 1804 rq.time = system_time ();
1811 1805
1812 if (drag_msg && (drag_msg->IsSourceRemote () 1806 if (drag_msg && (drag_msg->IsSourceRemote ()
1813 || drag_msg->FindInt32 ("emacs:window_id", 1807 || drag_msg->FindInt64 ("emacs:thread_id",
1814 &windowid) != B_OK 1808 &threadid) != B_OK
1815 || windowid != window->window_id)) 1809 || threadid != find_thread (NULL)))
1816 rq.dnd_message = true; 1810 rq.dnd_message = true;
1817 else 1811 else
1818 rq.dnd_message = false; 1812 rq.dnd_message = false;
@@ -5046,13 +5040,17 @@ be_drag_message (void *view, void *message, bool allow_same_view,
5046 BMessage cancel_message (CANCEL_DROP); 5040 BMessage cancel_message (CANCEL_DROP);
5047 struct object_wait_info infos[2]; 5041 struct object_wait_info infos[2];
5048 ssize_t stat; 5042 ssize_t stat;
5043 thread_id window_thread;
5049 5044
5050 block_input_function (); 5045 block_input_function ();
5051 5046
5052 if (!allow_same_view && 5047 if (!allow_same_view)
5053 (msg->ReplaceInt32 ("emacs:window_id", window->window_id) 5048 window_thread = window->Looper ()->Thread ();
5054 == B_NAME_NOT_FOUND)) 5049
5055 msg->AddInt32 ("emacs:window_id", window->window_id); 5050 if (!allow_same_view
5051 && (msg->ReplaceInt64 ("emacs:thread_id", window_thread)
5052 == B_NAME_NOT_FOUND))
5053 msg->AddInt64 ("emacs:thread_id", window_thread);
5056 5054
5057 if (!vw->LockLooper ()) 5055 if (!vw->LockLooper ())
5058 gui_abort ("Failed to lock view looper for drag"); 5056 gui_abort ("Failed to lock view looper for drag");
diff --git a/src/haikuselect.c b/src/haikuselect.c
index daad98da2b4..268d8b1ec92 100644
--- a/src/haikuselect.c
+++ b/src/haikuselect.c
@@ -37,6 +37,10 @@ struct frame *haiku_dnd_frame;
37/* Whether or not to move the tip frame during drag-and-drop. */ 37/* Whether or not to move the tip frame during drag-and-drop. */
38bool haiku_dnd_follow_tooltip; 38bool haiku_dnd_follow_tooltip;
39 39
40/* Whether or not the current DND frame is able to receive drops from
41 the current drag-and-drop operation. */
42bool haiku_dnd_allow_same_frame;
43
40static void haiku_lisp_to_message (Lisp_Object, void *); 44static void haiku_lisp_to_message (Lisp_Object, void *);
41 45
42static enum haiku_clipboard 46static enum haiku_clipboard
@@ -830,6 +834,8 @@ currently being displayed to move along with the mouse pointer. */)
830 834
831 haiku_dnd_frame = f; 835 haiku_dnd_frame = f;
832 haiku_dnd_follow_tooltip = !NILP (follow_tooltip); 836 haiku_dnd_follow_tooltip = !NILP (follow_tooltip);
837 haiku_dnd_allow_same_frame = !NILP (allow_same_frame);
838
833 be_message = be_create_simple_message (); 839 be_message = be_create_simple_message ();
834 840
835 record_unwind_protect_ptr (haiku_unwind_drag_message, be_message); 841 record_unwind_protect_ptr (haiku_unwind_drag_message, be_message);
@@ -1038,6 +1044,31 @@ haiku_note_drag_motion (void)
1038} 1044}
1039 1045
1040void 1046void
1047haiku_note_drag_wheel (struct input_event *ie)
1048{
1049 bool horizontal, up;
1050
1051 up = false;
1052 horizontal = false;
1053
1054 if (ie->modifiers & up_modifier)
1055 up = true;
1056
1057 if (ie->kind == HORIZ_WHEEL_EVENT)
1058 horizontal = true;
1059
1060 ie->kind = NO_EVENT;
1061
1062 if (!NILP (Vhaiku_drag_wheel_function)
1063 && (haiku_dnd_allow_same_frame
1064 || XFRAME (ie->frame_or_window) != haiku_dnd_frame))
1065 safe_call (6, Vhaiku_drag_wheel_function, ie->frame_or_window,
1066 ie->x, ie->y, horizontal ? Qt : Qnil, up ? Qt : Qnil);
1067
1068 redisplay_preserve_echo_area (35);
1069}
1070
1071void
1041init_haiku_select (void) 1072init_haiku_select (void)
1042{ 1073{
1043 be_clipboard_init (); 1074 be_clipboard_init ();
@@ -1100,13 +1131,13 @@ void
1100syms_of_haikuselect (void) 1131syms_of_haikuselect (void)
1101{ 1132{
1102 DEFVAR_BOOL ("haiku-signal-invalid-refs", haiku_signal_invalid_refs, 1133 DEFVAR_BOOL ("haiku-signal-invalid-refs", haiku_signal_invalid_refs,
1103 doc: /* If nil, silently ignore invalid file names in system messages. 1134 doc: /* If nil, silently ignore invalid file names in system messages.
1104Otherwise, an error will be signalled if adding a file reference to a 1135Otherwise, an error will be signalled if adding a file reference to a
1105system message failed. */); 1136system message failed. */);
1106 haiku_signal_invalid_refs = true; 1137 haiku_signal_invalid_refs = true;
1107 1138
1108 DEFVAR_LISP ("haiku-drag-track-function", Vhaiku_drag_track_function, 1139 DEFVAR_LISP ("haiku-drag-track-function", Vhaiku_drag_track_function,
1109 doc: /* If non-nil, a function to call upon mouse movement while dragging a message. 1140 doc: /* If non-nil, a function to call upon mouse movement while dragging a message.
1110The function is called without any arguments. `mouse-position' can be 1141The function is called without any arguments. `mouse-position' can be
1111used to retrieve the current position of the mouse. */); 1142used to retrieve the current position of the mouse. */);
1112 Vhaiku_drag_track_function = Qnil; 1143 Vhaiku_drag_track_function = Qnil;
@@ -1116,6 +1147,16 @@ used to retrieve the current position of the mouse. */);
1116These are only called if a connection to the Haiku display was opened. */); 1147These are only called if a connection to the Haiku display was opened. */);
1117 Vhaiku_lost_selection_functions = Qnil; 1148 Vhaiku_lost_selection_functions = Qnil;
1118 1149
1150 DEFVAR_LISP ("haiku-drag-wheel-function", Vhaiku_drag_wheel_function,
1151 doc: /* Function called upon wheel movement while dragging a message.
1152If non-nil, it is called with 5 arguments when the mouse wheel moves
1153while a drag-and-drop operation is in progress: the frame where the
1154mouse moved, the frame-relative X and Y positions where the mouse
1155moved, whether or not the wheel movement was horizontal, and whether
1156or not the wheel moved up (or left, if the movement was
1157horizontal). */);
1158 Vhaiku_drag_wheel_function = Qnil;
1159
1119 DEFSYM (QSECONDARY, "SECONDARY"); 1160 DEFSYM (QSECONDARY, "SECONDARY");
1120 DEFSYM (QCLIPBOARD, "CLIPBOARD"); 1161 DEFSYM (QCLIPBOARD, "CLIPBOARD");
1121 DEFSYM (QSTRING, "STRING"); 1162 DEFSYM (QSTRING, "STRING");
diff --git a/src/haikuterm.c b/src/haikuterm.c
index bcb3af0e2c3..7630d9c103c 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -3867,6 +3867,9 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3867 : down_modifier); 3867 : down_modifier);
3868 py = 0.0f; 3868 py = 0.0f;
3869 px = 0.0f; 3869 px = 0.0f;
3870
3871 if (be_drag_and_drop_in_progress ())
3872 haiku_note_drag_wheel (&inev);
3870 } 3873 }
3871 3874
3872 break; 3875 break;
diff --git a/src/haikuterm.h b/src/haikuterm.h
index 46a2218e492..02a364f6712 100644
--- a/src/haikuterm.h
+++ b/src/haikuterm.h
@@ -333,6 +333,7 @@ extern Lisp_Object haiku_popup_dialog (struct frame *, Lisp_Object, Lisp_Object)
333extern void haiku_activate_menubar (struct frame *); 333extern void haiku_activate_menubar (struct frame *);
334extern void haiku_wait_for_event (struct frame *, int); 334extern void haiku_wait_for_event (struct frame *, int);
335extern void haiku_note_drag_motion (void); 335extern void haiku_note_drag_motion (void);
336extern void haiku_note_drag_wheel (struct input_event *);
336 337
337extern void initialize_frame_menubar (struct frame *); 338extern void initialize_frame_menubar (struct frame *);
338 339