From 2ae2b257d39ea62640c2590f794e4275c6db1cd4 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 25 Dec 2002 22:02:34 +0000 Subject: might not compile... ob uses its own widgets now, which subclass only the base otk widget. working on compressing focus events and handling them etc. --- src/openbox.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/openbox.cc') diff --git a/src/openbox.cc b/src/openbox.cc index 41f0c7b1..ff42f58b 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -108,6 +108,8 @@ Openbox::Openbox(int argc, char **argv) _doshutdown = false; _rcfilepath = otk::expandTilde("~/.openbox/rc3"); _scriptfilepath = otk::expandTilde("~/.openbox/user.py"); + _focused_client = 0; + _sync = false; parseCommandLine(argc, argv); @@ -128,7 +130,9 @@ Openbox::Openbox(int argc, char **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(); @@ -181,6 +185,10 @@ Openbox::Openbox(int argc, char **argv) ::exit(1); } + // set up input focus + _focused_screen = _screens[0]; + setFocusedClient(0); + _state = State_Normal; // done starting } @@ -223,6 +231,8 @@ void Openbox::parseCommandLine(int argc, char **argv) err = true; else _scriptfilepath = argv[i]; + } else if (arg == "-sync") { + _sync = true; } else if (arg == "-version") { showVersion(); ::exit(0); @@ -321,5 +331,18 @@ OBClient *Openbox::findClient(Window window) 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); + } +} + } -- cgit v1.2.3