Eric GAUDET wrote:
It works for me with today's CVS and your patch.
in dillorc: geometry=320x200+50+50
dillo.pos/src>./dillo Setting geometry from rc to 320x200 50 50 ...
The only problem, it seems, is that it still prints the dillorc setting, even when the CLI option is used:
dillo.pos/src>./dillo -geometry 700x100+10+400 Setting geometry from CLI to 700x100 10 400 Setting geometry from rc to 320x200 50 50 ...
The first one is actually used, but having the second message is confusing.
Those can probably both go entirely. It was more for debug uses. Here is an updated patch with those removed. Jan Common subdirectories: org/src/IO and jan/src/IO diff -u org/src/dillo.c jan/src/dillo.c --- org/src/dillo.c Tue Jul 22 22:51:22 2003 +++ jan/src/dillo.c Sun Nov 30 22:48:24 2003 @@ -21,6 +21,7 @@ #include <stdio.h> #include <gtk/gtk.h> +#include <X11/Xlib.h> #include <sys/types.h> #include <sys/stat.h> @@ -66,6 +67,7 @@ DILLO_CLI_HELP = 1 << 3, DILLO_CLI_VERSION = 1 << 4, DILLO_CLI_LOCAL = 1 << 5, + DILLO_CLI_GEOMETRY = 1 << 6, DILLO_CLI_ERROR = 1 << 31 }; @@ -98,6 +100,9 @@ " -f, --fullwindow Start in full window mode."}, {"-l", "--local", 0, DILLO_CLI_LOCAL, " -l, --local Don't follow links for this URL(s)."}, + {"-g", "-geometry", 1, DILLO_CLI_GEOMETRY, + " -g, -geometry GEO Set initial window position where GEO is\n" + " <width>x<height>{+-}<x>{+-}<y>"}, {NULL, NULL, 0, 0, NULL} }; @@ -194,6 +199,8 @@ guint opt_flg; gint i; char **opt_argv = NULL; + gint xpos = D_GEOMETRY_DEFAULT_XPOS, ypos = D_GEOMETRY_DEFAULT_YPOS; + gint width = D_GEOMETRY_DEFAULT_WIDTH, height = D_GEOMETRY_DEFAULT_HEIGHT; /* set locale */ curr_locale = g_strdup(setlocale(LC_ALL, NULL)); @@ -226,6 +233,9 @@ case DILLO_CLI_FULLWINDOW: case DILLO_CLI_LOCAL: break; + case DILLO_CLI_GEOMETRY: + if ( XParseGeometry(opt_argv[0], &xpos, &ypos, &width, &height) ) + break; default: g_print("Error in command line options.\n"); return -1; @@ -265,9 +275,18 @@ if (options_got & DILLO_CLI_FULLWINDOW) prefs.fullwindow_start = TRUE; + /* override dillorc geometry */ + if (options_got & DILLO_CLI_GEOMETRY) { + prefs.width = width; + prefs.height = height; + prefs.xpos = xpos; + prefs.ypos = ypos; + } /* 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, xid); + if ( (prefs.xpos != D_GEOMETRY_DEFAULT_XPOS) && (prefs.ypos != D_GEOMETRY_DEFAULT_YPOS) ) + gtk_widget_set_uposition(bw->main_window, prefs.xpos, prefs.ypos); a_Bookmarks_init(); diff -u org/src/prefs.c jan/src/prefs.c --- org/src/prefs.c Mon Jul 7 17:40:15 2003 +++ jan/src/prefs.c Sun Nov 30 22:48:36 2003 @@ -19,6 +19,8 @@ */ #include <glib.h> +#include <gtk/gtk.h> +#include <X11/Xlib.h> #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> @@ -104,14 +106,8 @@ /* assign value and exit successfully */ switch (symbol) { case DRC_TOKEN_GEOMETRY: { - gchar *ptr, *str = scanner->value.v_string; - gint width, height; - - if ( (ptr = strchr(str, 'x')) && (width = strtol(str,NULL,10)) && - (height = strtol(++ptr,NULL,10)) ){ - prefs.width = width; - prefs.height = height; - } + gchar *str = scanner->value.v_string; + XParseGeometry(str, &prefs.xpos, &prefs.ypos, &prefs.width, &prefs.height); } break; case DRC_TOKEN_PROXY: @@ -261,7 +257,7 @@ /* Specifies the chars which can be used in identifiers */ scanner->config->cset_identifier_nth = ( G_CSET_a_2_z - "~-_:&%#/.0123456789" + "~-_:&%#/.0123456789+" G_CSET_A_2_Z G_CSET_LATINS /*??? I don't know if we need these two */ G_CSET_LATINC /*??? */ @@ -329,6 +325,8 @@ prefs.width = D_GEOMETRY_DEFAULT_WIDTH; prefs.height = D_GEOMETRY_DEFAULT_HEIGHT; + prefs.xpos = D_GEOMETRY_DEFAULT_XPOS; + prefs.ypos = D_GEOMETRY_DEFAULT_YPOS; prefs.http_proxy = NULL; prefs.no_proxy = NULL; prefs.no_proxy_vec = NULL; diff -u org/src/prefs.h jan/src/prefs.h --- org/src/prefs.h Thu Jul 10 00:00:34 2003 +++ jan/src/prefs.h Sun Nov 30 15:29:57 2003 @@ -10,6 +10,8 @@ #define DILLO_HOME "http://www.dillo.org/" #define D_GEOMETRY_DEFAULT_WIDTH 640 #define D_GEOMETRY_DEFAULT_HEIGHT 550 +#define D_GEOMETRY_DEFAULT_XPOS -9999 +#define D_GEOMETRY_DEFAULT_YPOS -9999 #define DW_COLOR_DEFAULT_GREY 0xd6d6d6 #define DW_COLOR_DEFAULT_BLACK 0x000000 @@ -70,6 +72,8 @@ struct _DilloPrefs { gint width; gint height; + gint xpos; + gint ypos; DilloUrl *http_proxy; gchar *no_proxy; gchar **no_proxy_vec;