]> Dogcows Code - chaz/openbox/blobdiff - openbox/openbox.c
use CurrentTime again?
[chaz/openbox] / openbox / openbox.c
index 5a7f5a5c09187a5c24790fcd20d866c25842dc65..fa31204fc9e178494840a15b3ef2255dccd9e210 100644 (file)
@@ -8,9 +8,9 @@
 #include "focus.h"
 #include "extensions.h"
 #include "gettext.h"
+#include "config.h"
 #include "grab.h"
 #include "engine.h"
-#include "themerc.h"
 #include "plugin.h"
 #include "timer.h"
 #include "../render/render.h"
@@ -19,9 +19,6 @@
 #ifdef HAVE_FCNTL_H
 #  include <fcntl.h>
 #endif
-#ifdef HAVE_SYS_SELECT_H
-#  include <sys/select.h>
-#endif
 #ifdef HAVE_SIGNAL_H
 #  include <signal.h>
 #endif
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
+#ifdef HAVE_SYS_STAT_H
+#  include <sys/stat.h>
+#  include <sys/types.h>
+#endif
 
 #include <X11/cursorfont.h>
 
@@ -48,7 +49,7 @@ State    ob_state;
 gboolean ob_shutdown = FALSE;
 gboolean ob_restart  = FALSE;
 char    *ob_restart_path = NULL;
-gboolean ob_remote   = FALSE;
+gboolean ob_remote   = TRUE;
 gboolean ob_sync     = FALSE;
 Cursors  ob_cursors;
 char    *ob_rc_path  = NULL;
@@ -60,6 +61,7 @@ int main(int argc, char **argv)
 {
     struct sigaction action;
     sigset_t sigset;
+    char *path;
 
     ob_state = State_Starting;
 
@@ -78,7 +80,7 @@ int main(int argc, char **argv)
     sigemptyset(&sigset);
     action.sa_handler = dispatch_signal;
     action.sa_mask = sigset;
-    action.sa_flags = SA_NOCLDSTOP | SA_NODEFER;
+    action.sa_flags = SA_NOCLDSTOP;
     sigaction(SIGUSR1, &action, (struct sigaction *) NULL);
     sigaction(SIGPIPE, &action, (struct sigaction *) NULL);
     sigaction(SIGSEGV, &action, (struct sigaction *) NULL);
@@ -90,6 +92,12 @@ int main(int argc, char **argv)
 
     /* anything that died while we were restarting won't give us a SIGCHLD */
     while (waitpid(-1, NULL, WNOHANG) > 0);
+
+    /* create the ~/.openbox dir */
+    path = g_build_filename(g_get_home_dir(), ".openbox", NULL);
+    mkdir(path, (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP |
+                 S_IROTH | S_IWOTH | S_IXOTH));
+    g_free(path);
      
     /* parse out command line args */
     parse_args(argc, argv);
@@ -135,22 +143,25 @@ int main(int argc, char **argv)
      
     if (screen_annex()) { /* it will be ours! */
        timer_startup();
+        config_startup();
        render_startup();
        font_startup();
-       themerc_startup();
-       engine_startup(themerc_engine);
+        plugin_startup();
+
+        /* load the plugins specified in the pluginrc */
+        plugin_loadall();
+        /* parse/load user options */
+        config_parse();
+
+       engine_startup();
        event_startup();
        screen_startup();
        focus_startup();
        client_startup();
         grab_startup();
-        plugin_startup();
 
-        /* XXX load all plugins!! */
-        plugin_open("focus");
-        plugin_open("keyboard");
-        plugin_open("mouse");
-        plugin_open("placement");
+        /* call startup for all the plugins */
+        plugin_startall();
 
        /* get all the existing windows */
        client_manage_all();
@@ -169,8 +180,8 @@ int main(int argc, char **argv)
        screen_shutdown();
        event_shutdown();
        engine_shutdown();
-       themerc_shutdown();
        render_shutdown();
+        config_shutdown();
        timer_shutdown();
     }
 
@@ -270,6 +281,10 @@ void parse_args(int argc, char **argv)
                 g_printerr("-rc requires an argument\n");
             else
                 ob_rc_path = argv[++i];
+        } else {
+            g_printerr("Invalid option: '%s'\n\n", argv[i]);
+            print_help();
+            exit(1);
         }
     }
 }
This page took 0.030623 seconds and 4 git commands to generate.