diff options
Diffstat (limited to 'src/client.cc')
| -rw-r--r-- | src/client.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/client.cc b/src/client.cc index a22a18a6..2f966cee 100644 --- a/src/client.cc +++ b/src/client.cc @@ -40,6 +40,8 @@ OBClient::OBClient(int screen, Window window) _wmstate = NormalState; // no default decors or functions, each has to be enabled _decorations = _functions = 0; + // start unfocused + _focused = false; getArea(); getDesktop(); @@ -460,6 +462,9 @@ void OBClient::updateTitle() if (_title.empty()) _title = _("Unnamed Window"); + + if (frame) + frame->setTitle(_title); } @@ -859,6 +864,37 @@ void OBClient::close() } +bool OBClient::focus() +{ + if (!_can_focus) return false; + + XSetInputFocus(otk::OBDisplay::display, _window, RevertToNone, CurrentTime); + return true; +} + + +void OBClient::focusHandler(const XFocusChangeEvent &) +{ + frame->focus(); + _focused = true; + + Openbox::instance->setFocusedClient(this); +} + + +void OBClient::unfocusHandler(const XFocusChangeEvent &) +{ + frame->unfocus(); + _focused = false; + + if (Openbox::instance->focusedClient() == this) { + printf("UNFOCUSING\n"); + Openbox::instance->setFocusedClient(0); + } else + printf("UNFOCUSED ALREADY COULDNT UNFOCUS\n"); +} + + void OBClient::configureRequestHandler(const XConfigureRequestEvent &e) { OtkEventHandler::configureRequestHandler(e); |
