show desktop mode works!
Dana Jansens danakj@orodu.net
3 files changed,
40 insertions(+),
9 deletions(-)
M
src/client.cc
→
src/client.cc
@@ -764,12 +764,17 @@
void Client::showhide() { - if (!_iconic && - (_desktop == openbox->screen(_screen)->desktop() || - _desktop == 0xffffffff)) - frame->show(); - else - frame->hide(); + bool show; + Screen *s = openbox->screen(_screen); + + if (_iconic) show = false; + else if (!(_desktop == s->desktop() || + _desktop == 0xffffffff)) show = false; + else if (normal() && s->showingDesktop()) show = false; + else show = true; + + if (show) frame->show(); + else frame->hide(); }
M
src/screen.cc
→
src/screen.cc
@@ -44,6 +44,8 @@ {
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(),@@ -397,13 +399,13 @@ otk::Property::atoms.net_client_list,
otk::Property::atoms.net_client_list_stacking, otk::Property::atoms.net_desktop_names, otk::Property::atoms.net_close_window, + otk::Property::atoms.net_desktop_layout, + otk::Property::atoms.net_showing_desktop, otk::Property::atoms.net_wm_name, otk::Property::atoms.net_wm_visible_name, otk::Property::atoms.net_wm_icon_name, otk::Property::atoms.net_wm_visible_icon_name, -/* otk::Property::atoms.net_wm_desktop, -*/ otk::Property::atoms.net_wm_strut, otk::Property::atoms.net_wm_window_type, otk::Property::atoms.net_wm_window_type_desktop,@@ -878,6 +880,15 @@ else
XUninstallColormap(**otk::display, _info->colormap()); } +void Screen::showDesktop(bool show) +{ + if (show == _showing_desktop) return; // no change + + _showing_desktop = show; + ClientList::iterator it, end = clients.end(); + for (it = clients.begin(); it != end; ++it) + (*it)->showhide(); +} void Screen::propertyHandler(const XPropertyEvent &e) {@@ -912,6 +923,8 @@ if (e.message_type == otk::Property::atoms.net_current_desktop) {
changeDesktop(e.data.l[0]); } else if (e.message_type == otk::Property::atoms.net_number_of_desktops) { changeNumDesktops(e.data.l[0]); + } else if (e.message_type == otk::Property::atoms.net_showing_desktop) { + showDesktop(e.data.l[0] != 0); } }@@ -929,8 +942,11 @@ if (c) {
#ifdef DEBUG printf("DEBUG: MAP REQUEST CAUGHT IN SCREEN. IGNORED.\n"); #endif - } else + } else { + if (_showing_desktop) + showDesktop(false); // leave showing-the-desktop mode manageWindow(e.window); + } } }
M
src/screen.hh
→
src/screen.hh
@@ -95,7 +95,11 @@
//! The names of all desktops otk::Property::StringVect _desktop_names; + //! The layout of the desktops as specified by an EWMH compliant pager DesktopLayout _layout; + + //! True when the window manager is in 'showing desktop' mode + bool _showing_desktop; //! Calculate the Screen::_area member void calcArea();@@ -139,6 +143,10 @@ 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@@ -161,6 +169,8 @@ //! Returns the desktop being displayed
inline unsigned int desktop() const { return _desktop; } //! Returns the number of desktops inline unsigned int numDesktops() const { return _num_desktops; } + //! When true, the desktop is being shown and all clients are hidden + inline bool showingDesktop() const { return _showing_desktop; } //! Returns the area of the screen not reserved by applications' Struts /*!