From b4992602de1c6552125112ea14073e915e19810b Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 17 May 2007 18:27:55 +0000 Subject: fixed some window placement issues --- ChangeLog | 3 +++ src/MinOverlapPlacement.cc | 28 ++++++++++++++++------------ src/ScreenPlacement.cc | 9 +++++---- src/ScreenResources.cc | 4 +++- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index a64421f..22f73c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.1: +*07/05/17: + * Fixed some window placement issues (thanks Tomas Janousek) + ScreenPlacement.cc *07/05/16: * Added new resource session.screen.noFocusWhileTypingDelay: (Mark) - specifies a time in milliseconds that new windows should not gain focus diff --git a/src/MinOverlapPlacement.cc b/src/MinOverlapPlacement.cc index 1ace23a..e7e80cb 100644 --- a/src/MinOverlapPlacement.cc +++ b/src/MinOverlapPlacement.cc @@ -72,12 +72,14 @@ bool MinOverlapPlacement::placeWindow( for (; it != it_end; ++it) { // get the dimensions of the window - int bottom = (*it)->y() + (*it)->height() + - 2*(*it)->frame().window().borderWidth(); - int top = (*it)->y(); - int right = (*it)->x() + (*it)->width() + - 2*(*it)->frame().window().borderWidth(); - int left = (*it)->x(); + int left = (*it)->x() - (*it)->xOffset(); + int top = (*it)->y() - (*it)->yOffset(); + int right = left + (*it)->width() + + 2*(*it)->frame().window().borderWidth() + + (*it)->widthOffset(); + int bottom = top + (*it)->height() + + 2*(*it)->frame().window().borderWidth() + + (*it)->heightOffset(); // go through the list of regions // if this window overlaps that region and the new window still fits, @@ -143,12 +145,14 @@ bool MinOverlapPlacement::placeWindow( for (; it != windowlist.rend(); ++it) { // get the dimensions of the window - int bottom = (*it)->y() + (*it)->height() + - 2*(*it)->frame().window().borderWidth(); - int top = (*it)->y(); - int right = (*it)->x() + (*it)->width() + - 2*(*it)->frame().window().borderWidth(); - int left = (*it)->x(); + int left = (*it)->x() - (*it)->xOffset(); + int top = (*it)->y() - (*it)->yOffset(); + int right = left + (*it)->width() + + 2*(*it)->frame().window().borderWidth() + + (*it)->widthOffset(); + int bottom = top + (*it)->height() + + 2*(*it)->frame().window().borderWidth() + + (*it)->heightOffset(); // get the coordinates of the overlap region int min_right = (right > reg_it->x + win_w) ? diff --git a/src/ScreenPlacement.cc b/src/ScreenPlacement.cc index fb79d88..85f2487 100644 --- a/src/ScreenPlacement.cc +++ b/src/ScreenPlacement.cc @@ -123,10 +123,11 @@ bool ScreenPlacement::placeWindow(const std::list &windowlist, win_h = win.height() + win.fbWindow().borderWidth()*2 + win.heightOffset(); // make sure the window is inside our screen(head) area - if (place_x + win_w > head_right) - place_x = (head_right - win_w) / 2 + win.xOffset(); - if (place_y + win_h > head_bot) - place_y = (head_bot - win_h) / 2 + win.yOffset(); + if (place_x + win_w - win.xOffset() > head_right) + place_x = head_left + (head_right - head_left - win_w) / 2 + + win.xOffset(); + if (place_y + win_h - win.yOffset() > head_bot) + place_y = head_top + (head_bot - head_top - win_h) / 2 + win.yOffset(); return true; } diff --git a/src/ScreenResources.cc b/src/ScreenResources.cc index 0f17c2a..8b71505 100644 --- a/src/ScreenResources.cc +++ b/src/ScreenResources.cc @@ -84,6 +84,7 @@ template<> string FbTk::Resource::getString() const { switch (m_value) { case BScreen::FOLLOW_ACTIVE_WINDOW: + default: return string("Follow"); break; case BScreen::FETCH_ACTIVE_WINDOW: @@ -93,7 +94,6 @@ string FbTk::Resource::getString() const { return string("SemiFollow"); break; case BScreen::IGNORE_OTHER_WORKSPACES: - default: return string("Ignore"); break; } @@ -111,6 +111,8 @@ setFromString(char const *strval) { m_value = BScreen::FETCH_ACTIVE_WINDOW; else if (strcasecmp(strval, "SemiFollow") == 0) m_value = BScreen::SEMIFOLLOW_ACTIVE_WINDOW; + else if (strcasecmp(strval, "Ignore") == 0) + m_value = BScreen::IGNORE_OTHER_WORKSPACES; else setDefaultValue(); } -- cgit v0.11.2