surf embeds now itself into another window.

This commit is contained in:
Enno Boland (tox) 2009-09-11 07:21:18 +02:00
parent c023780eda
commit 38a098c81d

17
surf.c
View file

@ -64,7 +64,7 @@ SoupCookieJar *cookiejar;
SoupSession *session; SoupSession *session;
Client *clients = NULL; Client *clients = NULL;
Cookie *cookies = NULL; Cookie *cookies = NULL;
gboolean embed = FALSE; GdkNativeWindow embed = 0;
gboolean showxid = FALSE; gboolean showxid = FALSE;
gboolean ignore_once = FALSE; gboolean ignore_once = FALSE;
gchar *workdir; gchar *workdir;
@ -380,7 +380,7 @@ newclient(void) {
die("Cannot malloc!\n"); die("Cannot malloc!\n");
/* Window */ /* Window */
if(embed) { if(embed) {
c->win = gtk_plug_new(0); c->win = gtk_plug_new(embed);
} }
else { else {
c->win = gtk_window_new(GTK_WINDOW_TOPLEVEL); c->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@ -669,7 +669,7 @@ unfocusbar(GtkWidget *w, GdkEventFocus *e, Client *c) {
void void
usage(void) { usage(void) {
fputs("surf - simple browser\n", stderr); fputs("surf - simple browser\n", stderr);
die("usage: surf [-e] [-x] [uri]\n"); die("usage: surf [-e Window] [-x] [uri]\n");
} }
void void
@ -698,21 +698,21 @@ zoom(Client *c, const Arg *arg) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
Client *c; Client *c;
gint o; gint o, a;
Arg arg; Arg arg;
gtk_init(NULL, NULL); gtk_init(NULL, NULL);
if (!g_thread_supported()) if (!g_thread_supported())
g_thread_init(NULL); g_thread_init(NULL);
setup(); while((o = getopt(argc, argv, "vhxe:")) != -1)
while((o = getopt(argc, argv, "vhxeu:f:")) != -1)
switch(o) { switch(o) {
case 'x': case 'x':
showxid = TRUE; showxid = TRUE;
break; break;
case 'e': case 'e':
showxid = TRUE; if(!(a = atoi(optarg)))
embed = TRUE; usage();
embed = a;
break; break;
case 'v': case 'v':
die("surf-"VERSION", © 2009 surf engineers, see LICENSE for details\n"); die("surf-"VERSION", © 2009 surf engineers, see LICENSE for details\n");
@ -731,6 +731,7 @@ int main(int argc, char *argv[]) {
} }
else if(optind != argc) else if(optind != argc)
usage(); usage();
setup();
if(!clients) if(!clients)
newclient(); newclient();