X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fopenbox.cc;h=b44a1861f03acb1d64f1f32863db400916b6126a;hb=15a7384d11b7a521945a14c8192b0d176adadfe7;hp=7cee8a9aa578f261fef566f261f8603336a26686;hpb=a5df374fbd412bb8540448bc4a437492b505d39a;p=chaz%2Fopenbox diff --git a/src/openbox.cc b/src/openbox.cc index 7cee8a9a..b44a1861 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -58,17 +58,19 @@ Openbox *Openbox::instance = (Openbox *) 0; void Openbox::signalHandler(int signal) { switch (signal) { - case SIGHUP: - printf("Caught HUP signal. Restarting.\n"); + case SIGUSR1: + printf("Caught SIGUSR1 signal. Restarting.\n"); instance->restart(); break; - + + case SIGHUP: case SIGINT: case SIGTERM: case SIGPIPE: printf("Caught signal %d. Exiting.\n", signal); instance->shutdown(); break; + case SIGFPE: case SIGSEGV: printf("Caught signal %d. Aborting and dumping core.\n", signal); @@ -108,6 +110,7 @@ Openbox::Openbox(int argc, char **argv) action.sa_handler = Openbox::signalHandler; action.sa_mask = sigset_t(); action.sa_flags = SA_NOCLDSTOP | SA_NODEFER; + sigaction(SIGUSR1, &action, (struct sigaction *) 0); sigaction(SIGPIPE, &action, (struct sigaction *) 0); sigaction(SIGSEGV, &action, (struct sigaction *) 0); sigaction(SIGFPE, &action, (struct sigaction *) 0); @@ -141,12 +144,15 @@ Openbox::Openbox(int argc, char **argv) // 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")); @@ -237,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); @@ -269,16 +277,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 @@ -292,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 ); } @@ -303,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 } @@ -356,6 +373,10 @@ void Openbox::setFocusedClient(OBClient *c) otk::OBProperty::Atom_Window, (c && _focused_screen == *it) ? c->window() : None); } + + // call the python Focus callbacks + EventData data(_focused_screen->number(), c, EventFocus, 0); + Openbox::instance->bindings()->fireEvent(&data); } void Openbox::execute(int screen, const std::string &bin)