3 * \file gtk/GuiClipboard.C
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
15 // Too hard to make concept checks work with this file
16 #ifdef _GLIBCXX_CONCEPT_CHECKS
17 #undef _GLIBCXX_CONCEPT_CHECKS
19 #ifdef _GLIBCPP_CONCEPT_CHECKS
20 #undef _GLIBCPP_CONCEPT_CHECKS
23 #include "GuiClipboard.h"
34 // ENCODING: Gtk::Clipboard returns UTF-8, we assume that the backend
35 // wants ISO-8859-1 and convert it to that.
37 string const GuiClipboard::get() const
39 Glib::RefPtr<Gtk::Clipboard> clipboard =
40 Gtk::Clipboard::get(GDK_SELECTION_CLIPBOARD);
41 string const str = Glib::convert_with_fallback(
42 clipboard->wait_for_text(), "ISO-8859-1", "UTF-8");
43 lyxerr[Debug::ACTION] << "GuiClipboard::get: " << str << endl;
48 // ENCODING: we assume that the backend passes us ISO-8859-1 and
49 // convert from that to UTF-8 before passing to GTK
51 void GuiClipboard::put(string const & str)
53 lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
54 Glib::RefPtr<Gtk::Clipboard> clipboard =
55 Gtk::Clipboard::get(GDK_SELECTION_CLIPBOARD);
56 clipboard->set_text(Glib::convert(str, "UTF-8", "ISO-8859-1"));
59 } // namespace frontend