summaryrefslogtreecommitdiff
path: root/src
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
parente863f00d4f292b9dea57534281a5d0830b34b563 (diff)
downloaddwb-58996d0b8304580ebdfec1a0c48525335dd185a2.zip
Always check for Shift-Insert in callback_key_press, fixes ignoring shift-insert in addressbar
Diffstat (limited to 'src')
-rw-r--r--src/callback.c17
-rw-r--r--src/dwb.c20
2 files changed, 20 insertions, 17 deletions
diff --git a/src/callback.c b/src/callback.c
index 91e2bdaa..3afa7c31 100644
--- a/src/callback.c
+++ b/src/callback.c
@@ -67,28 +67,13 @@ callback_entry_key_press(GtkWidget* entry, GdkEventKey *e) {
gboolean ret = false;
gboolean complete = (mode == DOWNLOAD_GET_PATH || (mode & COMPLETE_PATH));
gboolean set_text = false;
- char *text = NULL;
- char *buffer, *back;
+
if (dwb.state.mode & QUICK_MARK_OPEN)
set_text = true;
/* Handled by activate-callback */
if (e->keyval == GDK_KEY_Return)
return dwb_entry_activate(e);
/* Insert primary selection on shift-insert */
- if (e->keyval == GDK_KEY_Insert && e->state == GDK_SHIFT_MASK) {
- if ((text = dwb_clipboard_get_text(GDK_SELECTION_PRIMARY))) {
- buffer = back = g_strdup(text);
- while (*buffer) {
- if (*buffer == '\n' || *buffer == '\r')
- *buffer = ' ';
- buffer++;
- }
- entry_insert_text(back);
- g_free(back);
- FREE0(text);
- }
- return true;
- }
if (mode == QUICK_MARK_SAVE)
return false;
else if (mode & COMPLETE_BUFFER) {
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) {{{*/