diff -pru dillo-cli/src/commands.c dillo-xid/src/commands.c --- dillo-cli/src/commands.c Tue Aug 6 17:24:05 2002 +++ dillo-xid/src/commands.c Tue Aug 6 18:36:48 2002 @@ -42,7 +42,7 @@ void a_Commands_new_callback(GtkWidget * BrowserWindow *bw = (BrowserWindow *)client_data; a_Interface_browser_window_new(bw->main_window->allocation.width, - bw->main_window->allocation.height); + bw->main_window->allocation.height, 0); } /* @@ -386,7 +386,7 @@ void a_Commands_open_link_nw_callback(Gt BrowserWindow *newbw; gdk_window_get_size (bw->main_window->window, &width, &height); - newbw = a_Interface_browser_window_new(width, height); + newbw = a_Interface_browser_window_new(width, height, 0); a_Nav_push(newbw, a_Menu_popup_get_url(bw)); } diff -pru dillo-cli/src/dillo.c dillo-xid/src/dillo.c --- dillo-cli/src/dillo.c Tue Aug 6 18:18:38 2002 +++ dillo-xid/src/dillo.c Tue Aug 6 19:05:26 2002 @@ -50,15 +50,17 @@ #define DILLO_CLI_HELP_MESSAGE \ "\nUsage: dillo [OPTIONS] [URL|FILE]...\n" \ "Options:\n" \ + " -x XID open first Dillo window in an existing GtkSocket which ID is XID.\n" \ " -h display this help message and exit.\n" \ " -v display version info and exit.\n" \ " URL URL to browse.\n" \ " FILE local FILE to view.\n" -#define DILLO_CLI_OPTIONS "hv" +#define DILLO_CLI_OPTIONS "hvx:" #define DILLO_CLI_HELP 1 << 0 #define DILLO_CLI_VERSION 1 << 1 +#define DILLO_CLI_XID 1 << 4 /* * Forward declarations @@ -78,6 +80,7 @@ gint main(int argc, char *argv[]) BrowserWindow *bw; int c; guint32 cli_option = 0; + guint32 xid = 0; /* This lets threads in the file module end peacefully when aborted * todo: implement a cleaner mechanism (in file.c) */ @@ -98,6 +101,10 @@ gint main(int argc, char *argv[]) Dillo_print_version(); return 0; break; + case 'x': + cli_option |= DILLO_CLI_XID; + xid = strtol(optarg, NULL, 10); + break; default: printf("Unknown option.\n"); Dillo_print_help(); @@ -125,7 +132,11 @@ gint main(int argc, char *argv[]) /* a_Nav_init() has been moved into this call because it needs to be * initialized with the new browser_window structure */ - bw = a_Interface_browser_window_new(prefs.width, prefs.height); + bw = a_Interface_browser_window_new(prefs.width, prefs.height, xid); + + /* Only the first window can be embedded in the GtkSocket, + * thus reset xid now. */ + xid = 0; a_Bookmarks_init(); @@ -136,7 +147,7 @@ gint main(int argc, char *argv[]) for (c = optind; c < argc; c++) { if (c > optind) - bw = a_Interface_browser_window_new(prefs.width, prefs.height); + bw = a_Interface_browser_window_new(prefs.width, prefs.height, xid); if (access(argv[c], F_OK) == 0) { GString *UrlStr = g_string_sized_new(128); diff -pru dillo-cli/src/interface.c dillo-xid/src/interface.c --- dillo-cli/src/interface.c Tue Aug 6 17:24:42 2002 +++ dillo-xid/src/interface.c Tue Aug 6 18:36:55 2002 @@ -565,7 +565,8 @@ static int Interface_click_callback(Brow * Create a new browser window and return it. * (the new window is stored in browser_window[]) */ -BrowserWindow *a_Interface_browser_window_new(gint width, gint height) +BrowserWindow *a_Interface_browser_window_new(gint width, gint height, + guint32 xid) { GtkWidget *box1, *box2, *hbox, *progbox, *toolbar, *handlebox, *menubar, *locbox; @@ -574,14 +575,16 @@ BrowserWindow *a_Interface_browser_windo /* We use g_new0() to zero the memory */ bw = g_new0(BrowserWindow, 1); - a_List_add(browser_window, num_bw, num_bw_max); browser_window[num_bw++] = bw; /* initialize nav_stack struct in browser_window struct */ a_Nav_init(bw); - bw->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + if (!xid) + bw->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + else + bw->main_window = gtk_plug_new(xid); gtk_window_set_policy(GTK_WINDOW(bw->main_window), TRUE, TRUE, FALSE); gtk_signal_connect(GTK_OBJECT(bw->main_window), "delete_event", diff -pru dillo-cli/src/interface.h dillo-xid/src/interface.h --- dillo-cli/src/interface.h Tue Aug 6 17:24:42 2002 +++ dillo-xid/src/interface.h Tue Aug 6 18:36:59 2002 @@ -28,7 +28,8 @@ gchar *a_Interface_get_location_text(Bro void a_Interface_reset_progress_bars(BrowserWindow *bw); void a_Interface_entry_open_url(GtkWidget *widget, BrowserWindow *bw); void a_Interface_set_cursor(BrowserWindow *bw, GdkCursorType CursorType); -BrowserWindow *a_Interface_browser_window_new(gint width, gint height); +BrowserWindow *a_Interface_browser_window_new(gint width, gint height, + guint32 xid); void a_Interface_set_button_sens(BrowserWindow *bw);