aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
authorGravatar dusanx <ef_dva@yahoo.com>2009-04-26 03:40:21 +0200
committerGravatar dusanx <ef_dva@yahoo.com>2009-04-26 03:40:21 +0200
commit90f1492466a819bbb939a4f56a025eaf5c03a1b3 (patch)
tree07215db1c950d6a79319cd0f18b5485e35be6422 /uzbl.c
parent1a3b99d98d32f3699603f7cad1f74d9b19d3204a (diff)
Rough key processing
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/uzbl.c b/uzbl.c
index 127f392..34a3404 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -290,6 +290,38 @@ update_title (GtkWindow* window) {
g_free (title);
}
+
+static void
+MsgBox (const char *s) {
+ GtkWidget* dialog = gtk_message_dialog_new (main_window,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", s);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+}
+
+
+static gboolean
+key_press_cb (WebKitWebView* page, GdkEventKey* event)
+{
+ int i;
+ gboolean result=FALSE; //TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
+ if (event->type != GDK_KEY_PRESS)
+ return(result);
+
+ for (i = 0; i < num_internal_bindings; i++) {
+ if (event->string[0] == internal_bindings[i].binding[0]) {
+ parse_command(internal_bindings[i].action);
+ result = FALSE;
+ }
+ }
+
+ return(result);
+}
+
+
static GtkWidget*
create_browser () {
GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@@ -303,6 +335,7 @@ create_browser () {
g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (log_history_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
+ g_signal_connect (G_OBJECT (web_view), "key-press-event", G_CALLBACK(key_press_cb), web_view);
return scrolled_window;
}