From: Mikael Magnusson Date: Thu, 19 Feb 2004 14:33:59 +0000 (+0000) Subject: add setting num to set which desktop to start on, also fix... X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=77af27b8b23024231d3c013c45c7a9ce77aeda53;p=chaz%2Fopenbox add setting num to set which desktop to start on, also fix a guint that should be gint. (used to let you say you want negative number of desktops) --- diff --git a/openbox/config.c b/openbox/config.c index a3c0034a..d362324c 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -37,6 +37,7 @@ gchar *config_title_layout; gint config_desktops_num; GSList *config_desktops_names; +gint config_screen_firstdesk; gboolean config_redraw_resize; @@ -247,10 +248,15 @@ static void parse_desktops(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, node = node->children; if ((n = parse_find_node("number", node))) { - guint d = parse_int(doc, n); + gint d = parse_int(doc, n); if (d > 0) config_desktops_num = d; } + if ((n = parse_find_node("firstdesk", node))) { + gint d = parse_int(doc, n); + if (d > 0) + config_screen_firstdesk = d; + } if ((n = parse_find_node("names", node))) { GSList *it; xmlNodePtr nname; @@ -502,6 +508,7 @@ void config_startup(ObParseInst *i) parse_register(i, "theme", parse_theme, NULL); config_desktops_num = 4; + config_screen_firstdesk = 1; config_desktops_names = NULL; parse_register(i, "desktops", parse_desktops, NULL); diff --git a/openbox/config.h b/openbox/config.h index 88127626..4d3f3e5e 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -74,6 +74,8 @@ extern gchar *config_title_layout; /*! The number of desktops */ extern gint config_desktops_num; +/*! Desktop to start on, put 5 to start in the center of a 3x3 grid */ +extern gint config_screen_firstdesk; /*! Names for the desktops */ extern GSList *config_desktops_names; diff --git a/openbox/screen.c b/openbox/screen.c index 810d66b1..ef791bad 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -295,7 +295,7 @@ void screen_startup(gboolean reconfig) screen_num_desktops = 0; screen_set_num_desktops(config_desktops_num); if (!reconfig) { - screen_set_desktop(0); + screen_set_desktop(MIN(config_screen_firstdesk, screen_num_desktops) - 1); /* don't start in showing-desktop mode */ screen_showing_desktop = FALSE;