check if the window exists before trying to focus it
This commit is contained in:
parent
6266b9e0c1
commit
bb5a07b3e1
1 changed files with 8 additions and 0 deletions
|
@ -1196,6 +1196,14 @@ bool Client::focus() const
|
||||||
|
|
||||||
if (_focused) return true;
|
if (_focused) return true;
|
||||||
|
|
||||||
|
// do a check to see if the window has already been unmapped or destroyed
|
||||||
|
XEvent ev;
|
||||||
|
if (XCheckTypedWindowEvent(**otk::display, _window, UnmapNotify, &ev) ||
|
||||||
|
XCheckTypedWindowEvent(**otk::display, _window, DestroyNotify, &ev)) {
|
||||||
|
XPutBackEvent(**otk::display, &ev);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (_can_focus)
|
if (_can_focus)
|
||||||
XSetInputFocus(**otk::display, _window,
|
XSetInputFocus(**otk::display, _window,
|
||||||
RevertToNone, CurrentTime);
|
RevertToNone, CurrentTime);
|
||||||
|
|
Loading…
Reference in a new issue