#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <X11/cursorfont.h>
client_manage_all();
ob_state = State_Running;
- while (!ob_shutdown) {
+ while (!ob_shutdown)
event_loop();
- }
ob_state = State_Exiting;
client_unmanage_all();
timer_shutdown();
}
- XCloseDisplay(ob_display);
-
dispatch_shutdown();
- /* XXX if (ob_restart) */
+ XCloseDisplay(ob_display);
+
+ if (ob_restart) {
+ ob_restart_path = "";
+ if (ob_restart_path != NULL) {
+ int argcp;
+ char **argvp;
+ GError *err = NULL;
+
+ /* run other shit */
+ if (g_shell_parse_argv(ob_restart_path, &argcp, &argvp, &err)) {
+ execvp(argvp[0], argvp);
+ g_strfreev(argvp);
+ } else {
+ g_warning("failed to execute '%s': %s", ob_restart_path,
+ err->message);
+ }
+ }
+
+ /* re-run me */
+ execvp(argv[0], argv); /* try how we were run */
+ execlp("ob3", "ob3", NULL); /* try this as a last resort */
+ }
return 0;
}