diff options
| author | Po Lu | 2022-01-19 02:08:52 +0000 |
|---|---|---|
| committer | Po Lu | 2022-01-19 02:08:52 +0000 |
| commit | 90dda33108dc505f66d79c6422cf69456c5b7fa0 (patch) | |
| tree | 7c7ce9f831312c943213832205ba8c0bb19813f4 /src | |
| parent | d5723560d5b611d076b196b350e34190834b1c88 (diff) | |
| download | emacs-90dda33108dc505f66d79c6422cf69456c5b7fa0.tar.gz emacs-90dda33108dc505f66d79c6422cf69456c5b7fa0.zip | |
Use more reliable timestamps for some kinds of events on Haiku
* src/haiku_support.cc (DispatchMessage):
(MouseMoved):
(MouseDown):
(MouseUp): Set `time' field of event structures to input server
time.
* src/haiku_support.h (struct haiku_key_event):
(struct haiku_mouse_motion_event):
(struct haiku_button_event): New field `time'.
* src/haikuterm.c (haiku_read_socket): Use input server time
if provided.
Diffstat (limited to 'src')
| -rw-r--r-- | src/haiku_support.cc | 5 | ||||
| -rw-r--r-- | src/haiku_support.h | 8 | ||||
| -rw-r--r-- | src/haikuterm.c | 9 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 53716ff1612..cd4e6e46cd2 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc | |||
| @@ -720,6 +720,7 @@ public: | |||
| 720 | int ret; | 720 | int ret; |
| 721 | msg->FindInt32 ("raw_char", &raw); | 721 | msg->FindInt32 ("raw_char", &raw); |
| 722 | msg->FindInt32 ("key", &key); | 722 | msg->FindInt32 ("key", &key); |
| 723 | msg->FindInt64 ("when", &rq.time); | ||
| 723 | 724 | ||
| 724 | rq.modifiers = 0; | 725 | rq.modifiers = 0; |
| 725 | uint32_t mods = modifiers (); | 726 | uint32_t mods = modifiers (); |
| @@ -1382,8 +1383,8 @@ public: | |||
| 1382 | rq.just_exited_p = transit == B_EXITED_VIEW; | 1383 | rq.just_exited_p = transit == B_EXITED_VIEW; |
| 1383 | rq.x = point.x; | 1384 | rq.x = point.x; |
| 1384 | rq.y = point.y; | 1385 | rq.y = point.y; |
| 1385 | rq.be_code = transit; | ||
| 1386 | rq.window = this->Window (); | 1386 | rq.window = this->Window (); |
| 1387 | rq.time = system_time (); | ||
| 1387 | 1388 | ||
| 1388 | if (ToolTip ()) | 1389 | if (ToolTip ()) |
| 1389 | ToolTip ()->SetMouseRelativeLocation (BPoint (-(point.x - tt_absl_pos.x), | 1390 | ToolTip ()->SetMouseRelativeLocation (BPoint (-(point.x - tt_absl_pos.x), |
| @@ -1438,6 +1439,7 @@ public: | |||
| 1438 | 1439 | ||
| 1439 | SetMouseEventMask (B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); | 1440 | SetMouseEventMask (B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); |
| 1440 | 1441 | ||
| 1442 | rq.time = system_time (); | ||
| 1441 | haiku_write (BUTTON_DOWN, &rq); | 1443 | haiku_write (BUTTON_DOWN, &rq); |
| 1442 | } | 1444 | } |
| 1443 | 1445 | ||
| @@ -1484,6 +1486,7 @@ public: | |||
| 1484 | if (!buttons) | 1486 | if (!buttons) |
| 1485 | SetMouseEventMask (0, 0); | 1487 | SetMouseEventMask (0, 0); |
| 1486 | 1488 | ||
| 1489 | rq.time = system_time (); | ||
| 1487 | haiku_write (BUTTON_UP, &rq); | 1490 | haiku_write (BUTTON_UP, &rq); |
| 1488 | } | 1491 | } |
| 1489 | }; | 1492 | }; |
diff --git a/src/haiku_support.h b/src/haiku_support.h index 83f22972ce2..6ddc28759b5 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h | |||
| @@ -34,6 +34,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 34 | 34 | ||
| 35 | #include <math.h> | 35 | #include <math.h> |
| 36 | 36 | ||
| 37 | #include <kernel/OS.h> | ||
| 38 | |||
| 37 | enum haiku_cursor | 39 | enum haiku_cursor |
| 38 | { | 40 | { |
| 39 | CURSOR_ID_NO_CURSOR = 12, | 41 | CURSOR_ID_NO_CURSOR = 12, |
| @@ -132,6 +134,9 @@ struct haiku_key_event | |||
| 132 | int modifiers; | 134 | int modifiers; |
| 133 | unsigned keysym; | 135 | unsigned keysym; |
| 134 | uint32_t multibyte_char; | 136 | uint32_t multibyte_char; |
| 137 | |||
| 138 | /* Time the keypress occurred, in microseconds. */ | ||
| 139 | bigtime_t time; | ||
| 135 | }; | 140 | }; |
| 136 | 141 | ||
| 137 | struct haiku_activation_event | 142 | struct haiku_activation_event |
| @@ -146,7 +151,7 @@ struct haiku_mouse_motion_event | |||
| 146 | bool just_exited_p; | 151 | bool just_exited_p; |
| 147 | int x; | 152 | int x; |
| 148 | int y; | 153 | int y; |
| 149 | uint32_t be_code; | 154 | bigtime_t time; |
| 150 | }; | 155 | }; |
| 151 | 156 | ||
| 152 | struct haiku_button_event | 157 | struct haiku_button_event |
| @@ -156,6 +161,7 @@ struct haiku_button_event | |||
| 156 | int modifiers; | 161 | int modifiers; |
| 157 | int x; | 162 | int x; |
| 158 | int y; | 163 | int y; |
| 164 | bigtime_t time; | ||
| 159 | }; | 165 | }; |
| 160 | 166 | ||
| 161 | struct haiku_iconification_event | 167 | struct haiku_iconification_event |
diff --git a/src/haikuterm.c b/src/haikuterm.c index 0fa6050b478..93ba088f5b1 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c | |||
| @@ -2725,6 +2725,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2725 | inev.kind = inev.code > 127 ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : | 2725 | inev.kind = inev.code > 127 ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : |
| 2726 | ASCII_KEYSTROKE_EVENT; | 2726 | ASCII_KEYSTROKE_EVENT; |
| 2727 | 2727 | ||
| 2728 | inev.timestamp = b->time / 1000; | ||
| 2728 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); | 2729 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); |
| 2729 | XSETFRAME (inev.frame_or_window, f); | 2730 | XSETFRAME (inev.frame_or_window, f); |
| 2730 | break; | 2731 | break; |
| @@ -2763,7 +2764,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2763 | Lisp_Object frame; | 2764 | Lisp_Object frame; |
| 2764 | XSETFRAME (frame, f); | 2765 | XSETFRAME (frame, f); |
| 2765 | 2766 | ||
| 2766 | x_display_list->last_mouse_movement_time = system_time () / 1000; | 2767 | x_display_list->last_mouse_movement_time = b->time / 1000; |
| 2767 | button_or_motion_p = 1; | 2768 | button_or_motion_p = 1; |
| 2768 | 2769 | ||
| 2769 | if (hlinfo->mouse_face_hidden) | 2770 | if (hlinfo->mouse_face_hidden) |
| @@ -2889,7 +2890,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2889 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); | 2890 | inev.modifiers = haiku_modifiers_to_emacs (b->modifiers); |
| 2890 | 2891 | ||
| 2891 | x_display_list->last_mouse_glyph_frame = 0; | 2892 | x_display_list->last_mouse_glyph_frame = 0; |
| 2892 | x_display_list->last_mouse_movement_time = system_time () / 1000; | 2893 | x_display_list->last_mouse_movement_time = b->time / 1000; |
| 2893 | button_or_motion_p = 1; | 2894 | button_or_motion_p = 1; |
| 2894 | 2895 | ||
| 2895 | /* Is this in the tab-bar? */ | 2896 | /* Is this in the tab-bar? */ |
| @@ -3294,7 +3295,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3294 | 3295 | ||
| 3295 | if (inev.kind != NO_EVENT) | 3296 | if (inev.kind != NO_EVENT) |
| 3296 | { | 3297 | { |
| 3297 | if (inev.kind != HELP_EVENT) | 3298 | if (inev.kind != HELP_EVENT && !inev.timestamp) |
| 3298 | inev.timestamp = (button_or_motion_p | 3299 | inev.timestamp = (button_or_motion_p |
| 3299 | ? x_display_list->last_mouse_movement_time | 3300 | ? x_display_list->last_mouse_movement_time |
| 3300 | : system_time () / 1000); | 3301 | : system_time () / 1000); |
| @@ -3304,7 +3305,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3304 | 3305 | ||
| 3305 | if (inev2.kind != NO_EVENT) | 3306 | if (inev2.kind != NO_EVENT) |
| 3306 | { | 3307 | { |
| 3307 | if (inev2.kind != HELP_EVENT) | 3308 | if (inev2.kind != HELP_EVENT && !inev.timestamp) |
| 3308 | inev2.timestamp = (button_or_motion_p | 3309 | inev2.timestamp = (button_or_motion_p |
| 3309 | ? x_display_list->last_mouse_movement_time | 3310 | ? x_display_list->last_mouse_movement_time |
| 3310 | : system_time () / 1000); | 3311 | : system_time () / 1000); |