From 83a3429c395299b5acb85a3f372091037fe12603 Mon Sep 17 00:00:00 2001
From: simonb <simonb>
Date: Fri, 14 Apr 2006 15:26:25 +0000
Subject: more button state fixing for shade, should be right now plus noticed
 typo in theme for unshade

---
 src/WinButton.cc      | 12 ++++++++++--
 src/WinButtonTheme.cc |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/WinButton.cc b/src/WinButton.cc
index afdfb7f..4f50935 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -187,9 +187,9 @@ Pixmap WinButton::getPressedPixmap() const {
         return m_theme.closePressedPixmap().pixmap().drawable();
     case SHADE:
         if (m_listen_to.isShaded())
-            return m_theme.shadePressedPixmap().pixmap().drawable();
-        else
             return m_theme.unshadePressedPixmap().pixmap().drawable();
+        else
+            return m_theme.shadePressedPixmap().pixmap().drawable();
     case MENUICON:
         if (m_icon_pixmap.drawable())
             if (m_listen_to.isFocused())
@@ -382,5 +382,13 @@ void WinButton::update(FbTk::Subject *subj) {
     if (my_pm != None)
         setBackgroundPixmap(my_pm);
 
+    // incorrect, pressed_pixmap is stateful in shade, so we'll do oneoff for now
+    if (m_type == SHADE) {
+        Pixmap p_pm = getPressedPixmap();
+        if (p_pm != None)
+            setPressedPixmap(p_pm);
+    }
+        
+
     clear();
 }
diff --git a/src/WinButtonTheme.cc b/src/WinButtonTheme.cc
index 11041f2..22e86fc 100644
--- a/src/WinButtonTheme.cc
+++ b/src/WinButtonTheme.cc
@@ -44,7 +44,7 @@ WinButtonTheme::WinButtonTheme(int screen_num, FbWinFrameTheme &frame_theme):
     m_shade_unfocus_pm(*this, "window.shade.unfocus.pixmap", "Window.Shade.Unfocus.Pixmap"),
     m_shade_pressed_pm(*this, "window.shade.pressed.pixmap", "Window.Shade.Pressed.Pixmap"),
     m_unshade_pm(*this, "window.unshade.pixmap", "Window.Unshade.Pixmap"),
-    m_unshade_unfocus_pm(*this, "window.unshade.unfocus.pixmap", "Window.Unhade.Unfocus.Pixmap"),
+    m_unshade_unfocus_pm(*this, "window.unshade.unfocus.pixmap", "Window.Unshade.Unfocus.Pixmap"),
     m_unshade_pressed_pm(*this, "window.unshade.pressed.pixmap", "Window.Unshade.Pressed.Pixmap"),
     m_menuicon_pm(*this, "window.menuicon.pixmap", "Window.MenuIcon.Pixmap"),
     m_menuicon_unfocus_pm(*this, "window.menuicon.unfocus.pixmap", "Window.MenuIcon.Unfocus.Pixmap"),
-- 
cgit v0.11.2