all repos — fluxbox @ e3ab62fed1e63be3e7f6b81c316b15097638faf6

custom fork of the fluxbox windowmanager

added strut support
fluxgen fluxgen
commit

e3ab62fed1e63be3e7f6b81c316b15097638faf6

parent

501168b557f4c21ca10dfdaad7776c125968363a

6 files changed, 147 insertions(+), 12 deletions(-)

jump to
M src/Slit.ccsrc/Slit.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Slit.cc,v 1.60 2003/06/13 05:03:43 fluxgen Exp $ +// $Id: Slit.cc,v 1.61 2003/06/18 13:49:43 fluxgen Exp $ #include "Slit.hh"

@@ -291,7 +291,8 @@ m_kwm2_dockwindow(XInternAtom(FbTk::App::instance()->display(),

"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False)), //KDE v2.x m_layeritem(0), - m_slit_theme(new SlitTheme(*this)) { + m_slit_theme(new SlitTheme(*this)), + m_strut(0) { // default placement and direction m_direction = screen().getSlitDirection();

@@ -339,10 +340,65 @@ }

Slit::~Slit() { + clearStrut(); if (frame.pixmap != 0) screen().imageControl().removeImage(frame.pixmap); } +void Slit::clearStrut() { + if (m_strut != 0) { + screen().clearStrut(m_strut); + m_strut = 0; + } +} + +void Slit::updateStrut() { + clearStrut(); + // no need for area if we're autohiding + if (doAutoHide()) + return; + + int left = 0, right = 0, top = 0, bottom = 0; + switch (placement()) { + case TOPLEFT: + top = height(); + left = width(); + break; + case TOPCENTER: + top = height(); + break; + case TOPRIGHT: + right = width(); + top = height(); + break; + case BOTTOMLEFT: + bottom = height(); + left = width(); + break; + case BOTTOMCENTER: + // would be strange to have it request size on vertical direction + // each time we add a client + if (direction() == HORIZONTAL) + bottom = height(); + break; + case BOTTOMRIGHT: + if (direction() == HORIZONTAL) + bottom = height(); + else + right = width(); + break; + case CENTERLEFT: + if (direction() == VERTICAL) + left = width(); + break; + case CENTERRIGHT: + if (direction() == VERTICAL) + right = width(); + break; + } + m_strut = screen().requestStrut(left, right, top, bottom); + screen().updateAvailableWorkspaceArea(); +} void Slit::addClient(Window w) { #ifdef DEBUG

@@ -777,6 +833,7 @@ m_timer.start();

m_slitmenu.reconfigure(); updateClientmenu(); + updateStrut(); }
M src/Slit.hhsrc/Slit.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -/// $Id: Slit.hh,v 1.30 2003/05/17 11:00:50 fluxgen Exp $ +/// $Id: Slit.hh,v 1.31 2003/06/18 13:49:43 fluxgen Exp $ #ifndef SLIT_HH #define SLIT_HH

@@ -44,6 +44,7 @@ class SlitTheme;

class SlitClient; class BScreen; class FbMenu; +class Strut; /// Handles dock apps class Slit : public FbTk::TimeoutHandler, public FbTk::EventHandler {

@@ -117,6 +118,8 @@

void removeClient(SlitClient *client, bool remap, bool destroy); void loadClientList(const char *filename); void updateClientmenu(); + void clearStrut(); + void updateStrut(); bool m_hidden, m_do_auto_hide; Direction m_direction;

@@ -147,6 +150,7 @@ std::auto_ptr<FbTk::XLayerItem> m_layeritem;

std::auto_ptr<SlitTheme> m_slit_theme; std::auto_ptr<FbTk::Transparent> m_transp; static unsigned int s_eventmask; + Strut *m_strut; };
M src/Toolbar.ccsrc/Toolbar.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.90 2003/06/13 05:04:14 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.91 2003/06/18 13:50:40 fluxgen Exp $ #include "Toolbar.hh"

@@ -43,6 +43,7 @@ #include "RootTheme.hh"

#include "BoolMenuItem.hh" #include "FbWinFrameTheme.hh" #include "Xinerama.hh" +#include "Strut.hh" // use GNU extensions #ifndef _GNU_SOURCE

@@ -279,7 +280,8 @@ true),

