From 1e46a39dc305fe92b0c0eca1e60e76fded3e5214 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 10 Feb 2003 22:17:40 +0000 Subject: [PATCH] more user friendly net_showing_desktop support --- src/client.cc | 12 ++++++++++++ src/screen.cc | 20 ++++++++++++++------ src/screen.hh | 8 ++++---- wrap/ob.i | 3 +++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/client.cc b/src/client.cc index 453bf745..33e11ce0 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1017,15 +1017,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(); @@ -1553,6 +1561,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) { diff --git a/src/screen.cc b/src/screen.cc index d242e887..3461178d 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -889,15 +889,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 +901,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) diff --git a/src/screen.hh b/src/screen.hh index e8306933..55518fc9 100644 --- a/src/screen.hh +++ b/src/screen.hh @@ -143,10 +143,6 @@ private: */ 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 @@ -182,6 +178,10 @@ public: 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. /*! Clients should call this whenever they change their strut. diff --git a/wrap/ob.i b/wrap/ob.i index 0ba9a90e..7e95f602 100644 --- a/wrap/ob.i +++ b/wrap/ob.i @@ -45,6 +45,9 @@ } }; +// do this through events +%ignore ob::Screen::showDesktop(bool); + %import "otk.i" %import "actions.hh" -- 2.45.2