+ sigaction(SIGCHLD, &action, (struct sigaction *) 0);
+
+ // anything that died while we were restarting won't give us a SIGCHLD
+ while (waitpid(-1, NULL, WNOHANG) > 0);
+
+ _actions = new Actions();
+ _bindings = new Bindings();
+
+ setMasterHandler(_actions); // set as the master event handler
+
+ // create the mouse cursors we'll use
+ _cursors.session = XCreateFontCursor(**otk::display, XC_left_ptr);
+ _cursors.move = XCreateFontCursor(**otk::display, XC_fleur);
+ _cursors.ll_angle = XCreateFontCursor(**otk::display, XC_ll_angle);
+ _cursors.lr_angle = XCreateFontCursor(**otk::display, XC_lr_angle);
+ _cursors.ul_angle = XCreateFontCursor(**otk::display, XC_ul_angle);
+ _cursors.ur_angle = XCreateFontCursor(**otk::display, XC_ur_angle);
+
+ // initialize all the screens
+ _focused_screen = 0;
+ _managed_count = 0;
+
+ for (int i = 0, max = ScreenCount(**otk::display); i < max; ++i) {
+ Screen *screen;
+ // in single mode skip the screens we don't want to manage
+ if (_single && i != DefaultScreen(**otk::display)) {
+ _screens.push_back(0);
+ continue;
+ }
+ // try manage the screen
+ screen = new Screen(i);
+ if (screen->managed()) {
+ _screens.push_back(screen);
+ if (!_focused_screen) // set this to the first screen managed
+ _focused_screen = screen;
+ _managed_count++;
+ } else {
+ delete screen;
+ _screens.push_back(0);
+ }
+ }
+
+ if (!_managed_count) {
+ printf(_("No screens were found without a window manager. Exiting.\n"));
+ ::exit(1);
+ }
+
+ assert(_focused_screen);
+
+ // initialize scripting
+ python_init(argv[0]);
+
+ // load the theme XXX TEMP SHIT
+ otk::RenderStyle::setStyle(0, "");
+
+ int ret = python_exec(_scriptfilepath.c_str());
+ if (ret == 2) {
+ std::string msg;
+ msg += _("An error occured while executing the python scripts.");
+ msg += "\n\n";
+ msg += _("See the exact error message in Openbox's output for details.");
+ otk::MessageDialog dia(this, _("Python Error"), msg);
+ otk::DialogButton ok(_("Okay"), true);
+ otk::DialogButton retry(_("Restart"));
+ dia.addButton(ok);
+ dia.addButton(retry);
+ dia.show();
+ dia.focus();
+ const otk::DialogButton &res = dia.run();
+ if (res == retry) {
+ _restart = _shutdown = true;
+ return;
+ }
+ }
+
+ if (ret)
+ python_exec(SCRIPTDIR"/defaults.py"); // system default bahaviors