wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src clipboard.cpp


From: Isaac Clerencia
Subject: [Wesnoth-cvs-commits] wesnoth/src clipboard.cpp
Date: Thu, 26 Aug 2004 07:42:27 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Isaac Clerencia <address@hidden>        04/08/26 11:37:59

Modified files:
        src            : clipboard.cpp 

Log message:
        Added clipboard support for BEOS, patch #3153 from ahwayakchih

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/clipboard.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: wesnoth/src/clipboard.cpp
diff -u wesnoth/src/clipboard.cpp:1.5 wesnoth/src/clipboard.cpp:1.6
--- wesnoth/src/clipboard.cpp:1.5       Sun Aug 15 15:55:23 2004
+++ wesnoth/src/clipboard.cpp   Thu Aug 26 11:37:59 2004
@@ -371,6 +371,43 @@
 
 #endif
 
+#ifdef __BEOS__
+#include <Clipboard.h>
+
+#define CLIPBOARD_FUNCS_DEFINED
+
+void copy_to_clipboard(const std::string& text)
+{
+       BMessage *clip;
+       if (be_clipboard->Lock())
+       {
+               be_clipboard->Clear();
+               if ((clip = be_clipboard->Data()))
+               {
+                       clip->AddData("text/plain", B_MIME_TYPE, text.c_str(), 
text.size()+1);
+                       be_clipboard->Commit();
+               }
+               be_clipboard->Unlock();
+       }
+}
+
+std::string copy_from_clipboard()
+{
+       const char* data;
+       ssize_t size;
+       BMessage *clip = NULL;
+       if (be_clipboard->Lock())
+       {
+               clip = be_clipboard->Data();
+               be_clipboard->Unlock();
+       }
+       if (clip != NULL && clip->FindData("text/plain", B_MIME_TYPE, (const 
void**)&data, &size) == B_OK)
+               return (const char*)data;
+       else
+               return "";
+}
+#endif
+
 #ifndef CLIPBOARD_FUNCS_DEFINED
 
 void copy_to_clipboard(const std::string& text)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]