From 822c02e96a88a90540fa622afa5ab196b9ba5a7c Mon Sep 17 00:00:00 2001
From: nacitar sevaht <nacitar@ubercpp.com>
Date: Mon, 16 May 2011 15:05:30 -0500
Subject: TextDialog now handles parentrelative labels

Prior to this patch, TextDialog did not handle parentrelative labels;
borrowing code from OSDWindow, now TextDialog properly handles this.

Eventually, I plan to combine the good parts of TextDialog and OSDWindow
into OSDWindow, and then let TextDialog derive from OSDWindow... but for
now, here's the band-aid fix for the issue without the refactorization.
---
 src/TextDialog.cc | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/TextDialog.cc b/src/TextDialog.cc
index dc35dbe..f86c1e6 100644
--- a/src/TextDialog.cc
+++ b/src/TextDialog.cc
@@ -135,19 +135,28 @@ void TextDialog::keyPressEvent(XKeyEvent &event) {
 }
 
 void TextDialog::render() {
-    Pixmap tmp = m_pixmap;
-    if (!m_screen.focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) {
-        m_label.setBackgroundColor(m_screen.focusedWinFrameTheme()->iconbarTheme().texture().color());
-        m_pixmap = 0;
+    if (m_screen.focusedWinFrameTheme()->iconbarTheme().texture().type() &
+        FbTk::Texture::PARENTRELATIVE) {
+        if (!m_screen.focusedWinFrameTheme()->titleTexture().usePixmap()) {
+            m_pixmap = None;
+            m_label.setBackgroundColor(m_screen.focusedWinFrameTheme()->titleTexture().color());
+        } else {
+            m_pixmap = m_screen.imageControl().renderImage(m_label.width(), m_label.height(),
+                    m_screen.focusedWinFrameTheme()->titleTexture());
+            m_label.setBackgroundPixmap(m_pixmap);
+        }
     } else {
-        m_pixmap = m_screen.imageControl().renderImage(m_label.width(), m_label.height(),
-                                                       m_screen.focusedWinFrameTheme()->iconbarTheme().texture());
-        m_label.setBackgroundPixmap(m_pixmap);
+        if (!m_screen.focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) {
+            m_pixmap = None;
+            m_label.setBackgroundColor(m_screen.focusedWinFrameTheme()->iconbarTheme().texture().color());
+        } else {
+            m_pixmap = m_screen.imageControl().renderImage(m_label.width(), m_label.height(),
+                    m_screen.focusedWinFrameTheme()->iconbarTheme().texture());
+            m_label.setBackgroundPixmap(m_pixmap);
+        }
     }
-
-    if (tmp)
-        m_screen.imageControl().removeImage(tmp);
-
+    if (m_pixmap)
+        m_screen.imageControl().removeImage(m_pixmap);
 }
 
 void TextDialog::init() {
-- 
cgit v0.11.2