X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=e4518fba3b4af1595b0719ba546033c97676d44f;hb=d7a30f93b517ac76816d0acea92e9c56ad5d6594;hp=18c63327d7b29c5be8deda896286e09be16ece85;hpb=68194ce957db36ead19a39fdc7636a220befafe9;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index 18c63327..e4518fba 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -22,6 +22,7 @@ extern "C" { #include "client.hh" #include "openbox.hh" #include "frame.hh" +#include "bindings.hh" #include "otk/display.hh" static bool running; @@ -89,6 +90,14 @@ OBScreen::OBScreen(int screen, const otk::Configuration &config) otk::OBProperty::Atom_Cardinal, viewport, 2); + // create the window which gets focus when no clients get it + XSetWindowAttributes attr; + attr.override_redirect = true; + _focuswindow = XCreateWindow(otk::OBDisplay::display, _info->rootWindow(), + -100, -100, 1, 1, 0, 0, InputOnly, + _info->visual(), CWOverrideRedirect, &attr); + XMapWindow(otk::OBDisplay::display, _focuswindow); + // these may be further updated if any pre-existing windows are found in // the manageExising() function setClientList(); // initialize the client lists, which will be empty @@ -101,8 +110,8 @@ OBScreen::~OBScreen() if (! _managed) return; // unmanage all windows - while (!_clients.empty()) - unmanageWindow(_clients.front()); + while (!clients.empty()) + unmanageWindow(clients.front()); delete _image_control; } @@ -243,13 +252,13 @@ void OBScreen::setClientList() Window *windows; // create an array of the window ids - if (_clients.size() > 0) { + if (clients.size() > 0) { Window *win_it; - windows = new Window[_clients.size()]; + windows = new Window[clients.size()]; win_it = windows; - ClientList::const_iterator it = _clients.begin(); - const ClientList::const_iterator end = _clients.end(); + ClientList::const_iterator it = clients.begin(); + const ClientList::const_iterator end = clients.end(); for (; it != end; ++it, ++win_it) *win_it = (*it)->window(); } else @@ -258,9 +267,9 @@ void OBScreen::setClientList() Openbox::instance->property()->set(_info->rootWindow(), otk::OBProperty::net_client_list, otk::OBProperty::Atom_Window, - windows, _clients.size()); + windows, clients.size()); - if (_clients.size()) + if (clients.size()) delete [] windows; setStackingList(); @@ -389,9 +398,12 @@ void OBScreen::manageWindow(Window window) otk::OBDisplay::ungrab(); // add to the screen's list - _clients.push_back(client); + clients.push_back(client); // update the root properties setClientList(); + + // grab buttons/keys on the window + Openbox::instance->bindings()->grabMouse(true, client); } @@ -399,6 +411,9 @@ void OBScreen::unmanageWindow(OBClient *client) { OBFrame *frame = client->frame; + // ungrab buttons/keys on the window + Openbox::instance->bindings()->grabMouse(false, client); + // XXX: pass around focus if this window was focused // remove from the wm's map @@ -432,7 +447,7 @@ void OBScreen::unmanageWindow(OBClient *client) client->frame = 0; // remove from the screen's list - _clients.remove(client); + clients.remove(client); delete client; // update the root properties