From ea86ba8966c80256e05c45aead130aff462f9ad8 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 30 Mar 2022 08:24:45 +0000 Subject: [PATCH] Ignore mouse movement correctly on Haiku during drag and drop * src/haikuselect.c (haiku_unwind_drag_message): New function. (Fhaiku_drag_message): Set `haiku_dnd_in_progress' to false. * src/haikuterm.c (haiku_read_socket): Fix overriding of need_flush when reading events from multiple frames. * src/haikuterm.h (haiku_dnd_in_progress): New variable. * src/xdisp.c (note_mouse_highlight): Ignore if said variable is true. --- src/haikuselect.c | 11 ++++++++++- src/haikuterm.c | 5 +++-- src/haikuterm.h | 1 + src/xdisp.c | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/haikuselect.c b/src/haikuselect.c index 77dcff42a61..d2582e777f1 100644 --- a/src/haikuselect.c +++ b/src/haikuselect.c @@ -27,6 +27,7 @@ along with GNU Emacs. If not, see . */ #include +bool haiku_dnd_in_progress; static void haiku_lisp_to_message (Lisp_Object, void *); DEFUN ("haiku-selection-data", Fhaiku_selection_data, Shaiku_selection_data, @@ -723,6 +724,13 @@ haiku_should_quit_drag (void) return !NILP (Vquit_flag); } +static void +haiku_unwind_drag_message (void *message) +{ + BMessage_delete (message); + haiku_dnd_in_progress = false; +} + DEFUN ("haiku-drag-message", Fhaiku_drag_message, Shaiku_drag_message, 2, 3, 0, doc: /* Begin dragging MESSAGE from FRAME. @@ -768,9 +776,10 @@ ignored if it is dropped on top of FRAME. */) if (!FRAME_VISIBLE_P (f)) error ("Frame is invisible"); + haiku_dnd_in_progress = true; be_message = be_create_simple_message (); - record_unwind_protect_ptr (BMessage_delete, be_message); + record_unwind_protect_ptr (haiku_unwind_drag_message, be_message); haiku_lisp_to_message (message, be_message); rc = be_drag_message (FRAME_HAIKU_VIEW (f), be_message, !NILP (allow_same_frame), diff --git a/src/haikuterm.c b/src/haikuterm.c index c2e8375a10c..304b7a34255 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -58,7 +58,7 @@ struct unhandled_event uint8_t buffer[200]; }; -static bool any_help_event_p = false; +static bool any_help_event_p; char * get_keysym_name (int keysym) @@ -3120,7 +3120,8 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) do_help = 1; } - need_flush = FRAME_DIRTY_P (f); + if (FRAME_DIRTY_P (f)) + need_flush = 1; break; } case BUTTON_UP: diff --git a/src/haikuterm.h b/src/haikuterm.h index 5f8052f0f99..86abcc560c9 100644 --- a/src/haikuterm.h +++ b/src/haikuterm.h @@ -35,6 +35,7 @@ along with GNU Emacs. If not, see . */ #define HAVE_CHAR_CACHE_MAX 65535 extern int popup_activated_p; +extern bool haiku_dnd_in_progress; extern void be_app_quit (void); diff --git a/src/xdisp.c b/src/xdisp.c index 62c8f9d4d93..f6fe3253e98 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -34247,7 +34247,7 @@ note_mouse_highlight (struct frame *f, int x, int y) #endif #if defined (HAVE_HAIKU) - if (popup_activated_p) + if (popup_activated_p || haiku_dnd_in_progress) return; #endif -- 2.39.2