m_theme(scrn.screenNumber()), m_place(scrn.toolbarPlacement()), m_themelistener(*this), - m_layeritem(frame.window, layer) { + m_layeritem(frame.window, layer), + m_strut(0) { // we need to get notified when the theme is reloaded m_theme.addListener(m_themelistener);

@@ -339,6 +341,7 @@ }

Toolbar::~Toolbar() { + clearStrut(); FbTk::ImageControl &image_ctrl = screen().imageControl(); if (frame.base) image_ctrl.removeImage(frame.base); if (frame.label) image_ctrl.removeImage(frame.label);

@@ -349,6 +352,48 @@ if (frame.pbutton) image_ctrl.removeImage(frame.pbutton);

} +void Toolbar::clearStrut() { + if (m_strut) { + screen().clearStrut(m_strut); + m_strut = 0; + } +} + +void Toolbar::updateStrut() { + clearStrut(); + // we should request space if we're in autohide mode or + // if the user dont want to request space for toolbar. + if (doAutoHide()) + return; + + // request area on screen + int top = 0, bottom = 0, left = 0, right = 0; + switch (m_place) { + case TOPLEFT: + case TOPCENTER: + case TOPRIGHT: + top = height(); + break; + case BOTTOMLEFT: + case BOTTOMCENTER: + case BOTTOMRIGHT: + bottom = height(); + break; + case RIGHTTOP: + case RIGHTCENTER: + case RIGHTBOTTOM: + right = width(); + break; + case LEFTTOP: + case LEFTCENTER: + case LEFTBOTTOM: + left = width(); + break; + }; + m_strut = screen().requestStrut(left, right, top, bottom); + screen().updateAvailableWorkspaceArea(); +} + bool Toolbar::isVertical() const { return (m_place == RIGHTCENTER || m_place == RIGHTTOP ||

@@ -702,7 +747,9 @@ redrawWorkspaceLabel();

checkClock(true); m_toolbarmenu.reconfigure(); - + // we're done with all resizing and stuff now we can request a new + // area to be reserv on screen + updateStrut(); }
M src/Toolbar.hhsrc/Toolbar.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.hh,v 1.32 2003/06/11 14:50:57 fluxgen Exp $ +// $Id: Toolbar.hh,v 1.33 2003/06/18 13:50:40 fluxgen Exp $ #ifndef TOOLBAR_HH #define TOOLBAR_HH

@@ -42,6 +42,8 @@

#include <memory> class BScreen; +class Strut; + namespace FbTk { class ImageControl; };

@@ -133,6 +135,8 @@ virtual void timeout();

private: + void clearStrut(); + void updateStrut(); bool editing; ///< edit workspace label mode bool hidden; ///< hidden state

@@ -189,6 +193,8 @@

ThemeListener m_themelistener; FbTk::XLayerItem m_layeritem; + + Strut *m_strut; ///< created and destroyed by BScreen };
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.192 2003/06/15 18:35:32 fluxgen Exp $ +// $Id: Window.cc,v 1.193 2003/06/18 13:55:17 fluxgen Exp $ #include "Window.hh"

@@ -246,6 +246,7 @@ m_windowmenu(menutheme, scr.screenNumber(), scr.imageControl()),

m_old_decoration(DECOR_NORMAL), m_client(&client), m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), + m_strut(0), m_layeritem(m_frame->window(), layer), m_layernum(layer.getLayerNum()), m_parent(scr.rootWindow()) {

@@ -279,6 +280,7 @@ m_windowmenu(menutheme, scr.screenNumber(), scr.imageControl()),

m_old_decoration(DECOR_NORMAL), m_client(new WinClient(w, *this)), m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), + m_strut(0), m_layeritem(m_frame->window(), layer), m_layernum(layer.getLayerNum()), m_parent(scr.rootWindow()) {

@@ -296,6 +298,9 @@ cerr<<__FILE__<<"("<<__LINE__<<"): num clients = "<<numClients()<<endl;

cerr<<__FILE__<<"("<<__LINE__<<"): curr client = "<<m_client<<endl; cerr<<__FILE__<<"("<<__LINE__<<"): m_labelbuttons.size = "<<m_labelbuttons.size()<<endl; #endif // DEBUG + + clearStrut(); + if (moving || resizing || m_attaching_tab) { screen().hideGeometry(); XUngrabPointer(display, CurrentTime);

@@ -1989,8 +1994,6 @@ propertyNotifyEvent(event.xproperty.atom);

} break; - - default: #ifdef SHAPE if (Fluxbox::instance()->haveShape() &&

@@ -2711,6 +2714,18 @@ } else {

setDecoration(m_old_decoration); } decorations.enabled = true; + } +} + +void FluxboxWindow::setStrut(Strut *strut) { + clearStrut(); + m_strut = strut; +} + +void FluxboxWindow::clearStrut() { + if (m_strut != 0) { + screen().clearStrut(m_strut); + m_strut = 0; } }
M src/Window.hhsrc/Window.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.78 2003/06/15 18:34:48 fluxgen Exp $ +// $Id: Window.hh,v 1.79 2003/06/18 13:55:16 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH

@@ -44,9 +44,10 @@

class WinClient; class FbWinFrameTheme; class BScreen; +class Strut; + class TextButton; class FbWinFrame; - namespace FbTk { class MenuTheme; class ImageControl;

@@ -242,6 +243,9 @@ DECORM_ENABLED = (1<<10),

DECORM_LAST = (1<<11) // useful for getting "All" }; + void setStrut(Strut *strut); + void clearStrut(); + unsigned int decorationMask() const; void setDecorationMask(unsigned int mask);

@@ -440,6 +444,8 @@ unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state

int m_last_button_x, ///< last known x position of the mouse button m_last_button_y; ///< last known y position of the mouse button std::auto_ptr<FbWinFrame> m_frame; + + Strut *m_strut; FbTk::XLayerItem m_layeritem; int m_layernum;