Skip to content

Commit

Permalink
Fix Haiku support, fix Show action not syncing with GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Slackadays committed Feb 19, 2023
1 parent b36ab82 commit 457657e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/clipboard/src/clipboard.cpp
Expand Up @@ -943,13 +943,13 @@ int main(int argc, char* argv[]) {
setFlags();

setFilepaths();

fs::create_directories(path.temporary), fs::create_directories(path.persistent);

syncWithGUIClipboard();


action = getAction();

syncWithGUIClipboard();

copying.items.assign(arguments.begin(), arguments.end());

io_type = getIOType();
Expand Down Expand Up @@ -982,4 +982,4 @@ int main(int argc, char* argv[]) {
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
}
37 changes: 23 additions & 14 deletions src/clipboard/src/haiku.cpp
Expand Up @@ -20,21 +20,30 @@
#include "clipboard.hpp"

ClipboardContent getGUIClipboard() {
/*if (be_clipboard->Lock()) {
BMessage *content = be_clipboard->Data();
std::unique_ptr<BClipboard> gui_clipboard = std::make_unique<BClipboard>("system");
if (!gui_clipboard->Lock()) return {};
BMessage *content = gui_clipboard->Data();
gui_clipboard->Unlock();
const char* temp;
ssize_t tempLength;
content->FindData("text/plain", B_MIME_TYPE, (const void**)&temp, &tempLength);
be_clipboard->Unlock();
std::string CBcontent(temp, tempLength);
return ClipboardContent(CBcontent);
}*/
return ClipboardContent();
ssize_t tempLength = 0;
if (!content->FindData("text/plain", B_MIME_TYPE, (const void**)&temp, &tempLength)) {
std::string CBcontent(temp, tempLength);
return ClipboardContent(CBcontent);
}
return {};
}

void writeToGUIClipboard(const ClipboardContent& clipboard) {
if (clipboard.type() == ClipboardContentType::Text) {

} else if (clipboard.type() == ClipboardContentType::Paths) {
}
}
std::unique_ptr<BClipboard> gui_clipboard = std::make_unique<BClipboard>("system");
if (!gui_clipboard->Lock()) return;
gui_clipboard->Clear();
BMessage *content = (BMessage *)NULL;
if (content = gui_clipboard->Data()) {
if (clipboard.type() == ClipboardContentType::Text) {
content->AddData("text/plain", B_MIME_TYPE, clipboard.text().data(), clipboard.text().length());
} else if (clipboard.type() == ClipboardContentType::Paths) {
}
gui_clipboard->Commit();
}
gui_clipboard->Unlock();
}

0 comments on commit 457657e

Please sign in to comment.