X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fopenbox.c;h=277294d0c09c28f5bf0092e38a6edc7678dc24b0;hb=c313b219a226c3b968ff312b96120eef0c527d91;hp=ff226af4dcf30a72b815e08170d8247f59b3a0c0;hpb=1789d4564514c4cefe3d2e9d2b7b65119784b53c;p=chaz%2Fopenbox diff --git a/openbox/openbox.c b/openbox/openbox.c index ff226af4..277294d0 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -36,6 +36,7 @@ #include "focus_cycle_popup.h" #include "moveresize.h" #include "frame.h" +#include "framerender.h" #include "keyboard.h" #include "mouse.h" #include "extensions.h" @@ -43,7 +44,9 @@ #include "grab.h" #include "group.h" #include "config.h" +#include "ping.h" #include "mainloop.h" +#include "prompt.h" #include "gettext.h" #include "parser/parse.h" #include "render/render.h" @@ -105,6 +108,7 @@ static KeyCode keys[OB_NUM_KEYS]; static gint exitcode = 0; static guint remote_control = 0; static gboolean being_replaced = FALSE; +static gchar *config_file = NULL; static void signal_handler(gint signal, gpointer data); static void remove_args(gint *argc, gchar **argv, gint index, gint num); @@ -192,7 +196,7 @@ gint main(gint argc, gchar **argv) /* set the DISPLAY environment variable for any lauched children, to the display we're using, so they open in the right place. */ - putenv(g_strdup_printf("DISPLAY=%s", DisplayString(ob_display))); + setenv("DISPLAY", DisplayString(ob_display), TRUE); /* create available cursors */ cursors[OB_CURSOR_NONE] = None; @@ -244,17 +248,26 @@ gint main(gint argc, gchar **argv) config_startup(i); /* parse/load user options */ - if (parse_load_rc(NULL, &doc, &node)) { + if (parse_load_rc(config_file, &doc, &node)) { parse_tree(i, doc, node->xmlChildrenNode); parse_close(doc); - } else + } + else { g_message(_("Unable to find a valid config file, using some simple defaults")); + config_file = NULL; + } -/* - if (config_type != NULL) - PROP_SETS(RootWindow(ob_display, ob_screen), - ob_config, config_type); -*/ + if (config_file) { + gchar *p = g_filename_to_utf8(config_file, -1, + NULL, NULL, NULL); + if (p) + PROP_SETS(RootWindow(ob_display, ob_screen), + ob_config_file, p); + g_free(p); + } + else + PROP_ERASE(RootWindow(ob_display, ob_screen), + ob_config_file); /* we're done with parsing now, kill it */ parse_shutdown(i); @@ -292,15 +305,17 @@ gint main(gint argc, gchar **argv) event_startup(reconfigure); /* focus_backup is used for stacking, so this needs to come before anything that calls stacking_add */ + sn_startup(reconfigure); + window_startup(reconfigure); focus_startup(reconfigure); focus_cycle_startup(reconfigure); focus_cycle_indicator_startup(reconfigure); focus_cycle_popup_startup(reconfigure); - window_startup(reconfigure); - sn_startup(reconfigure); screen_startup(reconfigure); grab_startup(reconfigure); group_startup(reconfigure); + ping_startup(reconfigure); + prompt_startup(reconfigure); client_startup(reconfigure); dock_startup(reconfigure); moveresize_startup(reconfigure); @@ -360,6 +375,8 @@ gint main(gint argc, gchar **argv) moveresize_shutdown(reconfigure); dock_shutdown(reconfigure); client_shutdown(reconfigure); + prompt_shutdown(reconfigure); + ping_shutdown(reconfigure); group_shutdown(reconfigure); grab_shutdown(reconfigure); screen_shutdown(reconfigure); @@ -367,8 +384,8 @@ gint main(gint argc, gchar **argv) focus_cycle_indicator_shutdown(reconfigure); focus_cycle_shutdown(reconfigure); focus_shutdown(reconfigure); - sn_shutdown(reconfigure); window_shutdown(reconfigure); + sn_shutdown(reconfigure); event_shutdown(reconfigure); config_shutdown(); actions_shutdown(reconfigure); @@ -470,9 +487,9 @@ static void print_version() { g_print("Openbox %s\n", PACKAGE_VERSION); g_print(_("Copyright (c)")); - g_print(" 2007 Mikael Magnusson\n"); + g_print(" 2008 Mikael Magnusson\n"); g_print(_("Copyright (c)")); - g_print(" 2003-2007 Dana Jansens\n\n"); + g_print(" 2003-2006 Dana Jansens\n\n"); g_print("This program comes with ABSOLUTELY NO WARRANTY.\n"); g_print("This is free software, and you are welcome to redistribute it\n"); g_print("under certain conditions. See the file COPYING for details.\n\n"); @@ -485,6 +502,7 @@ static void print_help() g_print(_(" --help Display this help and exit\n")); g_print(_(" --version Display the version and exit\n")); g_print(_(" --replace Replace the currently running window manager\n")); + g_print(_(" --config-file FILE Specify the path to the config file to use\n")); g_print(_(" --sm-disable Disable connection to the session manager\n")); g_print(_("\nPassing messages to a running Openbox instance:\n")); g_print(_(" --reconfigure Reload Openbox's configuration\n")); @@ -512,9 +530,7 @@ static void remove_args(gint *argc, gchar **argv, gint index, gint num) static void parse_env() { /* unset this so we don't pass it on unknowingly */ - gchar *s = g_strdup("DESKTOP_STARTUP_ID"); - putenv(s); - g_free(s); + unsetenv("DESKTOP_STARTUP_ID"); } static void parse_args(gint *argc, gchar **argv) @@ -564,6 +580,17 @@ static void parse_args(gint *argc, gchar **argv) else if (!strcmp(argv[i], "--exit")) { remote_control = 3; } + else if (!strcmp(argv[i], "--config-file")) { + if (i == *argc - 1) /* no args left */ + g_printerr(_("--config-file requires an argument\n")); + else { + /* this will be in the current locale encoding, which is + what we want */ + config_file = argv[i+1]; + ++i; /* skip the argument */ + ob_debug("--config-file %s\n", config_file); + } + } else if (!strcmp(argv[i], "--sm-save-file")) { if (i == *argc - 1) /* no args left */ /* not translated cuz it's sekret */