summaryrefslogtreecommitdiff
path: root/src/dwb.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-11-22 17:31:16 +0100
committerportix <portix@gmx.net>2012-11-22 17:31:16 +0100
commit58996d0b8304580ebdfec1a0c48525335dd185a2 (patch)
treeea1a433ad40e4e1ddc339201ccda0700e99cd04e /src/dwb.c
parente863f00d4f292b9dea57534281a5d0830b34b563 (diff)
downloaddwb-58996d0b8304580ebdfec1a0c48525335dd185a2.zip
Always check for Shift-Insert in callback_key_press, fixes ignoring shift-insert in addressbar
Diffstat (limited to 'src/dwb.c')
-rw-r--r--src/dwb.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/dwb.c b/src/dwb.c
index a5ff5984..1f3c9464 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -814,13 +814,31 @@ dwb_paste_into_webview(GtkClipboard *clip, const char *text, GList *gl)
js_call_as_function(frame, VIEW(gl)->js_base, "pastePrimary", text, kJSTypeString, NULL);
}
}
+void
+dwb_paste_into_entry(GtkClipboard *clip, const char *text) {
+ char *buffer, *back;
+
+ buffer = back = g_strdup(text);
+ while (*buffer) {
+ if (*buffer == '\n' || *buffer == '\r')
+ *buffer = ' ';
+ buffer++;
+ }
+ entry_insert_text(back);
+ g_free(back);
+}
void
dwb_paste_primary() {
GtkClipboard *p_clip = gtk_widget_get_clipboard(CURRENT_WEBVIEW_WIDGET(), GDK_SELECTION_PRIMARY);
if (p_clip == NULL)
return;
- gtk_clipboard_request_text(p_clip, (GtkClipboardTextReceivedFunc)dwb_paste_into_webview, dwb.state.fview);
+ if (gtk_widget_has_focus(dwb.gui.entry)) {
+ gtk_clipboard_request_text(p_clip, (GtkClipboardTextReceivedFunc)dwb_paste_into_entry, NULL);
+ }
+ else {
+ gtk_clipboard_request_text(p_clip, (GtkClipboardTextReceivedFunc)dwb_paste_into_webview, dwb.state.fview);
+ }
}
/* dwb_scroll (Glist *gl, double step, ScrollDirection dir) {{{*/