From bf9b60833f87a8b328d71dac5879bdf7a0300d6e Mon Sep 17 00:00:00 2001
From: simonb <simonb>
Date: Sun, 25 Jun 2006 14:59:34 +0000
Subject: fix FbPixmap retaining pixmap (that made cache not work properly)
 Also small tidy in FbWinFrame.cc

---
 ChangeLog            |  4 ++++
 src/FbTk/FbPixmap.cc | 25 +++++++++----------------
 src/FbWinFrame.cc    |  5 +++--
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 15001b9..1d9f352 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
  (Format: Year/Month/Day)
 Changes for 1.0rc2:
 *06/06/25:
+   * Fix [ 1512046 ] "window.label.unfocus.pixmap" doesn't update (Simon)
+     - FbPixmap::copy was keeping the same pixmap if they had same 
+       dimensions. This effectively broke the image cache.
+     FbPixmap.cc
    * Explicitly map NoSymbol to keycode 0 (thanks Julien Trolet)
      (seems to be assigned to several keycodes)
      FbTk/KeyUtil.cc
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index 46ee97c..3aebd62 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -126,24 +126,17 @@ FbPixmap &FbPixmap::operator = (Pixmap pm) {
 }
 
 void FbPixmap::copy(const FbPixmap &the_copy) {
-
-    bool create_new = false;
-
-    if (the_copy.width() != width() ||
-        the_copy.height() != height() ||
-        the_copy.depth() != depth() ||
-        drawable() == 0)
-        create_new = true;
-
-    if (create_new)
-        free();
+    /* This function previously retained the old pixmap and copied in
+       the new contents if they had the same dimensions.
+       This broke the image cache, so we don't do that now. If you want to
+       do it, then you'll need to invalidate all copies of this pixmap in
+       the cache */
+    free();
 
     if (the_copy.drawable() != 0) {
-        if (create_new) {
-            create(the_copy.drawable(),
-                   the_copy.width(), the_copy.height(),
-                   the_copy.depth());
-        }
+        create(the_copy.drawable(),
+               the_copy.width(), the_copy.height(),
+               the_copy.depth());
 
         if (drawable()) {
             GContext gc(drawable());
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 9e7eedf..eafcb79 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -1204,7 +1204,6 @@ void FbWinFrame::renderTitlebar() {
            m_label_unfocused_pm,
            m_label.width(), m_label.height());
 
-    renderButtons();
 }
 
 void FbWinFrame::renderTabContainer() {
@@ -1241,6 +1240,8 @@ void FbWinFrame::renderTabContainer() {
            m_labelbutton_active_pm,
            m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
 
+    renderButtons();
+
 }
 
 void FbWinFrame::applyTitlebar() {
@@ -1591,7 +1592,7 @@ void FbWinFrame::applyActiveLabel(FbTk::TextButton &button) {
     button.setAlpha(m_focused?theme().focusedAlpha():theme().unfocusedAlpha());
 
     if (m_labelbutton_active_pm != 0) {
-            button.setBackgroundPixmap(m_labelbutton_active_pm);
+        button.setBackgroundPixmap(m_labelbutton_active_pm);
     } else
         button.setBackgroundColor(m_labelbutton_active_color);
 
-- 
cgit v0.11.2