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.
36 string const GuiClipboard::get() const
38 Glib::RefPtr<Gtk::Clipboard> clipboard =
39 Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
40 string const str = Glib::convert_with_fallback(
41 clipboard->wait_for_text(), "ISO-8859-1", "UTF-8");
42 lyxerr[Debug::ACTION] << "GuiClipboard::get: " << str << endl;
47 // ENCODING: we assume that the backend passes us ISO-8859-1 and
48 // convert from that to UTF-8 before passing to GTK
49 void GuiClipboard::put(string const & str)
51 lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
52 Glib::RefPtr<Gtk::Clipboard> clipboard =
53 Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
54 clipboard->set_text(Glib::convert(str, "UTF-8", "ISO-8859-1"));
57 } // namespace frontend