diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-04 01:21:04 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-04 01:21:04 +0000 |
| commit | 06eb14fbeb568639404496a2dc6a0fe6cdd3d7b7 (patch) | |
| tree | 0c61cd97bf5e3c9f47f5b3dac0a4311dc7abdc4b /src/client.cc | |
| parent | 8c4357fccb29b1c4ddf560748b7e0b3e7285050a (diff) | |
better focusing. support for the take_focus protocol
Diffstat (limited to 'src/client.cc')
| -rw-r--r-- | src/client.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/client.cc b/src/client.cc index a12ec941..15f44349 100644 --- a/src/client.cc +++ b/src/client.cc @@ -934,9 +934,28 @@ void OBClient::shade(bool shade) bool OBClient::focus() { - if (!_can_focus || _focused) return false; + if (!(_can_focus || _focus_notify) || _focused) return false; + + if (_can_focus) + XSetInputFocus(otk::OBDisplay::display, _window, RevertToNone, CurrentTime); + + if (_focus_notify) { + XEvent ce; + const otk::OBProperty *property = Openbox::instance->property(); + + ce.xclient.type = ClientMessage; + ce.xclient.message_type = property->atom(otk::OBProperty::wm_protocols); + ce.xclient.display = otk::OBDisplay::display; + ce.xclient.window = _window; + ce.xclient.format = 32; + ce.xclient.data.l[0] = property->atom(otk::OBProperty::wm_take_focus); + ce.xclient.data.l[1] = Openbox::instance->lastTime(); + ce.xclient.data.l[2] = 0l; + ce.xclient.data.l[3] = 0l; + ce.xclient.data.l[4] = 0l; + XSendEvent(otk::OBDisplay::display, _window, False, NoEventMask, &ce); + } - XSetInputFocus(otk::OBDisplay::display, _window, RevertToNone, CurrentTime); return true; } |
