summaryrefslogtreecommitdiffstats
path: root/surf.c
diff options
context:
space:
mode:
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c58
1 files changed, 17 insertions, 41 deletions
diff --git a/surf.c b/surf.c
index 05c22ec..93111d4 100644
--- a/surf.c
+++ b/surf.c
@@ -105,7 +105,6 @@ static void sigchld(int unused);
static char *buildfile(const char *path);
static char *buildpath(const char *path);
static Client *newclient(Client *c);
-static void addaccelgroup(Client *c);
static void loaduri(Client *c, const Arg *a);
static const char *geturi(Client *c);
static void setatom(Client *c, int a, const char *v);
@@ -131,8 +130,6 @@ static WebKitWebView *newview(Client *c, WebKitWebView *rv);
static GtkWidget *createview(WebKitWebView *v, WebKitNavigationAction *a,
Client *c);
static gboolean buttonreleased(GtkWidget *w, GdkEvent *e, Client *c);
-static gboolean keypress(GtkAccelGroup *group, GObject *obj, guint key,
- GdkModifierType mods, Client *c);
static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event,
gpointer d);
static gboolean winevent(GtkWidget *w, GdkEvent *e, Client *c);
@@ -344,21 +341,6 @@ newclient(Client *rc)
}
void
-addaccelgroup(Client *c)
-{
- int i;
- GtkAccelGroup *group = gtk_accel_group_new();
- GClosure *closure;
-
- for (i = 0; i < LENGTH(keys); i++) {
- closure = g_cclosure_new(G_CALLBACK(keypress), c, NULL);
- gtk_accel_group_connect(group, keys[i].keyval, keys[i].mod, 0,
- closure);
- }
- gtk_window_add_accel_group(GTK_WINDOW(c->win), group);
-}
-
-void
loaduri(Client *c, const Arg *a)
{
struct stat st;
@@ -828,28 +810,6 @@ buttonreleased(GtkWidget *w, GdkEvent *e, Client *c)
return FALSE;
}
-gboolean
-keypress(GtkAccelGroup *group, GObject *obj, guint key, GdkModifierType mods,
- Client *c)
-{
- guint i;
- gboolean processed = FALSE;
-
- mods = CLEANMASK(mods);
- key = gdk_keyval_to_lower(key);
- updatewinid(c);
- for (i = 0; i < LENGTH(keys); i++) {
- if (key == keys[i].keyval
- && mods == keys[i].mod
- && keys[i].func) {
- keys[i].func(c, &(keys[i].arg));
- processed = TRUE;
- }
- }
-
- return processed;
-}
-
GdkFilterReturn
processx(GdkXEvent *e, GdkEvent *event, gpointer d)
{
@@ -878,11 +838,26 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d)
gboolean
winevent(GtkWidget *w, GdkEvent *e, Client *c)
{
+ int i;
+
switch (e->type) {
case GDK_ENTER_NOTIFY:
c->overtitle = c->targeturi;
updatetitle(c);
break;
+ case GDK_KEY_PRESS:
+ if (!kioskmode) {
+ for (i = 0; i < LENGTH(keys); ++i) {
+ if (gdk_keyval_to_lower(e->key.keyval) ==
+ keys[i].keyval &&
+ CLEANMASK(e->key.state) == keys[i].mod &&
+ keys[i].func) {
+ updatewinid(c);
+ keys[i].func(c, &(keys[i].arg));
+ return TRUE;
+ }
+ }
+ }
case GDK_LEAVE_NOTIFY:
c->overtitle = NULL;
updatetitle(c);
@@ -928,7 +903,6 @@ showview(WebKitWebView *v, Client *c)
webkit_web_view_set_background_color(c->view, &bgcolor);
if (!kioskmode) {
- addaccelgroup(c);
gdk_window_set_events(gwin, GDK_ALL_EVENTS_MASK);
gdk_window_add_filter(gwin, processx, c);
}
@@ -970,6 +944,8 @@ createwindow(Client *c)
G_CALLBACK(destroywin), c);
g_signal_connect(G_OBJECT(w), "enter-notify-event",
G_CALLBACK(winevent), c);
+ g_signal_connect(G_OBJECT(w), "key-press-event",
+ G_CALLBACK(winevent), c);
g_signal_connect(G_OBJECT(w), "leave-notify-event",
G_CALLBACK(winevent), c);
g_signal_connect(G_OBJECT(w), "window-state-event",
6b757ad4778d8cac81581905dad5f4e?s=13&d=retro' width='13' height='13' alt='Gravatar' /> BanceDev 2-4/+6 2024-09-12prevent lush workflow from getting stuck in testsGravatar Lance Borden 1-1/+4 2024-09-12removed chsh in workflowGravatar Lance Borden 1-4/+1 2f05008d42922&follow=1'>creating new process when opening new window if possible.Gravatar Enno Boland (tox) 1-13/+90 2009-10-14better useragent string (for google-* and stuff)Gravatar Enno Boland (tox) 1-1/+1 2009-10-14changing useragent.Gravatar Enno Boland (tox) 2-1/+2 2009-10-14uncommenting source()Gravatar Enno Boland (tox) 1-2/+2 2009-10-13removing loadfile. readding later in a simpler way.Gravatar Enno Boland (tox) 1-40/+2 2009-10-13removing debug outputGravatar Enno Boland (tox) 1-1/+0 2009-10-13fixing stupidy bug.Gravatar Enno Boland (tox) 1-1/+1 2009-10-13fixing memoryleak.Gravatar Enno Boland (tox) 1-2/+3 2009-10-13making config-files configurable in config.hGravatar Enno Boland (tox) 2-32/+46 2009-10-13small whitespacefix.Gravatar Enno Boland (tox) 1-1/+1 2009-10-07hooking onloadfunctions should be done by script.js.Gravatar Enno Boland (tox) 1-3/+0 2009-09-21commenting.Gravatar Enno Boland (tox) 1-0/+1 2009-09-21typoGravatar Enno Boland (tox) 1-2/+2 2009-09-17reformatingGravatar Enno Boland (tox) 1-2/+0 2009-09-17applied patch from arg. thanks :)Gravatar Enno Boland (tox) 2-66/+56 2009-09-16next version is 0.2Gravatar Enno Boland (tox) 1-1/+1 2009-09-16auto creation of script.jsGravatar Enno Boland (tox) 1-0/+3 2009-09-16adding user.js support.Gravatar Enno Boland (tox) 1-4/+22 2009-09-13usercss works again.Gravatar Enno Boland (tox) 1-10/+11 2009-09-11Added tag 0.1.2 for changeset bffb0c3c2341Gravatar Enno Boland (tox) 1-0/+1 2009-09-11next will be 0.1.2Gravatar Enno Boland (tox) 1-1/+1 2009-09-11Makefile fixingGravatar Enno Boland (tox) 2-2/+2 2009-09-11Adding README file.Gravatar Enno Boland (tox) 2-1/+26 2009-09-11unfocus should return false; renaming cookie-file.Gravatar Enno Boland (tox) 1-2/+2 2009-09-11surf embeds now itself into another window.Gravatar Enno Boland (tox) 1-8/+9 2009-09-10Added tag 0.1.1 for changeset 3ef997607115Gravatar Enno Boland (tox) 1-0/+1 2009-09-10bugfix releaseGravatar Enno Boland (tox) 1-1/+1 2009-09-10removing unneeded background color.Gravatar Enno Boland (tox) 1-1/+0 2009-09-10rearranging some source.Gravatar Enno Boland (tox) 1-12/+19 2009-09-10adding user stylesheets.Gravatar Enno Boland (tox) 1-10/+21 2009-09-10Added tag 0.1 for changeset 9c8ebcf54061Gravatar Enno Boland (tox) 1-0/+2 2009-09-10dist doesn't work. fixing Makefile.Gravatar Enno Boland (tox) 1-1/+1