Update to spice2x-25-04-25 (pre-apply)

> broken commit
This commit is contained in:
[ ]
2025-05-07 00:25:31 +09:00
parent 04dee88276
commit c94de456b5
543 changed files with 78491 additions and 91698 deletions
+42
View File
@@ -15,6 +15,7 @@
#include "util/libutils.h"
#include "util/logging.h"
#include "util/utils.h"
namespace clipboard {
namespace imports {
@@ -140,4 +141,45 @@ namespace clipboard {
handle.detach();
}
void copy_text(const std::string& str) {
if (!OpenClipboard(nullptr)) {
log_warning("clipboard", "Failed to open clipboard");
return;
}
HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE, str.length() + 1);
memcpy(GlobalLock(mem), str.c_str(), str.length() + 1);
GlobalUnlock(mem);
EmptyClipboard();
SetClipboardData(CF_TEXT, mem);
CloseClipboard();
}
const std::string paste_text() {
HGLOBAL hglb;
LPSTR str;
std::string text;
// check if clipboard content is text
if (!IsClipboardFormatAvailable(CF_TEXT)) {
return text;
}
if (!OpenClipboard(nullptr)) {
log_warning("clipboard", "Failed to open clipboard");
return text;
}
hglb = GetClipboardData(CF_TEXT);
if (hglb != NULL) {
str = reinterpret_cast<LPSTR>(GlobalLock(hglb));
if (str != NULL) {
text = str;
GlobalUnlock(hglb);
}
}
CloseClipboard();
return text;
}
}