X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fopenbox.cc;h=3232827ff92d3eddd3cc1f5a072e00a9b67d1feb;hb=7b20aad5bde2d5338e42dadcfe1175b4390744db;hp=4e098cb839d0f501c66ada6728806914b21054e5;hpb=4c768d5d63154e416e1282396dc48492d0585d42;p=chaz%2Fopenbox diff --git a/src/openbox.cc b/src/openbox.cc index 4e098cb8..3232827f 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -139,17 +139,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 +244,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); @@ -272,16 +278,19 @@ void Openbox::showHelp() printf(_("Usage: %s [OPTIONS...]\n\ Options:\n\ -display use display connection.\n\ + -single run on a single screen (default is to run every one).\n\ -rc use alternate resource file.\n\ -menu use alternate menu file.\n\ -script 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 +304,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 +321,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 +376,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)