From d927862a8f09f8d10b7ff06e851c43d2a48e0fa6 Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Thu, 17 May 2007 18:27:59 +0000
Subject: fixed some window placement issues

---
 ChangeLog              | 4 ++++
 src/ScreenPlacement.cc | 9 +++++----
 src/ScreenResources.cc | 4 +++-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 67a487e..89540ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
  (Format: Year/Month/Day)
 Changes for 1.0.0:
+*07/05/17:
+   * Fixed some window placement issues (thanks Tomas Janousek)
+     ScreenPlacement.cc
+*07/05/16:
    * Fixed bug with fluxbox-generate_menu -is (thanks Jim Ramsay)
      util/fluxbox-generate_menu.in
 *07/05/12:
diff --git a/src/ScreenPlacement.cc b/src/ScreenPlacement.cc
index 86c0804..4b52aa4 100644
--- a/src/ScreenPlacement.cc
+++ b/src/ScreenPlacement.cc
@@ -118,10 +118,11 @@ bool ScreenPlacement::placeWindow(const std::vector<FluxboxWindow *> &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<BScreen::FollowModel>::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<BScreen::FollowModel>::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