diff options
author | Po Lu <luangruo@yahoo.com> | 2022-07-13 05:44:31 +0000 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-07-13 05:45:30 +0000 |
commit | defe6cf2d941ceee2d7e11cc991da6a62fd52398 (patch) | |
tree | e5e199f1040f772ec384ab7438ceee009004f52a /src | |
parent | 6fba6a3c4a429cba480fe29156bfd87dc130bfe1 (diff) | |
download | emacs-defe6cf2d941ceee2d7e11cc991da6a62fd52398.tar.gz emacs-defe6cf2d941ceee2d7e11cc991da6a62fd52398.tar.bz2 emacs-defe6cf2d941ceee2d7e11cc991da6a62fd52398.zip |
Implement TIMESTAMP target for Haiku selections
* lisp/term/haiku-win.el (haiku-selection-targets): Fix return
values.
(gui-backend-get-selection): Handle TIMESTAMP specially.
* src/haiku_select.cc (be_get_clipboard_count): New function.
* src/haikuselect.c (Fhaiku_selection_timestamp): New function.
(syms_of_haikuselect): Add new defsubr.
* src/haikuselect.h: Update prototypes.
Diffstat (limited to 'src')
-rw-r--r-- | src/haiku_select.cc | 9 | ||||
-rw-r--r-- | src/haikuselect.c | 18 | ||||
-rw-r--r-- | src/haikuselect.h | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/haiku_select.cc b/src/haiku_select.cc index e1f2a815241..872da1d6c44 100644 --- a/src/haiku_select.cc +++ b/src/haiku_select.cc @@ -508,3 +508,12 @@ be_selection_outdated_p (enum haiku_clipboard id, int64 count) return false; } + +int64 +be_get_clipboard_count (enum haiku_clipboard id) +{ + BClipboard *clipboard; + + clipboard = get_clipboard_object (id); + return clipboard->SystemCount (); +} diff --git a/src/haikuselect.c b/src/haikuselect.c index 9d8c4a2cd16..dc0a7edf430 100644 --- a/src/haikuselect.c +++ b/src/haikuselect.c @@ -54,6 +54,23 @@ haiku_get_clipboard_name (Lisp_Object clipboard) signal_error ("Invalid clipboard", clipboard); } +DEFUN ("haiku-selection-timestamp", Fhaiku_selection_timestamp, + Shaiku_selection_timestamp, 1, 1, 0, + doc: /* Retrieve the "timestamp" of the clipboard CLIPBOARD. +CLIPBOARD can either be the symbol `PRIMARY', `SECONDARY' or +`CLIPBOARD'. The timestamp is returned as a number describing the +number of times programs have put data into CLIPBOARD. */) + (Lisp_Object clipboard) +{ + enum haiku_clipboard clipboard_name; + int64 timestamp; + + clipboard_name = haiku_get_clipboard_name (clipboard); + timestamp = be_get_clipboard_count (clipboard_name); + + return INT_TO_INTEGER (timestamp); +} + DEFUN ("haiku-selection-data", Fhaiku_selection_data, Shaiku_selection_data, 2, 2, 0, doc: /* Retrieve content typed as NAME from the clipboard @@ -1122,6 +1139,7 @@ These are only called if a connection to the Haiku display was opened. */); DEFSYM (Qalready_running, "already-running"); defsubr (&Shaiku_selection_data); + defsubr (&Shaiku_selection_timestamp); defsubr (&Shaiku_selection_put); defsubr (&Shaiku_selection_owner_p); defsubr (&Shaiku_drag_message); diff --git a/src/haikuselect.h b/src/haikuselect.h index 61efeb9cd93..42e9c93f7e9 100644 --- a/src/haikuselect.h +++ b/src/haikuselect.h @@ -67,6 +67,7 @@ extern void be_unlock_clipboard (enum haiku_clipboard, bool); extern void be_handle_clipboard_changed_message (void); extern void be_start_watching_selection (enum haiku_clipboard); extern bool be_selection_outdated_p (enum haiku_clipboard, int64); +extern int64 be_get_clipboard_count (enum haiku_clipboard); #ifdef __cplusplus }; |