summaryrefslogtreecommitdiff
path: root/src/screen.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-10 17:00:34 +0000
committerDana Jansens <danakj@orodu.net>2003-02-10 17:00:34 +0000
commit5d47526b30ec8d9c98c047929431faf89e9fe3f2 (patch)
treeba53ec062c8a59edc216c5c3621e9168189a73f8 /src/screen.cc
parent265cf6c9478860336816570a141198d9257a27a1 (diff)
focus the desktop when entering show-desktop-mode, and refocus what was focused before when leaving
Diffstat (limited to 'src/screen.cc')
-rw-r--r--src/screen.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/screen.cc b/src/screen.cc
index 3a064560..75d8e87e 100644
--- a/src/screen.cc
+++ b/src/screen.cc
@@ -884,10 +884,25 @@ void Screen::showDesktop(bool show)
{
if (show == _showing_desktop) return; // no change
+ // save the window focus, and restore it when leaving the show-desktop mode
+ static Window saved_focus = 0;
+ if (show) {
+ Client *c = openbox->focusedClient();
+ if (c) saved_focus = c->window();
+ } else {
+ 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)
- (*it)->showhide();
+ for (it = clients.begin(); it != end; ++it) {
+ if ((*it)->type() == Client::Type_Desktop) {
+ if (show)
+ (*it)->focus();
+ } else
+ (*it)->showhide();
+ }
}
void Screen::propertyHandler(const XPropertyEvent &e)