diff options
| author | Po Lu | 2022-07-09 04:50:06 +0000 |
|---|---|---|
| committer | Po Lu | 2022-07-09 04:50:35 +0000 |
| commit | edabfe4ff66090b3b2c433962df4cfe1a68259fd (patch) | |
| tree | 89d27a45082768a61bdcbcb49bfb25a7f4637b98 /src/haikuselect.c | |
| parent | f400c60237f04781b60423492c583beea6c77e8e (diff) | |
| download | emacs-edabfe4ff66090b3b2c433962df4cfe1a68259fd.tar.gz emacs-edabfe4ff66090b3b2c433962df4cfe1a68259fd.zip | |
Fix race conditions handling selection clear events on Haiku
* src/haiku_select.cc (be_handle_clipboard_changed_message):
Include current clipboard count.
(be_selection_outdated_p): New function.
* src/haikuselect.c (haiku_handle_selection_clear): Ignore
outdated events.
(haiku_selection_disowned): New argument `count'. Include it in
the timestamp field of the selection clear event.
* src/haikuselect.h: Update prototypes.
* src/systime.h: Define `Time' to an appropriate value on Haiku.
Diffstat (limited to 'src/haikuselect.c')
| -rw-r--r-- | src/haikuselect.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/haikuselect.c b/src/haikuselect.c index 03aba1f9baa..9d8c4a2cd16 100644 --- a/src/haikuselect.c +++ b/src/haikuselect.c | |||
| @@ -1024,6 +1024,13 @@ init_haiku_select (void) | |||
| 1024 | void | 1024 | void |
| 1025 | haiku_handle_selection_clear (struct input_event *ie) | 1025 | haiku_handle_selection_clear (struct input_event *ie) |
| 1026 | { | 1026 | { |
| 1027 | enum haiku_clipboard id; | ||
| 1028 | |||
| 1029 | id = haiku_get_clipboard_name (ie->arg); | ||
| 1030 | |||
| 1031 | if (be_selection_outdated_p (id, ie->timestamp)) | ||
| 1032 | return; | ||
| 1033 | |||
| 1027 | CALLN (Frun_hook_with_args, | 1034 | CALLN (Frun_hook_with_args, |
| 1028 | Qhaiku_lost_selection_functions, ie->arg); | 1035 | Qhaiku_lost_selection_functions, ie->arg); |
| 1029 | 1036 | ||
| @@ -1033,7 +1040,7 @@ haiku_handle_selection_clear (struct input_event *ie) | |||
| 1033 | } | 1040 | } |
| 1034 | 1041 | ||
| 1035 | void | 1042 | void |
| 1036 | haiku_selection_disowned (enum haiku_clipboard id) | 1043 | haiku_selection_disowned (enum haiku_clipboard id, int64 count) |
| 1037 | { | 1044 | { |
| 1038 | struct input_event ie; | 1045 | struct input_event ie; |
| 1039 | 1046 | ||
| @@ -1055,6 +1062,7 @@ haiku_selection_disowned (enum haiku_clipboard id) | |||
| 1055 | break; | 1062 | break; |
| 1056 | } | 1063 | } |
| 1057 | 1064 | ||
| 1065 | ie.timestamp = count; | ||
| 1058 | kbd_buffer_store_event (&ie); | 1066 | kbd_buffer_store_event (&ie); |
| 1059 | } | 1067 | } |
| 1060 | 1068 | ||