summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-11-17 15:38:52 +0100
committerportix <portix@gmx.net>2012-11-17 15:38:52 +0100
commita96bbee0345af08002cc601ca9058e1108d7c29b (patch)
tree213f4fc6aaad0a1e77f518834dcf54c573485215 /src
parent5cbbd98a840530e2945af98268ec47ccaf3ded22 (diff)
downloaddwb-a96bbee0345af08002cc601ca9058e1108d7c29b.zip
Use asynchronous clipboard function for dwb_paste_primary
Diffstat (limited to 'src')
-rw-r--r--src/dwb.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/dwb.c b/src/dwb.c
index 24ee636a..9c9d9242 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -806,16 +806,21 @@ dwb_set_clipboard(const char *text, GdkAtom atom) {
return ret;
}/*}}}*/
+void
+dwb_paste_into_webview(GtkClipboard *clip, const char *text, GList *gl)
+{
+ if (text != NULL) {
+ WebKitWebFrame *frame = webkit_web_view_get_focused_frame(WEBVIEW(gl));
+ js_call_as_function(frame, VIEW(gl)->js_base, "pastePrimary", text, kJSTypeString, NULL);
+ }
+}
+
void
dwb_paste_primary() {
GtkClipboard *p_clip = gtk_widget_get_clipboard(CURRENT_WEBVIEW_WIDGET(), GDK_SELECTION_PRIMARY);
if (p_clip == NULL)
return;
- char *p_text = gtk_clipboard_wait_for_text(p_clip);
- if (p_text != NULL) {
- js_call_as_function(FOCUSED_FRAME(), CURRENT_VIEW()->js_base, "pastePrimary", p_text, kJSTypeString, NULL);
- }
- g_free(p_text);
+ gtk_clipboard_request_text(p_clip, (GtkClipboardTextReceivedFunc)dwb_paste_into_webview, dwb.state.fview);
}
/* dwb_scroll (Glist *gl, double step, ScrollDirection dir) {{{*/