X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient.cc;h=3175b3ba75658ebdfab932ff42cc5e66556fac34;hb=939e7887ceaee9ec97428ad79d8424bde6e479dd;hp=8a3a46b81fa031246f5e831dca05ca1e50a3e9ec;hpb=29bd1c97a2f003bb05240091f265b033f5d2e1f5;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index 8a3a46b8..3175b3ba 100644 --- a/src/client.cc +++ b/src/client.cc @@ -83,7 +83,6 @@ Client::Client(int screen, Window window) // any changes we've made here otk::Property::set(_window, otk::Property::atoms.net_wm_desktop, otk::Property::atoms.cardinal, (unsigned)_desktop); - changeState(); } @@ -750,26 +749,29 @@ void Client::setDesktop(unsigned int target) return; _desktop = target; - // set the desktop hint otk::Property::set(_window, otk::Property::atoms.net_wm_desktop, otk::Property::atoms.cardinal, _desktop); - + frame->adjustState(); // the frame can display the current desktop state // 'move' the window to the new desktop showhide(); - openbox->screen(_screen)->updateStruts(); } void Client::showhide() { - if (!_iconic && - (_desktop == openbox->screen(_screen)->desktop() || - _desktop == 0xffffffff)) - frame->show(); - else - frame->hide(); + bool show; + Screen *s = openbox->screen(_screen); + + if (_iconic) show = false; + else if (!(_desktop == s->desktop() || + _desktop == 0xffffffff)) show = false; + else if (normal() && s->showingDesktop()) show = false; + else show = true; + + if (show) frame->show(); + else frame->hide(); } @@ -1012,15 +1014,23 @@ void Client::clientMessageHandler(const XClientMessageEvent &e) #ifdef DEBUG printf("net_active_window for 0x%lx\n", _window); #endif + if (openbox->screen(_screen)->showingDesktop()) + openbox->screen(_screen)->showDesktop(false); if (_iconic) iconify(false); + else if (!frame->visible()) // if its not visible for other reasons, then + return; // don't mess with it if (_shaded) shade(false); focus(); openbox->screen(_screen)->raiseWindow(this); } else if (e.message_type == otk::Property::atoms.openbox_active_window) { + if (openbox->screen(_screen)->showingDesktop()) + openbox->screen(_screen)->showDesktop(false); if (_iconic) iconify(false); + else if (!frame->visible()) // if its not visible for other reasons, then + return; // don't mess with it if (e.data.l[0] && _shaded) shade(false); focus(); @@ -1548,6 +1558,10 @@ void Client::iconify(bool iconic, bool curdesk) { if (_iconic == iconic) return; // nothing to do +#ifdef DEBUG + printf("%sconifying window: 0x%lx\n", (iconic ? "I" : "Uni"), _window); +#endif + _iconic = iconic; if (_iconic) { @@ -1563,9 +1577,7 @@ void Client::iconify(bool iconic, bool curdesk) XMapWindow(**otk::display, _window); } changeState(); - showhide(); - openbox->screen(_screen)->updateStruts(); }