#include "client.hh"
#include "screen.hh"
#include "actions.hh"
+#include "bindings.hh"
#include "otk/property.hh"
#include "otk/display.hh"
#include "otk/assassin.hh"
_doshutdown = false;
_rcfilepath = otk::expandTilde("~/.openbox/rc3");
_scriptfilepath = otk::expandTilde("~/.openbox/user.py");
+ _focused_client = 0;
+ _sync = false;
parseCommandLine(argc, argv);
// open the X display (and gets some info about it, and its screens)
otk::OBDisplay::initialize(_displayreq);
assert(otk::OBDisplay::display);
-
+
+ XSynchronize(otk::OBDisplay::display, _sync);
+
// set up the signal handler
action.sa_handler = Openbox::signalHandler;
action.sa_mask = sigset_t();
sigaction(SIGHUP, &action, (struct sigaction *) 0);
_property = new otk::OBProperty();
-
_actions = new OBActions();
+ _bindings = new OBBindings();
+
+ OBBindings::StringVect v;
+ v.push_back("C-A-x");
+ v.push_back("C-y");
+ v.push_back("v");
+ _bindings->add_key(v, 1);
+ v.clear();
+ v.push_back("C-x");
+ v.push_back("C-z");
+ v.push_back("a");
+ _bindings->add_key(v, 2);
+ v.clear();
+ v.push_back("C-a");
+ _bindings->add_key(v, 3);
+
+ _bindings->add_mouse("C-1", 1);
+
+ printf("CHAINS:\n");
+ _bindings->display();
setMasterHandler(_actions); // set as the master event handler
::exit(1);
}
+ // set up input focus
+ _focused_screen = _screens[0];
+ setFocusedClient(0);
+
_state = State_Normal; // done starting
}
_state = State_Exiting; // time to kill everything
std::for_each(_screens.begin(), _screens.end(), otk::PointerAssassin());
+
+ delete _bindings;
+ delete _actions;
+ delete _property;
// close the X display
otk::OBDisplay::destroy();
err = true;
else
_scriptfilepath = argv[i];
+ } else if (arg == "-sync") {
+ _sync = true;
} else if (arg == "-version") {
showVersion();
::exit(0);
{
while (!_doshutdown) {
dispatchEvents(); // from OtkEventDispatcher
+ XFlush(otk::OBDisplay::display); // flush here before we go wait for timers
_timermanager.fire();
}
}
return (OBClient*) 0;
}
+
+void Openbox::setFocusedClient(OBClient *c)
+{
+ _focused_client = c;
+ if (c) {
+ _focused_screen = _screens[c->screen()];
+ } else {
+ assert(_focused_screen);
+ XSetInputFocus(otk::OBDisplay::display, _focused_screen->focuswindow(),
+ RevertToNone, CurrentTime);
+ }
+}
+
}