all repos — fluxbox @ 51f7970f7494710df2d015afca2007ceebbe7b2d

custom fork of the fluxbox windowmanager

fix cascade placement for multiple heads
rathnor rathnor
commit

51f7970f7494710df2d015afca2007ceebbe7b2d

parent

a88511a4a772ec021029649905b7ce645ff9a597

M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.3: +*03/05/21: + * Fix cascade placement for multiple heads (Simon) + Workspace.hh/cc Window.hh/cc FbWinFrame.hh/cc *03/05/20: * Add xinerama for placement and snapping, plus tidy (Simon) Screen.hh/cc Window.cc Workspace.cc
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -19,7 +19,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: FbWinFrame.cc,v 1.24 2003/05/15 11:17:26 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.25 2003/05/21 23:59:53 rathnor Exp $ #include "FbWinFrame.hh" #include "ImageControl.hh"

@@ -543,10 +543,6 @@ renderButtons();

if (!m_shaded) renderHandles(); // titlebar stuff rendered already by reconftitlebar -} - -unsigned int FbWinFrame::titleHeight() const { - return m_theme.font().height(); } unsigned int FbWinFrame::buttonHeight() const {
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -19,7 +19,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: FbWinFrame.hh,v 1.7 2003/05/01 13:19:36 rathnor Exp $ +// $Id: FbWinFrame.hh,v 1.8 2003/05/21 23:59:53 rathnor Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH

@@ -153,7 +153,7 @@ inline bool focused() const { return m_focused; }

inline bool isShaded() const { return m_shaded; } inline const FbWinFrameTheme &theme() const { return m_theme; } /// @return titlebar height - unsigned int titleHeight() const; + unsigned int titlebarHeight() const { return m_titlebar.height(); } /// @return size of button unsigned int buttonHeight() const;
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.183 2003/05/20 11:03:10 rathnor Exp $ +// $Id: Window.cc,v 1.184 2003/05/21 23:59:53 rathnor Exp $ #include "Window.hh"

@@ -3151,8 +3151,8 @@ unsigned int FluxboxWindow::height() const {

return frame().height(); } -unsigned int FluxboxWindow::titleHeight() const { - return frame().titleHeight(); +unsigned int FluxboxWindow::titlebarHeight() const { + return frame().titlebarHeight(); } Window FluxboxWindow::clientWindow() const {
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.73 2003/05/15 11:17:27 fluxgen Exp $ +// $Id: Window.hh,v 1.74 2003/05/21 23:59:53 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH

@@ -303,7 +303,7 @@ void setLayerNum(int layernum);

unsigned int width() const; unsigned int height() const; - unsigned int titleHeight() const; + unsigned int titlebarHeight() const; const std::string &className() const { return m_class_name; } const std::string &instanceName() const { return m_instance_name; } bool isLowerTab() const;
M src/Workspace.ccsrc/Workspace.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: Workspace.cc,v 1.68 2003/05/20 11:03:11 rathnor Exp $ +// $Id: Workspace.cc,v 1.69 2003/05/21 23:59:54 rathnor Exp $ #include "Workspace.hh"

@@ -119,9 +119,15 @@ m_lastfocus(0),

m_clientmenu(*scrn.menuTheme(), scrn.screenNumber(), scrn.imageControl()), m_layermanager(layermanager), m_name(""), - m_id(i), - m_cascade_x(32), m_cascade_y(32) { + m_id(i) { + + m_cascade_x = new int[scrn.numHeads()+1]; + m_cascade_y = new int[scrn.numHeads()+1]; + for (int i=0; i < scrn.numHeads()+1; i++) { + m_cascade_x[i] = 32 + scrn.getHeadX(i); + m_cascade_y[i] = 32 + scrn.getHeadY(i); + } m_clientmenu.setInternalMenu(); setName(screen().getNameOfWorkspace(m_id));

@@ -129,7 +135,8 @@ }

Workspace::~Workspace() { - + delete [] m_cascade_x; + delete [] m_cascade_y; } void Workspace::setLastFocusedWindow(FluxboxWindow *win) {

@@ -569,8 +576,7 @@

curr_x = window.x(); curr_y = window.y(); curr_w = window.width() + window.fbWindow().borderWidth()*2; - curr_h = window.isShaded() ? window.titleHeight() : - window.height() + window.fbWindow().borderWidth()*2; + curr_h = window.height() + window.fbWindow().borderWidth()*2; if (curr_x < test_x + win_w && curr_x + curr_w > test_x &&

@@ -621,13 +627,8 @@ Windows::iterator it_end = m_windowlist.end();

for (; it != it_end && placed; ++it) { curr_x = (*it)->x(); curr_y = (*it)->y(); - curr_w = (*it)->width() + (*it)->fbWindow().borderWidth()*2; - curr_h = - (((*it)->isShaded()) - ? (*it)->titleHeight() - : (*it)->height()) + - (*it)->fbWindow().borderWidth()*2; - + curr_w = (*it)->width() + (*it)->fbWindow().borderWidth()*2; + curr_h = (*it)->height() + (*it)->fbWindow().borderWidth()*2; if (curr_x < test_x + win_w && curr_x + curr_w > test_x &&

@@ -636,7 +637,6 @@ curr_y + curr_h > test_y) {

placed = False; } } - if (placed) { place_x = test_x;

@@ -657,15 +657,21 @@

// cascade placement or smart placement failed if (! placed) { - if ((m_cascade_x > ((head_left + head_right) / 2)) || - (m_cascade_y > ((head_top + head_bot) / 2))) - m_cascade_x = m_cascade_y = 32; + if ((m_cascade_x[head] > ((head_left + head_right) / 2)) || + (m_cascade_y[head] > ((head_top + head_bot) / 2))) { + m_cascade_x[head] = head_left + 32; + m_cascade_y[head] = head_top + 32; + } - place_x = m_cascade_x; - place_y = m_cascade_y; + place_x = m_cascade_x[head]; + place_y = m_cascade_y[head]; - m_cascade_x += win.titleHeight(); - m_cascade_y += win.titleHeight(); + // just one borderwidth, so they can share a borderwidth (looks better) + int titlebar_height = win.titlebarHeight() + win.fbWindow().borderWidth(); + if (titlebar_height < 4) // make sure it is not insignificant + titlebar_height = 32; + m_cascade_x[head] += titlebar_height; + m_cascade_y[head] += titlebar_height; } if (place_x + win_w > head_right)
M src/Workspace.hhsrc/Workspace.hh

@@ -111,7 +111,7 @@ Windows m_windowlist;

std::string m_name; ///< name of this workspace unsigned int m_id; ///< id, obsolete, this should be in BScreen - int m_cascade_x, m_cascade_y; + int *m_cascade_x, *m_cascade_y; // need a cascade for each head (Xinerama) };