merge
This commit is contained in:
commit
2d9716907d
27
surf.c
27
surf.c
|
@ -28,6 +28,7 @@ typedef struct Client {
|
||||||
gint progress;
|
gint progress;
|
||||||
struct Client *next;
|
struct Client *next;
|
||||||
} Client;
|
} Client;
|
||||||
|
SoupCookieJar *cookiejar;
|
||||||
Client *clients = NULL;
|
Client *clients = NULL;
|
||||||
gboolean embed = FALSE;
|
gboolean embed = FALSE;
|
||||||
gboolean showxid = FALSE;
|
gboolean showxid = FALSE;
|
||||||
|
@ -185,7 +186,7 @@ keypress(GtkWidget* w, GdkEventKey *ev, gpointer d) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ev->state == GDK_CONTROL_MASK || ev->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) {
|
else if(ev->state == GDK_CONTROL_MASK || ev->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) {
|
||||||
switch(ev->keyval) {
|
switch(ev->keyval) {
|
||||||
case GDK_r:
|
case GDK_r:
|
||||||
case GDK_R:
|
case GDK_R:
|
||||||
|
@ -210,6 +211,16 @@ keypress(GtkWidget* w, GdkEventKey *ev, gpointer d) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
switch(ev->keyval) {
|
||||||
|
case GDK_k:
|
||||||
|
webkit_web_view_move_cursor(c->view, GTK_MOVEMENT_DISPLAY_LINES, -1);
|
||||||
|
return TRUE;
|
||||||
|
case GDK_j:
|
||||||
|
webkit_web_view_move_cursor(c->view, GTK_MOVEMENT_DISPLAY_LINES, 1);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +271,7 @@ loadfile(const Client *c, const gchar *f) {
|
||||||
g_string_prepend(uri, "file://");
|
g_string_prepend(uri, "file://");
|
||||||
loaduri(c, uri->str);
|
loaduri(c, uri->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -367,7 +378,7 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) {
|
||||||
if(((XEvent *)e)->type == PropertyNotify) {
|
if(((XEvent *)e)->type == PropertyNotify) {
|
||||||
ev = &((XEvent *)e)->xproperty;
|
ev = &((XEvent *)e)->xproperty;
|
||||||
if(ignore_once == FALSE && ev->atom == urlprop && ev->state == PropertyNewValue) {
|
if(ignore_once == FALSE && ev->atom == urlprop && ev->state == PropertyNewValue) {
|
||||||
XGetWindowProperty(dpy, ev->window, urlprop, 0L, BUFSIZ, False, XA_STRING,
|
XGetWindowProperty(dpy, ev->window, urlprop, 0L, BUFSIZ, False, XA_STRING,
|
||||||
&adummy, &idummy, &ldummy, &ldummy, &buf);
|
&adummy, &idummy, &ldummy, &ldummy, &buf);
|
||||||
loaduri(c, (gchar *)buf);
|
loaduri(c, (gchar *)buf);
|
||||||
XFree(buf);
|
XFree(buf);
|
||||||
|
@ -422,8 +433,10 @@ updatetitle(Client *c) {
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
gchar *uri = NULL, *file = NULL;
|
gchar *uri = NULL, *file = NULL;
|
||||||
|
SoupSession *s;
|
||||||
Client *c;
|
Client *c;
|
||||||
int o;
|
int o;
|
||||||
|
const gchar *home, *filename;
|
||||||
|
|
||||||
gtk_init(NULL, NULL);
|
gtk_init(NULL, NULL);
|
||||||
if (!g_thread_supported())
|
if (!g_thread_supported())
|
||||||
|
@ -465,6 +478,14 @@ int main(int argc, char *argv[]) {
|
||||||
goto argerr;
|
goto argerr;
|
||||||
if(!clients)
|
if(!clients)
|
||||||
newclient();
|
newclient();
|
||||||
|
|
||||||
|
/* cookie persistance */
|
||||||
|
s = webkit_get_default_session();
|
||||||
|
home = g_get_home_dir();
|
||||||
|
filename = g_build_filename(home, ".surf-cookies", NULL);
|
||||||
|
cookiejar = soup_cookie_jar_text_new(filename, FALSE);
|
||||||
|
soup_session_add_feature(s, SOUP_SESSION_FEATURE(cookiejar));
|
||||||
|
|
||||||
gtk_main();
|
gtk_main();
|
||||||
cleanup();
|
cleanup();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue