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
Thomas Lübking thomas.luebking@gmail.com
3 files changed,
50 insertions(+),
0 deletions(-)
M
doc/asciidoc/fluxbox.txt
→
doc/asciidoc/fluxbox.txt
@@ -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.
M
src/Screen.cc
→
src/Screen.cc
@@ -759,6 +759,7 @@ fluxbox->getStyleOverlayFilename(),
m_root_theme->screenNum()); reconfigureTabs(); + reconfigureStruts(); } void BScreen::reconfigureTabs() {@@ -768,6 +769,42 @@ std::list<Focusable *>::const_iterator it = winlist.begin(),
it_end = winlist.end(); for (; it != it_end; ++it) (*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) {@@ -1621,6 +1658,8 @@
#else // XINERAMA m_xinerama.avail = false; #endif // XINERAMA + + reconfigureStruts(); } /* Move windows out of inactive heads */
M
src/Screen.hh
→
src/Screen.hh
@@ -341,6 +341,7 @@
void reconfigure(); void reconfigureTabs(); + void reconfigureStruts(); void rereadMenu(); void rereadWindowMenu(); void shutdown();@@ -536,6 +537,7 @@ std::vector<XineramaHeadInfo> heads;
} m_xinerama; std::vector<HeadArea*> m_head_areas; + std::vector<Strut*> m_head_struts; struct { bool cycling;