2008-02-18 Alp Toker <alp@atoker.com>
authoralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2008 19:21:05 +0000 (19:21 +0000)
committeralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2008 19:21:05 +0000 (19:21 +0000)
        Build fix for GTK+ < 2.10. Fall back to simple text clipboard copy
        with older GTK+ versions for now.

        * platform/gtk/PasteboardGtk.cpp:
        (WebCore::Pasteboard::writeSelection):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30374 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/gtk/PasteboardGtk.cpp

index 9ffe227..8292ee9 100644 (file)
@@ -1,3 +1,11 @@
+2008-02-18  Alp Toker  <alp@atoker.com>
+
+        Build fix for GTK+ < 2.10. Fall back to simple text clipboard copy
+        with older GTK+ versions for now.
+
+        * platform/gtk/PasteboardGtk.cpp:
+        (WebCore::Pasteboard::writeSelection):
+
 2008-02-18  Darin Adler  <darin@apple.com>
 
         Reviewed by Sam.
index 745728c..15a7e64 100644 (file)
@@ -102,16 +102,20 @@ void Pasteboard::setHelper(PasteboardHelper* helper)
 
 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
 {
+    GtkClipboard* clipboard = m_helper->getClipboard(frame);
+#if GTK_CHECK_VERSION(2,10,0)
     gchar* text = g_strdup(frame->selectedText().utf8().data());
     gchar* markup = g_strdup(createMarkup(selectedRange, 0, AnnotateForInterchange).utf8().data());
     PasteboardSelectionData* data = new PasteboardSelectionData(text, markup);
 
     gint n_targets;
     GtkTargetEntry* targets = gtk_target_table_new_from_list(m_helper->getCopyTargetList(frame), &n_targets);
-    GtkClipboard* clipboard = m_helper->getClipboard(frame);
     gtk_clipboard_set_with_data(clipboard, targets, n_targets,
                                 clipboard_get_contents_cb, clipboard_clear_contents_cb, data);
     gtk_target_table_free(targets, n_targets);
+#else
+    gtk_clipboard_set_text(clipboard, frame->selectedText().utf8().data(), frame->selectedText().utf8().length());
+#endif
 }
 
 void Pasteboard::writeURL(const KURL& url, const String&, Frame* frame)