Client *c);
static void on_webview_ready_to_show(WebKitWebView *webview, Client *c);
static gboolean on_webview_web_process_crashed(WebKitWebView *webview, Client *c);
+static gboolean on_webview_authenticate(WebKitWebView *webview,
+ WebKitAuthenticationRequest *request, Client *c);
static gboolean on_window_delete_event(GtkWidget *window, GdkEvent *event, Client *c);
static void on_window_destroy(GtkWidget *window, Client *c);
static gboolean quit(Client *c);
break;
case WEBKIT_LOAD_COMMITTED:
+ /* In case of HTTP authentication request we ignore the focus
+ * changes so that the input mode can be set for the
+ * authentication request. If the authentication dialog is filled
+ * or aborted the load will be commited. So this seems to be the
+ * right place to remove the flag. */
+ c->mode->flags &= ~FLAG_IGNORE_FOCUS;
uri = webkit_web_view_get_uri(webview);
#ifdef FEATURE_AUTOCMD
autocmd_run(c, AU_LOAD_COMMITTED, uri, NULL);
return TRUE;
}
+/**
+ * Callback in case HTTP authentication is requested by the server.
+ */
+static gboolean on_webview_authenticate(WebKitWebView *webview,
+ WebKitAuthenticationRequest *request, Client *c)
+{
+ /* Don't change the mode if we are in pass through mode. */
+ if (c->mode->id == 'n') {
+ vb_enter(c, 'i');
+ /* Make sure we do not switch back to normal mode in case a previos
+ * page is open and looses the focus. */
+ c->mode->flags |= FLAG_IGNORE_FOCUS;
+ }
+ return FALSE;
+}
+
/**
* Callback for window ::delete-event signal which is emitted if a user
* requests that a toplevel window is closed. The default handler for this
"signal::notify::uri", G_CALLBACK(on_webview_notify_uri), c,
"signal::ready-to-show", G_CALLBACK(on_webview_ready_to_show), c,
"signal::web-process-crashed", G_CALLBACK(on_webview_web_process_crashed), c,
+ "signal::authenticate", G_CALLBACK(on_webview_authenticate), c,
NULL
);
g_variant_unref(variant);
c = vb_get_client_for_page_id(pageid);
- if (!c) {
+ if (!c || c->mode->flags & FLAG_IGNORE_FOCUS) {
return;
}
ModeTransitionFunc leave; /* is called if the mode is left */
ModeKeyFunc keypress; /* receives key to process */
ModeInputChangedFunc input_changed; /* is triggered if input textbuffer is changed */
-#define FLAG_NOMAP 0x0001 /* disables mapping for key strokes */
-#define FLAG_HINTING 0x0002 /* marks active hinting submode */
-#define FLAG_COMPLETION 0x0004 /* marks active completion submode */
-#define FLAG_PASSTHROUGH 0x0008 /* don't handle any other keybind than <esc> */
-#define FLAG_NEW_WIN 0x0010 /* enforce opening of pages into new window */
+#define FLAG_NOMAP 0x0001 /* disables mapping for key strokes */
+#define FLAG_HINTING 0x0002 /* marks active hinting submode */
+#define FLAG_COMPLETION 0x0004 /* marks active completion submode */
+#define FLAG_PASSTHROUGH 0x0008 /* don't handle any other keybind than <esc> */
+#define FLAG_NEW_WIN 0x0010 /* enforce opening of pages into new window */
+#define FLAG_IGNORE_FOCUS 0x0012 /* do not listen for focus change messages */
unsigned int flags;
};