show desktop mode works!
This commit is contained in:
parent
f305e7f18d
commit
265cf6c947
3 changed files with 40 additions and 9 deletions
|
@ -764,12 +764,17 @@ void Client::setDesktop(unsigned int target)
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ Screen::Screen(int screen)
|
|||
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 @@ void Screen::changeSupportedAtoms()
|
|||
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 @@ void Screen::installColormap(bool install) const
|
|||
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 @@ void Screen::clientMessageHandler(const XClientMessageEvent &e)
|
|||
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 @@ void Screen::mapRequestHandler(const XMapRequestEvent &e)
|
|||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,8 +95,12 @@ private:
|
|||
//! 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();
|
||||
//! Set the list of supported NETWM atoms on the root window
|
||||
|
@ -139,6 +143,10 @@ 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
|
||||
|
@ -161,6 +169,8 @@ public:
|
|||
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
|
||||
/*!
|
||||
|
|
Loading…
Reference in a new issue