more user friendly net_showing_desktop support
This commit is contained in:
parent
ba9b0617ed
commit
1e46a39dc3
4 changed files with 33 additions and 10 deletions
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
}
|
||||
};
|
||||
|
||||
// do this through events
|
||||
%ignore ob::Screen::showDesktop(bool);
|
||||
|
||||
%import "otk.i"
|
||||
|
||||
%import "actions.hh"
|
||||
|
|
Loading…
Reference in a new issue