add commands to toggle toolbar and slit layer

toggle(Toolbar|Slit)Above toggles the resp. item between its
regular and the AboveDock layer (ie. above everything, even visible on
active fullscreen windows)

Also required step for autoraising.

REQUEST: 222
This commit is contained in:
Thomas Lübking 2016-08-12 17:29:50 +02:00 committed by Mathias Gumz
parent f22435d60b
commit 6c0565c482
8 changed files with 59 additions and 0 deletions

View file

@ -438,6 +438,12 @@ doing so.
Minimizes all windows on the current workspace. If they are already all
minimized, then it restores them.
*ToggleSlitAbove*::
Toggles the slit between its regular and the AboveDock layer
*ToggleToolbarAbove*::
Toggles the toolbar between its regular and the AboveDock layer
*Deiconify* 'mode' 'destination'::
Deiconifies windows (or, restores from a minimized state).
+

View file

@ -126,6 +126,11 @@ public:
Slit *slit() { return m_slit.get(); }
/// @return the slit, @see Slit
const Slit *slit() const { return m_slit.get(); }
/// @return the toolbar, @see Toolbar
Toolbar *toolbar() { return m_toolbar.get(); }
/// @return the toolbar, @see Toolbar
const Toolbar *toolbar() const { return m_toolbar.get(); }
/**
* @param w the workspace number
* @return workspace for the given workspace number

View file

@ -1064,6 +1064,13 @@ void Slit::toggleHidden() {
}
}
void Slit::toggleAboveDock() {
if (m_layeritem->getLayerNum() == m_rc_layernum->getNum())
m_layeritem->moveToLayer(ResourceLayer::ABOVE_DOCK);
else
m_layeritem->moveToLayer(m_rc_layernum->getNum());
}
void Slit::loadClientList(const char *filename) {
if (filename == 0 || filename[0] == '\0')
return;

View file

@ -103,6 +103,7 @@ public:
void moveToLayer(int layernum);
void toggleHidden();
void toggleAboveDock();
BScreen &screen() { return m_screen; }
const BScreen &screen() const { return m_screen; }

View file

@ -719,6 +719,13 @@ void Toolbar::toggleHidden() {
}
void Toolbar::toggleAboveDock() {
if (m_layeritem.getLayerNum() == m_rc_layernum->getNum())
m_layeritem.moveToLayer(ResourceLayer::ABOVE_DOCK);
else
m_layeritem.moveToLayer(m_rc_layernum->getNum());
}
void Toolbar::moveToLayer(int layernum) {
m_layeritem.moveToLayer(layernum);
*m_rc_layernum = layernum;

View file

@ -83,6 +83,7 @@ public:
void updateVisibleState();
void toggleHidden();
void toggleAboveDock();
void moveToLayer(int layernum);

View file

@ -26,6 +26,8 @@
#include "Workspace.hh"
#include "Window.hh"
#include "Screen.hh"
#include "Slit.hh"
#include "Toolbar.hh"
#include "fluxbox.hh"
#include "WinClient.hh"
#include "FocusControl.hh"
@ -622,6 +624,26 @@ void ShowDesktopCmd::execute() {
}
REGISTER_COMMAND(toggleslitbarabove, ToggleSlitAboveCmd, void);
void ToggleSlitAboveCmd::execute() {
#if USE_SLIT
if (BScreen *screen = Fluxbox::instance()->mouseScreen()) {
screen->slit()->toggleAboveDock();
const_cast<FbTk::FbWindow&>(screen->slit()->window()).raise();
}
#endif
}
REGISTER_COMMAND(toggletoolbarabove, ToggleToolbarAboveCmd, void);
void ToggleToolbarAboveCmd::execute() {
#if USE_TOOLBAR
if (BScreen *screen = Fluxbox::instance()->mouseScreen()) {
screen->toolbar()->toggleAboveDock();
const_cast<FbTk::FbWindow&>(screen->toolbar()->window()).raise();
}
#endif
}
REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd, void);
void CloseAllWindowsCmd::execute() {

View file

@ -192,6 +192,16 @@ public:
void execute();
};
class ToggleSlitAboveCmd: public FbTk::Command<void> {
public:
void execute();
};
class ToggleToolbarAboveCmd: public FbTk::Command<void> {
public:
void execute();
};
class CloseAllWindowsCmd: public FbTk::Command<void> {
public:
void execute();