add support for artificial struts (per head)

Allows to maintain access to desktop fractions etc. against
maximized windows. Also permits to OnToolbar clicks in this case, eg. to
raise it.

REQUEST: 150
This commit is contained in:
Thomas Lübking 2016-08-11 23:49:44 +02:00 committed by Mathias Gumz
parent 3bde5c8aee
commit f22435d60b
3 changed files with 50 additions and 0 deletions

View file

@ -1136,6 +1136,15 @@ Set this to the number of workspaces the users wants.
+
Default: *4*
*session.screen0.struts*: 'integer', 'integer', 'integer', 'integer'::
Shrink the workspace by left, right, top, bottom pixels (positive integers)
This allows you to add some padding to the workspace eg. to keep a fraction
of the desktop visible against maximized windows.
session.screen0.struts.<n> allows to control this for individual heads
(<n> starts counting at 1)
+
Default: *0,0,0,0*
*session.cacheLife*: 'minutes'::
This tells fluxbox how long unused pixmaps may stay in the X
server's memory.

View file

@ -759,6 +759,7 @@ void BScreen::reconfigure() {
m_root_theme->screenNum());
reconfigureTabs();
reconfigureStruts();
}
void BScreen::reconfigureTabs() {
@ -770,6 +771,42 @@ void BScreen::reconfigureTabs() {
(*it)->fbwindow()->applyDecorations();
}
static void parseStruts(const std::string &s, int &l, int &r, int &t, int &b) {
std::list<std::string> v;
FbTk::StringUtil::stringtok(v, s, " ,");
std::list<std::string>::iterator it = v.begin();
if (it != v.end()) l = std::max(0, atoi(it->c_str()));
if (++it != v.end()) r = std::max(0, atoi(it->c_str()));
if (++it != v.end()) t = std::max(0, atoi(it->c_str()));
if (++it != v.end()) b = std::max(0, atoi(it->c_str()));
}
void BScreen::reconfigureStruts() {
for (std::vector<Strut*>::iterator it = m_head_struts.begin(),
end = m_head_struts.end(); it != end; ++it) {
clearStrut(*it);
}
m_head_struts.clear();
int gl = 0, gr = 0, gt = 0, gb = 0;
parseStruts(FbTk::Resource<std::string>(resourceManager(), "",
name() + ".struts",
altName() + ".Struts"), gl, gr, gt, gb);
const int nh = std::max(1, numHeads());
for (int i = 1; i <= nh; ++i) {
int l = gl, r = gr, t = gt, b = gb;
char ai[16];
sprintf(ai, "%d", i);
parseStruts(FbTk::Resource<std::string>(resourceManager(), "",
name() + ".struts." + ai,
altName() + ".Struts." + ai), l, r, t, b);
if (l+t+r+b)
m_head_struts.push_back(requestStrut(i, l, r, t, b));
}
updateAvailableWorkspaceArea();
}
void BScreen::updateWorkspaceName(unsigned int w) {
Workspace *space = getWorkspace(w);
if (space) {
@ -1621,6 +1658,8 @@ void BScreen::initXinerama() {
#else // XINERAMA
m_xinerama.avail = false;
#endif // XINERAMA
reconfigureStruts();
}
/* Move windows out of inactive heads */

View file

@ -341,6 +341,7 @@ public:
void reconfigure();
void reconfigureTabs();
void reconfigureStruts();
void rereadMenu();
void rereadWindowMenu();
void shutdown();
@ -536,6 +537,7 @@ private:
} m_xinerama;
std::vector<HeadArea*> m_head_areas;
std::vector<Strut*> m_head_struts;
struct {
bool cycling;