From cdd1aec506ffd7089b8c708e0b8ecac9e4769a85 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Wed, 2 Apr 2014 09:45:39 +0200 Subject: [PATCH] Fixed none working open hints in new window (#74). There is already a hack to allow the hinting JavaScript to open a page also in a new window without user interaction (hinting in no user interaction in the manner of webkit). To allow to open hints into new window the webkit setting 'javascript-can-open-windows-automatically' is enabled. After fireing a hint, this is set back to it's initial value. But this seemed to be to early, what means we potentially disabled to open page in new window right before the new window was created. This patch moved the resetting of the option into the clear function, that should be late enough. --- src/hints.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hints.c b/src/hints.c index 4bfc51c..31f995d 100644 --- a/src/hints.c +++ b/src/hints.c @@ -108,6 +108,14 @@ void hints_clear(void) call_hints_function("clear", 0, NULL); g_signal_emit_by_name(vb.gui.webview, "hovering-over-link", NULL, NULL); + +#if WEBKIT_CHECK_VERSION(2, 0, 0) + /* if open window was not allowed for JavaScript, restore this */ + if (!hints.allow_open_win) { + WebKitWebSettings *setting = webkit_web_view_get_settings(vb.gui.webview); + g_object_set(G_OBJECT(setting), "javascript-can-open-windows-automatically", hints.allow_open_win, NULL); + } +#endif } } @@ -333,13 +341,5 @@ static gboolean call_hints_function(const char *func, int count, JSValueRef para } } g_free(value); - -#if WEBKIT_CHECK_VERSION(2, 0, 0) - /* if open window was not allowed for JavaScript, restore this */ - if (!hints.allow_open_win) { - WebKitWebSettings *setting = webkit_web_view_get_settings(vb.gui.webview); - g_object_set(G_OBJECT(setting), "javascript-can-open-windows-automatically", hints.allow_open_win, NULL); - } -#endif return true; } -- 2.20.1