From be21c95842f37e164606a6b392f5396d91506f61 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 27 Mar 2022 13:36:45 +0000 Subject: Store latin-1 content into the Haiku clipboard as well * lisp/term/haiku-win.el (haiku-normal-selection-encoders): New variable. (haiku-select-encode-utf-8-string, haiku-select-encode-xstring): New functions. (gui-backend-set-selection): Use new selection encoder functions instead of hard-coding UTF-8. (haiku-dnd-handle-drag-n-drop-event): Rename to `haiku-drag-and-drop'. * src/haiku_select.cc (be_lock_clipboard_message): Accept new argument `clear'. (be_unlock_clipboard): Accept new argument `discard'. * src/haikuselect.c (Fhaiku_selection_data): Change calls to `be_lock_clipboard_message' and `be_unlock_clipboard'. (haiku_unwind_clipboard_lock): New function. (Fhaiku_selection_put): Accept new meaning of `name' which means to set the selection message. * src/haikuselect.h: Update prototypes. --- src/haiku_select.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/haiku_select.cc') diff --git a/src/haiku_select.cc b/src/haiku_select.cc index 373ad321c4b..e047b9b5139 100644 --- a/src/haiku_select.cc +++ b/src/haiku_select.cc @@ -413,7 +413,7 @@ be_add_message_message (void *message, const char *name, int be_lock_clipboard_message (enum haiku_clipboard clipboard, - void **message_return) + void **message_return, bool clear) { BClipboard *board; @@ -427,12 +427,15 @@ be_lock_clipboard_message (enum haiku_clipboard clipboard, if (!board->Lock ()) return 1; + if (clear) + board->Clear (); + *message_return = board->Data (); return 0; } void -be_unlock_clipboard (enum haiku_clipboard clipboard) +be_unlock_clipboard (enum haiku_clipboard clipboard, bool discard) { BClipboard *board; @@ -443,5 +446,10 @@ be_unlock_clipboard (enum haiku_clipboard clipboard) else board = system_clipboard; + if (discard) + board->Revert (); + else + board->Commit (); + board->Unlock (); } -- cgit v1.2.1