more user friendly net_showing_desktop support
Dana Jansens danakj@orodu.net
4 files changed,
33 insertions(+),
10 deletions(-)
M
src/client.cc
→
src/client.cc
@@ -1017,15 +1017,23 @@ } else if (e.message_type == otk::Property::atoms.net_active_window) {
#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();@@ -1552,6 +1560,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;
M
src/screen.cc
→
src/screen.cc
@@ -889,15 +889,10 @@ static Window saved_focus = 0;
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 +901,19 @@ (*it)->focus();
} 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)
M
src/screen.hh
→
src/screen.hh
@@ -143,10 +143,6 @@ greater than 0 or it will be ignored.
*/ void changeNumDesktops(unsigned int num); - //! Shows and focuses the desktop and hides all the client windows, or - //! returns to the normal state, showing client windows. - void showDesktop(bool show); - public: #ifndef SWIG //! Constructs a new Screen object@@ -181,6 +177,10 @@ */
const otk::Rect& area(unsigned int desktop) const; const DesktopLayout& desktopLayout() const { return _layout; } + + //! Shows and focuses the desktop and hides all the client windows, or + //! returns to the normal state, showing client windows. + void showDesktop(bool show); //! Update's the screen's combined strut of all the clients. /*!