X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=0c90d747b9de86e63eeef0121e4e17fa0076b0c4;hb=22b5d6458e3001a7bd930bf3491bf7fcd26ac3ce;hp=d242e8876173a7444297301a58a0fa8faab03488;hpb=ba9b0617ed0c68b0487fd5246fbcdc2156f65c08;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index d242e887..0c90d747 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -44,8 +44,6 @@ Screen::Screen(int screen) assert(screen >= 0); assert(screen < ScreenCount(**otk::display)); _info = otk::display->screenInfo(screen); - _showing_desktop = false; - ::running = false; XErrorHandler old = XSetErrorHandler(::anotherWMRunning); XSelectInput(**otk::display, _info->rootWindow(), @@ -113,6 +111,12 @@ Screen::Screen(int screen) changeDesktop(0); // set the hint + // don't start in showing-desktop mode + _showing_desktop = false; + otk::Property::set(_info->rootWindow(), + otk::Property::atoms.net_showing_desktop, + otk::Property::atoms.cardinal, 0); + // create the window which gets focus when no clients get it XSetWindowAttributes attr; attr.override_redirect = true; @@ -889,15 +893,10 @@ void Screen::showDesktop(bool show) if (show) { Client *c = openbox->focusedClient(); if (c) saved_focus = c->window(); - } else { - Client *f = openbox->focusedClient(); - if (!f || f->type() == Client::Type_Desktop) { - Client *c = openbox->findClient(saved_focus); - if (c) c->focus(); - } } _showing_desktop = show; + ClientList::iterator it, end = clients.end(); for (it = clients.begin(); it != end; ++it) { if ((*it)->type() == Client::Type_Desktop) { @@ -906,6 +905,19 @@ void Screen::showDesktop(bool show) } else (*it)->showhide(); } + + if (!show) { + Client *f = openbox->focusedClient(); + if (!f || f->type() == Client::Type_Desktop) { + Client *c = openbox->findClient(saved_focus); + if (c) c->focus(); + } + } + + otk::Property::set(_info->rootWindow(), + otk::Property::atoms.net_showing_desktop, + otk::Property::atoms.cardinal, + show ? 1 : 0); } void Screen::propertyHandler(const XPropertyEvent &e)