X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fopenbox.cc;h=a15f369b2dfe03242c1b1620030d3756e01371e5;hb=3814c4fbebb1f3e5e489225a0280d6a1958d1543;hp=4d1de42afbb9341b577e03b6e7ad25894b6db997;hpb=b9a7f6fbcbc1b3cef535091531bd05bbb9b385a1;p=chaz%2Fopenbox diff --git a/src/openbox.cc b/src/openbox.cc index 4d1de42a..a15f369b 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -70,6 +70,7 @@ void Openbox::signalHandler(int signal) printf("Caught signal %d. Exiting.\n", signal); instance->shutdown(); break; + case SIGFPE: case SIGSEGV: printf("Caught signal %d. Aborting and dumping core.\n", signal); @@ -109,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); @@ -142,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")); @@ -238,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); @@ -270,9 +277,11 @@ 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]); @@ -304,7 +313,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 } @@ -357,6 +366,13 @@ void Openbox::setFocusedClient(OBClient *c) otk::OBProperty::Atom_Window, (c && _focused_screen == *it) ? c->window() : None); } + + // 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); } void Openbox::execute(int screen, const std::string &bin)