From 8681220f5361fef500d7eda28d9f22bbf0a006e4 Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Fri, 22 Aug 2008 03:36:26 -0700
Subject: don't apply rounded corners to windows without decorations

---
 src/FbWinFrame.cc | 30 +++++++++++-------------------
 src/FbWinFrame.hh |  4 +---
 src/Window.cc     |  4 ----
 3 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 284a1b5..f050a6d 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -91,8 +91,7 @@ FbWinFrame::FbWinFrame(BScreen &screen,
     m_height_before_shade(1),
     m_focused_alpha(AlphaAcc(*theme.focusedTheme(), &FbWinFrameTheme::alpha)),
     m_unfocused_alpha(AlphaAcc(*theme.unfocusedTheme(), &FbWinFrameTheme::alpha)),
-    m_shape(m_window, theme->shapePlace()),
-    m_disable_themeshape(false) {
+    m_shape(m_window, theme->shapePlace()) {
     init();
 }
 
@@ -994,26 +993,12 @@ void FbWinFrame::reconfigure() {
         m_need_render = true;
     }
 
-    if (m_disable_themeshape)
-        m_shape.setPlaces(FbTk::Shape::NONE);
-    else
-        m_shape.setPlaces(theme()->shapePlace());
-
+    m_shape.setPlaces(getShape());
     m_shape.setShapeOffsets(0, titlebarHeight());
 
     // titlebar stuff rendered already by reconftitlebar
 }
 
-void FbWinFrame::setUseShape(bool value) {
-    m_disable_themeshape = !value;
-
-    if (m_disable_themeshape)
-        m_shape.setPlaces(FbTk::Shape::NONE);
-    else
-        m_shape.setPlaces(theme()->shapePlace());
-
-}
-
 void FbWinFrame::setShapingClient(FbTk::FbWindow *win, bool always_update) {
     m_shape.setShapeSource(win, 0, titlebarHeight(), always_update);
 }
@@ -1319,8 +1304,6 @@ void FbWinFrame::init() {
     if (theme()->handleWidth() == 0)
         m_use_handle = false;
 
-    m_disable_themeshape = false;
-
     m_handle.showSubwindows();
 
     // clear pixmaps
@@ -1483,6 +1466,15 @@ bool FbWinFrame::useHandle() const {
     return !m_state.fullscreen && m_state.deco_mask & DECORM_HANDLE;
 }
 
+int FbWinFrame::getShape() const {
+    int shape = theme()->shapePlace();
+    if (!useTitlebar())
+        shape &= ~(FbTk::Shape::TOPRIGHT|FbTk::Shape::TOPLEFT);
+    if (!useHandle())
+        shape &= ~(FbTk::Shape::BOTTOMRIGHT|FbTk::Shape::BOTTOMLEFT);
+    return shape;
+}
+
 void FbWinFrame::applyDecorations() {
     int grav_x=0, grav_y=0;
     // negate gravity
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 3f10f54..5756c8e 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -243,6 +243,7 @@ public:
     bool useTabs() const;
     bool useTitlebar() const;
     bool useHandle() const;
+    int getShape() const;
 
     // this function translates its arguments according to win_gravity
     // if win_gravity is negative, it does an inverse translation
@@ -259,7 +260,6 @@ public:
     //@}
 
     void reconfigure();
-    void setUseShape(bool value);
     void setShapingClient(FbTk::FbWindow *win, bool always_update);
     void updateShape() { m_shape.update(); }
 
@@ -455,8 +455,6 @@ private:
     FbTk::DefaultValue<unsigned char, AlphaAcc> m_unfocused_alpha;
 
     FbTk::Shape m_shape;
-
-    bool m_disable_themeshape;
 };
 
 #endif // FBWINFRAME_HH
diff --git a/src/Window.cc b/src/Window.cc
index d7a2bee..79419d0 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1451,8 +1451,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
         if (isShaded())
             shade();
 
-        frame().setUseShape(false);
-
         m_old_layernum = layerNum();
         if (!maximized) {
             m_old_pos_x = frame().x();
@@ -1483,8 +1481,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
         fullscreen = false;
         frame().setFullscreen(false);
 
-        frame().setUseShape(true);
-
         // ensure we apply the sizehints here, otherwise some
         // apps (eg xterm) end up a little bit .. crappy (visually)
         frame().applySizeHints(m_old_width, m_old_height);
-- 
cgit v0.11.2