]> Dogcows Code - chaz/openbox/blobdiff - src/openbox.cc
new autoconf shit woowoo
[chaz/openbox] / src / openbox.cc
index 4e098cb839d0f501c66ada6728806914b21054e5..42cc1fefe96a3017c2a93a73bc0a40ab6ec67eec 100644 (file)
@@ -4,7 +4,6 @@
 # include "../config.h"
 #endif
 
-#include "../version.h"
 #include "openbox.hh"
 #include "client.hh"
 #include "screen.hh"
@@ -139,17 +138,21 @@ Openbox::Openbox(int argc, char **argv)
   python_exec(SCRIPTDIR"/config.py"); // load openbox config values
   // run all of the python scripts
   python_exec(SCRIPTDIR"/builtins.py"); // builtin callbacks
-  // run the user's script
-  python_exec(_scriptfilepath.c_str());
+  // run the user's script or the system defaults if that fails
+  if (!python_exec(_scriptfilepath.c_str()))
+    python_exec(SCRIPTDIR"/defaults.py"); // system default bahaviors
 
   // initialize all the screens
   OBScreen *screen;
-  screen = new OBScreen(0);
-  if (screen->managed()) {
-    _screens.push_back(screen);
-    // XXX: "change to" the first workspace on the screen to initialize stuff
-  } else
-    delete screen;
+  int i = _single ? DefaultScreen(otk::OBDisplay::display) : 0;
+  int max = _single ? i + 1 : ScreenCount(otk::OBDisplay::display);
+  for (; i < max; ++i) {
+    screen = new OBScreen(i);
+    if (screen->managed())
+      _screens.push_back(screen);
+    else
+      delete screen;
+  }
 
   if (_screens.empty()) {
     printf(_("No screens were found without a window manager. Exiting.\n"));
@@ -240,6 +243,8 @@ void Openbox::parseCommandLine(int argc, char **argv)
         _scriptfilepath = argv[i];
     } else if (arg == "-sync") {
       _sync = true;
+    } else if (arg == "-single") {
+      _single = true;
     } else if (arg == "-version") {
       showVersion();
       ::exit(0);
@@ -259,7 +264,7 @@ void Openbox::parseCommandLine(int argc, char **argv)
 
 void Openbox::showVersion()
 {
-  printf(_("Openbox - version %s\n"), OPENBOX_VERSION);
+  printf(_("Openbox - version %s\n"), VERSION);
   printf("    (c) 2002 - 2002 Ben Jansens\n\n");
 }
 
@@ -272,16 +277,19 @@ void Openbox::showHelp()
   printf(_("Usage: %s [OPTIONS...]\n\
   Options:\n\
   -display <string>  use display connection.\n\
+  -single            run on a single screen (default is to run every one).\n\
   -rc <string>       use alternate resource file.\n\
   -menu <string>     use alternate menu file.\n\
   -script <string>   use alternate startup script file.\n\
+  -sync              run in synchronous mode (for debugging).\n\
   -version           display version and exit.\n\
   -help              display this help text and exit.\n\n"), _argv[0]);
 
   printf(_("Compile time options:\n\
   Debugging: %s\n\
   Shape:     %s\n\
-  Xinerama:  %s\n"),
+  Xinerama:  %s\n\
+  Xkb:       %s\n"),
 #ifdef    DEBUG
          _("yes"),
 #else // !DEBUG
@@ -295,10 +303,16 @@ void Openbox::showHelp()
 #endif // SHAPE
 
 #ifdef    XINERAMA
-         _("yes")
+         _("yes"),
 #else // !XINERAMA
-         _("no")
+         _("no"),
 #endif // XINERAMA
+
+#ifdef    XKB
+         _("yes")
+#else // !XKB
+         _("no")
+#endif // XKB
     );
 }
 
@@ -306,7 +320,7 @@ void Openbox::showHelp()
 void Openbox::eventLoop()
 {
   while (!_shutdown) {
-    _timermanager.fire();
+    _timermanager.fire(!_sync); // wait if not in sync mode
     dispatchEvents(); // from OtkEventDispatcher
     XFlush(otk::OBDisplay::display); // flush here before we go wait for timers
   }
@@ -361,11 +375,8 @@ void Openbox::setFocusedClient(OBClient *c)
   }
 
   // call the python Focus callbacks
-  EventData *data = new_event_data(_focused_screen->number(),
-                                   c ? c->window() : 0,
-                                   EventFocus, 0);
-  Openbox::instance->bindings()->fireEvent(data);
-  Py_XDECREF((PyObject*)data);
+  EventData data(_focused_screen->number(), c, EventFocus, 0);
+  Openbox::instance->bindings()->fireEvent(&data);
 }
 
 void Openbox::execute(int screen, const std::string &bin)
This page took 0.024727 seconds and 4 git commands to generate.