aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-08-11 21:49:44 (GMT)
committerMathias Gumz <akira@fluxbox.org>2016-08-26 06:06:47 (GMT)
commitf22435d60bf7a52e00608576074dd791e8731bf2 (patch)
tree36ba52c636a69d72ca260a5091584f2e50303eb7
parent3bde5c8aee16f7f33e3ce7b9058fded916fe2369 (diff)
downloadfluxbox-f22435d60bf7a52e00608576074dd791e8731bf2.zip
fluxbox-f22435d60bf7a52e00608576074dd791e8731bf2.tar.bz2
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
-rw-r--r--doc/asciidoc/fluxbox.txt9
-rw-r--r--src/Screen.cc39
-rw-r--r--src/Screen.hh2
3 files changed, 50 insertions, 0 deletions
diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt
index 3afec68..87bd554 100644
--- a/doc/asciidoc/fluxbox.txt
+++ b/doc/asciidoc/fluxbox.txt
@@ -1136,6 +1136,15 @@ Set this to the number of workspaces the users wants.
1136+ 1136+
1137Default: *4* 1137Default: *4*
1138 1138
1139*session.screen0.struts*: 'integer', 'integer', 'integer', 'integer'::
1140Shrink the workspace by left, right, top, bottom pixels (positive integers)
1141This allows you to add some padding to the workspace eg. to keep a fraction
1142of the desktop visible against maximized windows.
1143session.screen0.struts.<n> allows to control this for individual heads
1144(<n> starts counting at 1)
1145+
1146Default: *0,0,0,0*
1147
1139*session.cacheLife*: 'minutes':: 1148*session.cacheLife*: 'minutes'::
1140This tells fluxbox how long unused pixmaps may stay in the X 1149This tells fluxbox how long unused pixmaps may stay in the X
1141server's memory. 1150server's memory.
diff --git a/src/Screen.cc b/src/Screen.cc
index 94e4250..24e0607 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -759,6 +759,7 @@ void BScreen::reconfigure() {
759 m_root_theme->screenNum()); 759 m_root_theme->screenNum());
760 760
761 reconfigureTabs(); 761 reconfigureTabs();
762 reconfigureStruts();
762} 763}
763 764
764void BScreen::reconfigureTabs() { 765void BScreen::reconfigureTabs() {
@@ -770,6 +771,42 @@ void BScreen::reconfigureTabs() {
770 (*it)->fbwindow()->applyDecorations(); 771 (*it)->fbwindow()->applyDecorations();
771} 772}
772 773
774static void parseStruts(const std::string &s, int &l, int &r, int &t, int &b) {
775 std::list<std::string> v;
776 FbTk::StringUtil::stringtok(v, s, " ,");
777 std::list<std::string>::iterator it = v.begin();
778 if (it != v.end()) l = std::max(0, atoi(it->c_str()));
779 if (++it != v.end()) r = std::max(0, atoi(it->c_str()));
780 if (++it != v.end()) t = std::max(0, atoi(it->c_str()));
781 if (++it != v.end()) b = std::max(0, atoi(it->c_str()));
782}
783
784void BScreen::reconfigureStruts() {
785 for (std::vector<Strut*>::iterator it = m_head_struts.begin(),
786 end = m_head_struts.end(); it != end; ++it) {
787 clearStrut(*it);
788 }
789
790 m_head_struts.clear();
791
792 int gl = 0, gr = 0, gt = 0, gb = 0;
793 parseStruts(FbTk::Resource<std::string>(resourceManager(), "",
794 name() + ".struts",
795 altName() + ".Struts"), gl, gr, gt, gb);
796 const int nh = std::max(1, numHeads());
797 for (int i = 1; i <= nh; ++i) {
798 int l = gl, r = gr, t = gt, b = gb;
799 char ai[16];
800 sprintf(ai, "%d", i);
801 parseStruts(FbTk::Resource<std::string>(resourceManager(), "",
802 name() + ".struts." + ai,
803 altName() + ".Struts." + ai), l, r, t, b);
804 if (l+t+r+b)
805 m_head_struts.push_back(requestStrut(i, l, r, t, b));
806 }
807 updateAvailableWorkspaceArea();
808}
809
773void BScreen::updateWorkspaceName(unsigned int w) { 810void BScreen::updateWorkspaceName(unsigned int w) {
774 Workspace *space = getWorkspace(w); 811 Workspace *space = getWorkspace(w);
775 if (space) { 812 if (space) {
@@ -1621,6 +1658,8 @@ void BScreen::initXinerama() {
1621#else // XINERAMA 1658#else // XINERAMA
1622 m_xinerama.avail = false; 1659 m_xinerama.avail = false;
1623#endif // XINERAMA 1660#endif // XINERAMA
1661
1662 reconfigureStruts();
1624} 1663}
1625 1664
1626/* Move windows out of inactive heads */ 1665/* Move windows out of inactive heads */
diff --git a/src/Screen.hh b/src/Screen.hh
index ae279f3..32a7f7a 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -341,6 +341,7 @@ public:
341 341
342 void reconfigure(); 342 void reconfigure();
343 void reconfigureTabs(); 343 void reconfigureTabs();
344 void reconfigureStruts();
344 void rereadMenu(); 345 void rereadMenu();
345 void rereadWindowMenu(); 346 void rereadWindowMenu();
346 void shutdown(); 347 void shutdown();
@@ -536,6 +537,7 @@ private:
536 } m_xinerama; 537 } m_xinerama;
537 538
538 std::vector<HeadArea*> m_head_areas; 539 std::vector<HeadArea*> m_head_areas;
540 std::vector<Strut*> m_head_struts;
539 541
540 struct { 542 struct {
541 bool cycling; 543 bool cycling;