MidoriBrowser* browser)
{
GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
+ /* Work around broken clipboard handling for the sake of the user */
+ if (WEBKIT_IS_WEB_VIEW (widget))
+ {
+ GtkWidget* scrolled = gtk_widget_get_parent (widget);
+ GtkWidget* view = gtk_widget_get_parent (scrolled);
+ const gchar* selected = midori_view_get_selected_text (MIDORI_VIEW (view));
+ sokoke_widget_copy_clipboard (widget, selected);
+ return;
+ }
if (G_LIKELY (widget) && g_signal_lookup ("copy-clipboard", G_OBJECT_TYPE (widget)))
g_signal_emit_by_name (widget, "copy-clipboard");
}
}
#if WEBKIT_CHECK_VERSION (1, 1, 15)
-static void
-midori_web_view_set_clipboard (GtkWidget* widget,
- const gchar* text)
-{
- GdkDisplay* display = gtk_widget_get_display (widget);
- GtkClipboard* clipboard;
-
- clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_set_text (clipboard, text, -1);
- clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_PRIMARY);
- gtk_clipboard_set_text (clipboard, text, -1);
-}
-
static void
midori_web_view_menu_new_window_activate_cb (GtkWidget* widget,
MidoriView* view)
MidoriView* view)
{
if (g_str_has_prefix (view->link_uri, "mailto:"))
- midori_web_view_set_clipboard (widget, view->link_uri + 7);
+ sokoke_widget_copy_clipboard (widget, view->link_uri + 7);
else
- midori_web_view_set_clipboard (widget, view->link_uri);
+ sokoke_widget_copy_clipboard (widget, view->link_uri);
}
static void
MidoriView* view)
{
gchar* uri = katze_object_get_string (view->hit_test, "image-uri");
- midori_web_view_set_clipboard (widget, uri);
+ sokoke_widget_copy_clipboard (widget, uri);
g_free (uri);
}
MidoriView* view)
{
gchar* uri = katze_object_get_string (view->hit_test, "media-uri");
- midori_web_view_set_clipboard (widget, uri);
+ sokoke_widget_copy_clipboard (widget, uri);
g_free (uri);
}
midori_web_view_menu_copy_activate_cb (GtkWidget* widget,
MidoriView* view)
{
- midori_web_view_set_clipboard (widget, view->selected_text);
+ sokoke_widget_copy_clipboard (widget, view->selected_text);
}
#endif
items = g_list_append (items, item);
return NULL;
}
+
+void
+sokoke_widget_copy_clipboard (GtkWidget* widget,
+ const gchar* text)
+{
+ GdkDisplay* display = gtk_widget_get_display (widget);
+ GtkClipboard* clipboard;
+
+ clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text (clipboard, text, -1);
+ clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_PRIMARY);
+ gtk_clipboard_set_text (clipboard, text, -1);
+}