fix cascade placement for multiple heads
This commit is contained in:
parent
a88511a4a7
commit
51f7970f74
7 changed files with 39 additions and 34 deletions
|
@ -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
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// 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"
|
||||
|
@ -545,10 +545,6 @@ void FbWinFrame::reconfigure() {
|
|||
// titlebar stuff rendered already by reconftitlebar
|
||||
}
|
||||
|
||||
unsigned int FbWinFrame::titleHeight() const {
|
||||
return m_theme.font().height();
|
||||
}
|
||||
|
||||
unsigned int FbWinFrame::buttonHeight() const {
|
||||
return m_titlebar.height() - m_bevel*2;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// 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 @@ public:
|
|||
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;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// 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 {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// 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 @@ public:
|
|||
|
||||
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;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// 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 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int
|
|||
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(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int
|
|||
|
||||
|
||||
Workspace::~Workspace() {
|
||||
|
||||
delete [] m_cascade_x;
|
||||
delete [] m_cascade_y;
|
||||
}
|
||||
|
||||
void Workspace::setLastFocusedWindow(FluxboxWindow *win) {
|
||||
|
@ -569,8 +576,7 @@ void Workspace::placeWindow(FluxboxWindow &win) {
|
|||
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 @@ void Workspace::placeWindow(FluxboxWindow &win) {
|
|||
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 &&
|
||||
|
@ -637,7 +638,6 @@ void Workspace::placeWindow(FluxboxWindow &win) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (placed) {
|
||||
place_x = test_x;
|
||||
place_y = test_y;
|
||||
|
@ -657,15 +657,21 @@ void Workspace::placeWindow(FluxboxWindow &win) {
|
|||
// 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)
|
||||
|
|
|
@ -111,7 +111,7 @@ private:
|
|||
|
||||
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)
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue