diff options
| author | Po Lu | 2021-11-22 07:10:57 +0000 |
|---|---|---|
| committer | Po Lu | 2021-11-22 07:10:57 +0000 |
| commit | c7699b97022f5bdc3848d474485e0da5f2673595 (patch) | |
| tree | df4b84e2f1aafabd4c37f8da7ee3d82dc905b42f /src | |
| parent | 9d8a2832e857fa82d401709ee4b56682ccb5b7d4 (diff) | |
| download | emacs-c7699b97022f5bdc3848d474485e0da5f2673595.tar.gz emacs-c7699b97022f5bdc3848d474485e0da5f2673595.zip | |
Fix mouse movement event generation on Haiku
* src/haikuterm.c (haiku_mouse_position): Set timestamp.
(haiku_read_socket): Set last_mouse_movement_time.
* src/haikuterm.h (struct haiku_display_info): Add field
`last_mouse_movement_time'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/haikuterm.c | 30 | ||||
| -rw-r--r-- | src/haikuterm.h | 3 |
2 files changed, 26 insertions, 7 deletions
diff --git a/src/haikuterm.c b/src/haikuterm.c index bc956f066a9..5364ebf823a 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c | |||
| @@ -2386,9 +2386,10 @@ haiku_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2386 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, | 2386 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, |
| 2387 | Time *timestamp) | 2387 | Time *timestamp) |
| 2388 | { | 2388 | { |
| 2389 | block_input (); | ||
| 2390 | if (!fp) | 2389 | if (!fp) |
| 2391 | return; | 2390 | return; |
| 2391 | |||
| 2392 | block_input (); | ||
| 2392 | Lisp_Object frame, tail; | 2393 | Lisp_Object frame, tail; |
| 2393 | struct frame *f1 = NULL; | 2394 | struct frame *f1 = NULL; |
| 2394 | FOR_EACH_FRAME (tail, frame) | 2395 | FOR_EACH_FRAME (tail, frame) |
| @@ -2428,6 +2429,7 @@ haiku_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2428 | *bar_window = Qnil; | 2429 | *bar_window = Qnil; |
| 2429 | *part = scroll_bar_above_handle; | 2430 | *part = scroll_bar_above_handle; |
| 2430 | *fp = f1; | 2431 | *fp = f1; |
| 2432 | *timestamp = x_display_list->last_mouse_movement_time; | ||
| 2431 | XSETINT (*x, sx); | 2433 | XSETINT (*x, sx); |
| 2432 | XSETINT (*y, sy); | 2434 | XSETINT (*y, sy); |
| 2433 | } | 2435 | } |
| @@ -2578,6 +2580,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2578 | static void *buf = NULL; | 2580 | static void *buf = NULL; |
| 2579 | ssize_t b_size; | 2581 | ssize_t b_size; |
| 2580 | struct unhandled_event *unhandled_events = NULL; | 2582 | struct unhandled_event *unhandled_events = NULL; |
| 2583 | int button_or_motion_p; | ||
| 2581 | 2584 | ||
| 2582 | if (!buf) | 2585 | if (!buf) |
| 2583 | buf = xmalloc (200); | 2586 | buf = xmalloc (200); |
| @@ -2597,6 +2600,8 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2597 | inev.arg = Qnil; | 2600 | inev.arg = Qnil; |
| 2598 | inev2.arg = Qnil; | 2601 | inev2.arg = Qnil; |
| 2599 | 2602 | ||
| 2603 | button_or_motion_p = 0; | ||
| 2604 | |||
| 2600 | haiku_read (&type, buf, b_size); | 2605 | haiku_read (&type, buf, b_size); |
| 2601 | 2606 | ||
| 2602 | switch (type) | 2607 | switch (type) |
| @@ -2721,6 +2726,9 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2721 | Lisp_Object frame; | 2726 | Lisp_Object frame; |
| 2722 | XSETFRAME (frame, f); | 2727 | XSETFRAME (frame, f); |
| 2723 | 2728 | ||
| 2729 | x_display_list->last_mouse_movement_time = time (NULL); | ||
| 2730 | button_or_motion_p = 1; | ||
| 2731 | |||
| 2724 | if (b->just_exited_p) | 2732 | if (b->just_exited_p) |
| 2725 | { | 2733 | { |
| 2726 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 2734 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| @@ -2748,9 +2756,9 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2748 | previous_help_echo_string = help_echo_string; | 2756 | previous_help_echo_string = help_echo_string; |
| 2749 | help_echo_string = Qnil; | 2757 | help_echo_string = Qnil; |
| 2750 | 2758 | ||
| 2751 | if (f != dpyinfo->last_mouse_glyph_frame || | 2759 | if (f != dpyinfo->last_mouse_glyph_frame |
| 2752 | b->x < r.x || b->x >= r.x + r.width - 1 || b->y < r.y || | 2760 | || b->x < r.x || b->x >= r.x + r.width |
| 2753 | b->y >= r.y + r.height - 1) | 2761 | || b->y < r.y || b->y >= r.y + r.height) |
| 2754 | { | 2762 | { |
| 2755 | f->mouse_moved = true; | 2763 | f->mouse_moved = true; |
| 2756 | dpyinfo->last_mouse_scroll_bar = NULL; | 2764 | dpyinfo->last_mouse_scroll_bar = NULL; |
| @@ -2805,6 +2813,8 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2805 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); | 2813 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); |
| 2806 | 2814 | ||
| 2807 | x_display_list->last_mouse_glyph_frame = 0; | 2815 | x_display_list->last_mouse_glyph_frame = 0; |
| 2816 | x_display_list->last_mouse_movement_time = time (NULL); | ||
| 2817 | button_or_motion_p = 1; | ||
| 2808 | 2818 | ||
| 2809 | /* Is this in the tab-bar? */ | 2819 | /* Is this in the tab-bar? */ |
| 2810 | if (WINDOWP (f->tab_bar_window) | 2820 | if (WINDOWP (f->tab_bar_window) |
| @@ -2858,6 +2868,8 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2858 | inev.arg = tab_bar_arg; | 2868 | inev.arg = tab_bar_arg; |
| 2859 | inev.code = b->btn_no; | 2869 | inev.code = b->btn_no; |
| 2860 | 2870 | ||
| 2871 | f->mouse_moved = false; | ||
| 2872 | |||
| 2861 | XSETINT (inev.x, b->x); | 2873 | XSETINT (inev.x, b->x); |
| 2862 | XSETINT (inev.y, b->y); | 2874 | XSETINT (inev.y, b->y); |
| 2863 | 2875 | ||
| @@ -3183,15 +3195,19 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3183 | if (inev.kind != NO_EVENT) | 3195 | if (inev.kind != NO_EVENT) |
| 3184 | { | 3196 | { |
| 3185 | if (inev.kind != HELP_EVENT) | 3197 | if (inev.kind != HELP_EVENT) |
| 3186 | inev.timestamp = time (NULL); | 3198 | inev.timestamp = (button_or_motion_p |
| 3199 | ? x_display_list->last_mouse_movement_time | ||
| 3200 | : time (NULL)); | ||
| 3187 | kbd_buffer_store_event_hold (&inev, hold_quit); | 3201 | kbd_buffer_store_event_hold (&inev, hold_quit); |
| 3188 | ++message_count; | 3202 | ++message_count; |
| 3189 | } | 3203 | } |
| 3190 | 3204 | ||
| 3191 | if (inev2.kind != NO_EVENT) | 3205 | if (inev2.kind != NO_EVENT) |
| 3192 | { | 3206 | { |
| 3193 | if (inev.kind != HELP_EVENT) | 3207 | if (inev2.kind != HELP_EVENT) |
| 3194 | inev.timestamp = time (NULL); | 3208 | inev2.timestamp = (button_or_motion_p |
| 3209 | ? x_display_list->last_mouse_movement_time | ||
| 3210 | : time (NULL)); | ||
| 3195 | kbd_buffer_store_event_hold (&inev2, hold_quit); | 3211 | kbd_buffer_store_event_hold (&inev2, hold_quit); |
| 3196 | ++message_count; | 3212 | ++message_count; |
| 3197 | } | 3213 | } |
diff --git a/src/haikuterm.h b/src/haikuterm.h index af55f68c679..7ed7485ef53 100644 --- a/src/haikuterm.h +++ b/src/haikuterm.h | |||
| @@ -30,6 +30,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 30 | #include "character.h" | 30 | #include "character.h" |
| 31 | #include "dispextern.h" | 31 | #include "dispextern.h" |
| 32 | #include "font.h" | 32 | #include "font.h" |
| 33 | #include "systime.h" | ||
| 33 | 34 | ||
| 34 | #define C_FRAME struct frame * | 35 | #define C_FRAME struct frame * |
| 35 | #define C_FONT struct font * | 36 | #define C_FONT struct font * |
| @@ -107,6 +108,8 @@ struct haiku_display_info | |||
| 107 | haiku display; | 108 | haiku display; |
| 108 | 109 | ||
| 109 | double resx, resy; | 110 | double resx, resy; |
| 111 | |||
| 112 | Time last_mouse_movement_time; | ||
| 110 | }; | 113 | }; |
| 111 | 114 | ||
| 112 | struct haiku_output | 115 | struct haiku_output |