-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jorge Arellano Cid wrote: | | I understand. Maybe the "canonical" solution to this problem is | to add support for the geometry CLI option. | | That is: | | -geometry <width>x<height>{+-}<x>{+-}<y> | | Can you make the patch this way? | Here is a preliminary version. Only problem is that entering it in the dillorc doesn't work, because the parser doesn't recognize the + as part of a string resulting in these errors: dillorc:2: unexpected character `+', expected symbol dillorc:2: unexpected character `0', expected symbol dillorc:2: unexpected character `+', expected symbol dillorc:2: unexpected character `0', expected symbol dillorc:2: error: unexpected character `0', expected symbol So I tried changing - - "~-_:&%#/.0123456789" + "~-_:&%#/.0123456789+" in prefs.c, which doesn't work. How the parse be changed that it recognizes + as part of the value? Thanks, Jan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQE/ygYdLqMJRclVKIYRApfZAJ4jb1fc3Dd8OrMB+Csgyekz74VikwCfaFv5 s7AZVApr+hS8dRtKK97kS0Y= =axoU -----END PGP SIGNATURE----- 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 15:59:29 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,11 @@ case DILLO_CLI_FULLWINDOW: case DILLO_CLI_LOCAL: break; + case DILLO_CLI_GEOMETRY: + if ( XParseGeometry(opt_argv[0], &xpos, &ypos, &width, &height) ) { + g_print("Setting geometry from CLI to %dx%d %d %d\n", width, height, xpos, ypos); + break; + } default: g_print("Error in command line options.\n"); return -1; @@ -265,9 +277,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 16:00:14 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,9 @@ /* 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); + g_print("Setting geometry from rc to %dx%d %d %d\n", prefs.width, prefs.height, prefs.xpos, prefs.ypos); } break; case DRC_TOKEN_PROXY: @@ -261,7 +258,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 +326,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;