X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fopenbox.c;h=b688296516911f2afee8254577a00635c3d60d4c;hb=4cb183401cc42f61a759b02f1210a3528f7869e5;hp=06e804ff8814489fdea4077e652ee0238bbb39b2;hpb=f68066aa63edd6404dc8a598bd9e1f66d8d3844d;p=chaz%2Fopenbox diff --git a/openbox/openbox.c b/openbox/openbox.c index 06e804ff..b6882965 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -62,6 +62,7 @@ #ifdef HAVE_UNISTD_H # include #endif +#include #include @@ -76,15 +77,15 @@ static ObState state; static gboolean xsync; static gboolean reconfigure; static gboolean restart; -static char *restart_path; +static gchar *restart_path; static Cursor cursors[OB_NUM_CURSORS]; static KeyCode keys[OB_NUM_KEYS]; static gint exitcode = 0; -static void signal_handler(int signal, gpointer data); -static void parse_args(int argc, char **argv); +static void signal_handler(gint signal, gpointer data); +static void parse_args(gint argc, gchar **argv); -int main(int argc, char **argv) +gint main(gint argc, gchar **argv) { #ifdef DEBUG ob_debug_show_output(TRUE); @@ -100,6 +101,10 @@ int main(int argc, char **argv) textdomain(PACKAGE_NAME); g_set_prgname(argv[0]); + + if (chdir(g_get_home_dir()) == -1) + g_warning("Unable to change to home directory (%s): %s", + g_get_home_dir(), g_strerror(errno)); parse_paths_startup(); @@ -130,8 +135,6 @@ int main(int argc, char **argv) if (ob_rr_inst == NULL) ob_exit_with_error("Failed to initialize the render library."); - /* XXX fork self onto other screens */ - XSynchronize(ob_display, xsync); /* check for locale support */ @@ -205,7 +208,7 @@ int main(int argc, char **argv) if (parse_load_rc(&doc, &node)) parse_tree(i, doc, node->xmlChildrenNode); /* we're done with parsing now, kill it */ - xmlFreeDoc(doc); + parse_close(doc); parse_shutdown(i); } @@ -287,6 +290,8 @@ int main(int argc, char **argv) } while (reconfigure); } + XSync(ob_display, FALSE); + RrThemeFree(ob_rr_theme); RrInstanceFree(ob_rr_inst); @@ -298,8 +303,8 @@ int main(int argc, char **argv) if (restart) { if (restart_path != NULL) { - int argcp; - char **argvp; + gint argcp; + gchar **argvp; GError *err = NULL; /* run other shit */ @@ -309,6 +314,7 @@ int main(int argc, char **argv) } else { g_warning("failed to execute '%s': %s", restart_path, err->message); + g_error_free(err); } } @@ -320,16 +326,16 @@ int main(int argc, char **argv) return exitcode; } -static void signal_handler(int signal, gpointer data) +static void signal_handler(gint signal, gpointer data) { if (signal == SIGUSR1) { - fprintf(stderr, "Caught signal %d. Restarting.\n", signal); + ob_debug("Caught signal %d. Restarting.\n", signal); ob_restart(); } else if (signal == SIGUSR2) { - fprintf(stderr, "Caught signal %d. Reconfiguring.\n", signal); + ob_debug("Caught signal %d. Reconfiguring.\n", signal); ob_reconfigure(); } else { - fprintf(stderr, "Caught signal %d. Exiting.\n", signal); + ob_debug("Caught signal %d. Exiting.\n", signal); /* TERM and INT return a 0 code */ ob_exit(!(signal == SIGTERM || signal == SIGINT)); } @@ -365,9 +371,9 @@ static void print_help() g_print("\nPlease report bugs at %s\n\n", PACKAGE_BUGREPORT); } -static void parse_args(int argc, char **argv) +static void parse_args(gint argc, gchar **argv) { - int i; + gint i; for (i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--version")) {