diff options
author | Karel Kočí <cynerd@email.cz> | 2019-09-30 11:20:52 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2019-09-30 11:20:52 +0200 |
commit | e9bbc58fe1b54567738bc2720cd0332feb9ff3e2 (patch) | |
tree | 97f483d4912dfa1ad8adf839ba44ea4793c44ef6 /surf.c | |
parent | 15facd86d007d6295cd7a03fecfcf5cba14cd59f (diff) | |
download | surf-e9bbc58fe1b54567738bc2720cd0332feb9ff3e2.tar.gz surf-e9bbc58fe1b54567738bc2720cd0332feb9ff3e2.tar.bz2 surf-e9bbc58fe1b54567738bc2720cd0332feb9ff3e2.zip |
Add surf-pass to access user names and passwords from surf
Diffstat (limited to 'surf.c')
-rw-r--r-- | surf.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -35,7 +35,7 @@ #define LENGTH(x) (sizeof(x) / sizeof(x[0])) #define CLEANMASK(mask) (mask & (MODKEY|GDK_SHIFT_MASK)) -enum { AtomFind, AtomGo, AtomUri, AtomLast }; +enum { AtomFind, AtomGo, AtomUri, AtomActiveValue, AtomLast }; enum { OnDoc = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT, @@ -173,6 +173,7 @@ static void handleplumb(Client *c, const char *uri); static void newwindow(Client *c, const Arg *a, int noembed); static void spawn(Client *c, const Arg *a); static void msgext(Client *c, char type, const Arg *a); +static void activeval(Client *c, const Arg *a); static void destroyclient(Client *c); static void cleanup(void); @@ -328,6 +329,7 @@ setup(void) atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False); atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False); atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False); + atoms[AtomActiveValue] = XInternAtom(dpy, "_SURF_ACTIVE_VALUE", False); gtk_init(NULL, NULL); @@ -1049,6 +1051,14 @@ spawn(Client *c, const Arg *a) } void +activeval(Client *c, const Arg *a) +{ + const char *value = a->v; + + evalscript(c, "document.activeElement.value = '%s';", value); +} + +void destroyclient(Client *c) { Client *p; @@ -1317,6 +1327,12 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) loaduri(c, &a); return GDK_FILTER_REMOVE; + } else if (ev->atom == atoms[AtomActiveValue]) { + a.v = getatom(c, AtomActiveValue); + if (*(char*)a.v != '\0') + activeval(c, &a); + + return GDK_FILTER_REMOVE; } } } |