aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonb <simonb>2006-06-24 14:05:19 (GMT)
committersimonb <simonb>2006-06-24 14:05:19 (GMT)
commit0b730c76b10babe20738067ae7aec5a102d451fe (patch)
tree727cc111eeffd9fe838a04d54da834b9d74b6905
parent1d0b23bd020c9185dc9cbf8952ab97a27f061be0 (diff)
downloadfluxbox_paul-0b730c76b10babe20738067ae7aec5a102d451fe.zip
fluxbox_paul-0b730c76b10babe20738067ae7aec5a102d451fe.tar.bz2
fix more x errors due to using an invalid background
-rw-r--r--ChangeLog6
-rw-r--r--src/Container.cc10
-rw-r--r--src/Container.hh1
-rw-r--r--src/FbTk/FbWindow.cc5
-rw-r--r--src/FbTk/FbWindow.hh2
-rw-r--r--src/FbTk/TextButton.cc7
-rw-r--r--src/FbWinFrame.cc15
7 files changed, 39 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 8547ce9..452c86d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,13 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0rc2: 2Changes for 1.0rc2:
3*06/06/24: 3*06/06/24:
4 * Fix some more X-errors (Simon)
5 - window was resized, triggering background re-render, but
6 background is invalid sometimes (during reconfiguring)
7 Container.hh/cc FbWinFrame.cc FbTk/FbWindow.hh/cc FbTk/TextButton.cc
4 * Fix bug #1362463, menu selection pixmaps disappear (Simon) 8 * Fix bug #1362463, menu selection pixmaps disappear (Simon)
5 - pixmap from image cache was put into FbPixmap, which freed it. 9 - pixmap from image cache was put into FbPixmap, which freed it.
6 FbPixmap.hh/cc MenuTheme.hh Menu.cc 10 FbTk/... FbPixmap.hh/cc MenuTheme.hh Menu.cc
7*06/06/23: 11*06/06/23:
8 * Make startfluxbox aware of --program-prefix and --program-suffix (Mark) 12 * Make startfluxbox aware of --program-prefix and --program-suffix (Mark)
9 configure.in util/Makefile.am util/startfluxbox.in 13 configure.in util/Makefile.am util/startfluxbox.in
diff --git a/src/Container.cc b/src/Container.cc
index 5e7cb7d..aec5aba 100644
--- a/src/Container.cc
+++ b/src/Container.cc
@@ -502,6 +502,14 @@ void Container::parentMoved() {
502 (*it)->parentMoved(); 502 (*it)->parentMoved();
503} 503}
504 504
505void Container::invalidateBackground() {
506 FbTk::FbWindow::invalidateBackground();
507 ItemList::iterator it = m_item_list.begin();
508 ItemList::iterator it_end = m_item_list.end();
509 for (; it != it_end; ++it)
510 (*it)->invalidateBackground();
511}
512
505void Container::clear() { 513void Container::clear() {
506 ItemList::iterator it = m_item_list.begin(); 514 ItemList::iterator it = m_item_list.begin();
507 ItemList::iterator it_end = m_item_list.end(); 515 ItemList::iterator it_end = m_item_list.end();
@@ -514,6 +522,8 @@ void Container::setOrientation(FbTk::Orientation orient) {
514 if (m_orientation == orient) 522 if (m_orientation == orient)
515 return; 523 return;
516 524
525 FbTk::FbWindow::invalidateBackground();
526
517 ItemList::iterator it = m_item_list.begin(); 527 ItemList::iterator it = m_item_list.begin();
518 ItemList::iterator it_end = m_item_list.end(); 528 ItemList::iterator it_end = m_item_list.end();
519 for (; it != it_end; ++it) 529 for (; it != it_end; ++it)
diff --git a/src/Container.hh b/src/Container.hh
index 65dfbb9..a13ddcd 100644
--- a/src/Container.hh
+++ b/src/Container.hh
@@ -84,6 +84,7 @@ public:
84 bool tryButtonReleaseEvent(XButtonEvent &event); 84 bool tryButtonReleaseEvent(XButtonEvent &event);
85 85
86 void parentMoved(); 86 void parentMoved();
87 void invalidateBackground();
87 88
88 /// accessors 89 /// accessors
89 inline Alignment alignment() const { return m_align; } 90 inline Alignment alignment() const { return m_align; }
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index b996edc..090b788 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -153,6 +153,11 @@ void FbWindow::setBackgroundPixmap(Pixmap bg_pixmap) {
153 updateBackground(false); 153 updateBackground(false);
154} 154}
155 155
156void FbWindow::invalidateBackground() {
157 m_lastbg_pm = None;
158 m_lastbg_color_set = false;
159}
160
156void FbWindow::updateBackground(bool only_if_alpha) { 161void FbWindow::updateBackground(bool only_if_alpha) {
157 Pixmap newbg = m_lastbg_pm; 162 Pixmap newbg = m_lastbg_pm;
158 unsigned char alpha = 255; 163 unsigned char alpha = 255;
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index 8f7376c..1f0c4bd 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -74,6 +74,8 @@ public:
74 virtual ~FbWindow(); 74 virtual ~FbWindow();
75 virtual void setBackgroundColor(const FbTk::Color &bg_color); 75 virtual void setBackgroundColor(const FbTk::Color &bg_color);
76 virtual void setBackgroundPixmap(Pixmap bg_pixmap); 76 virtual void setBackgroundPixmap(Pixmap bg_pixmap);
77 // call when background is freed, and new one not ready yet
78 virtual void invalidateBackground();
77 virtual void setBorderColor(const FbTk::Color &border_color); 79 virtual void setBorderColor(const FbTk::Color &border_color);
78 virtual void setBorderWidth(unsigned int size); 80 virtual void setBorderWidth(unsigned int size);
79 /// set window name ("title") 81 /// set window name ("title")
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc
index 0d9eef0..474c094 100644
--- a/src/FbTk/TextButton.cc
+++ b/src/FbTk/TextButton.cc
@@ -63,8 +63,10 @@ void TextButton::setJustify(FbTk::Justify just) {
63} 63}
64 64
65bool TextButton::setOrientation(FbTk::Orientation orient) { 65bool TextButton::setOrientation(FbTk::Orientation orient) {
66 if (!m_font->validOrientation(orient)) 66 if (orient == m_orientation
67 || !m_font->validOrientation(orient))
67 return false; 68 return false;
69 invalidateBackground();
68 70
69 if ((m_orientation == FbTk::ROT0 || m_orientation == FbTk::ROT180) && 71 if ((m_orientation == FbTk::ROT0 || m_orientation == FbTk::ROT180) &&
70 (orient == FbTk::ROT90 || orient == FbTk::ROT270) || 72 (orient == FbTk::ROT90 || orient == FbTk::ROT270) ||
@@ -76,8 +78,7 @@ bool TextButton::setOrientation(FbTk::Orientation orient) {
76 } else { 78 } else {
77 m_orientation = orient; 79 m_orientation = orient;
78 } 80 }
79 updateBackground(false); 81
80 clear();
81 return true; 82 return true;
82} 83}
83 84
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 00583d7..9df9012 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -159,7 +159,9 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
159 m_tab_container.setOrientation(FbTk::ROT0); 159 m_tab_container.setOrientation(FbTk::ROT0);
160 if (m_tab_container.parent()->window() == m_screen.rootWindow().window()) { 160 if (m_tab_container.parent()->window() == m_screen.rootWindow().window()) {
161 m_layeritem.removeWindow(m_tab_container); 161 m_layeritem.removeWindow(m_tab_container);
162 m_tab_container.hide();
162 m_tab_container.reparent(m_titlebar, m_label.x(), m_label.y()); 163 m_tab_container.reparent(m_titlebar, m_label.x(), m_label.y());
164 m_tab_container.invalidateBackground();
163 m_tab_container.resize(m_label.width(), m_label.height()); 165 m_tab_container.resize(m_label.width(), m_label.height());
164 m_tab_container.raise(); 166 m_tab_container.raise();
165 } 167 }
@@ -424,10 +426,8 @@ void FbWinFrame::alignTabs() {
424 } 426 }
425 427
426 if (m_tab_container.parent()->window() != m_screen.rootWindow().window()) { 428 if (m_tab_container.parent()->window() != m_screen.rootWindow().window()) {
427 // because the label might be using the same cached pixmap as tab container!
428 renderTitlebar();
429 applyTitlebar();
430 m_tab_container.reparent(m_screen.rootWindow(), tabx, taby); 429 m_tab_container.reparent(m_screen.rootWindow(), tabx, taby);
430 m_label.clear();
431 m_layeritem.addWindow(m_tab_container); 431 m_layeritem.addWindow(m_tab_container);
432 } else { 432 } else {
433 m_tab_container.move(tabx, taby); 433 m_tab_container.move(tabx, taby);
@@ -1000,12 +1000,15 @@ void FbWinFrame::reconfigure() {
1000 1000
1001 // we do handle settings whether on or not so that if they get toggled 1001 // we do handle settings whether on or not so that if they get toggled
1002 // then things are ok... 1002 // then things are ok...
1003 m_handle.invalidateBackground();
1003 m_handle.moveResize(-handle_bw, ypos, 1004 m_handle.moveResize(-handle_bw, ypos,
1004 m_window.width(), grip_height); 1005 m_window.width(), grip_height);
1005 1006
1007 m_grip_left.invalidateBackground();
1006 m_grip_left.moveResize(-handle_bw, -handle_bw, 1008 m_grip_left.moveResize(-handle_bw, -handle_bw,
1007 grip_width, grip_height); 1009 grip_width, grip_height);
1008 1010
1011 m_grip_right.invalidateBackground();
1009 m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw, 1012 m_grip_right.moveResize(m_handle.width() - grip_width - handle_bw, -handle_bw,
1010 grip_width, grip_height); 1013 grip_width, grip_height);
1011 1014
@@ -1089,6 +1092,7 @@ void FbWinFrame::reconfigureTitlebar() {
1089 // if the titlebar grows in size, make sure the whole window does too 1092 // if the titlebar grows in size, make sure the whole window does too
1090 if (orig_height != title_height) 1093 if (orig_height != title_height)
1091 m_window.resize(m_window.width(), m_window.height()-orig_height+title_height); 1094 m_window.resize(m_window.width(), m_window.height()-orig_height+title_height);
1095 m_titlebar.invalidateBackground();
1092 m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), 1096 m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(),
1093 m_window.width(), title_height); 1097 m_window.width(), title_height);
1094 1098
@@ -1097,6 +1101,8 @@ void FbWinFrame::reconfigureTitlebar() {
1097 unsigned int button_size = buttonHeight(); 1101 unsigned int button_size = buttonHeight();
1098 m_button_size = button_size; 1102 m_button_size = button_size;
1099 for (size_t i=0; i < m_buttons_left.size(); i++, next_x += button_size + m_bevel) { 1103 for (size_t i=0; i < m_buttons_left.size(); i++, next_x += button_size + m_bevel) {
1104 // probably on theme reconfigure, leave bg alone for now
1105 m_buttons_left[i]->invalidateBackground();
1100 m_buttons_left[i]->moveResize(next_x, m_bevel, 1106 m_buttons_left[i]->moveResize(next_x, m_bevel,
1101 button_size, button_size); 1107 button_size, button_size);
1102 } 1108 }
@@ -1114,8 +1120,10 @@ void FbWinFrame::reconfigureTitlebar() {
1114 if (space_left <= 0) 1120 if (space_left <= 0)
1115 space_left = 1; 1121 space_left = 1;
1116 1122
1123 m_label.invalidateBackground();
1117 m_label.moveResize(next_x, m_bevel, space_left, button_size); 1124 m_label.moveResize(next_x, m_bevel, space_left, button_size);
1118 1125
1126 m_tab_container.invalidateBackground();
1119 if (m_tabmode == INTERNAL) 1127 if (m_tabmode == INTERNAL)
1120 m_tab_container.moveResize(next_x, m_bevel, 1128 m_tab_container.moveResize(next_x, m_bevel,
1121 space_left, button_size); 1129 space_left, button_size);
@@ -1134,6 +1142,7 @@ void FbWinFrame::reconfigureTitlebar() {
1134 // finaly set new buttons to the right 1142 // finaly set new buttons to the right
1135 for (size_t i=0; i < m_buttons_right.size(); 1143 for (size_t i=0; i < m_buttons_right.size();
1136 ++i, next_x += button_size + m_bevel) { 1144 ++i, next_x += button_size + m_bevel) {
1145 m_buttons_right[i]->invalidateBackground();
1137 m_buttons_right[i]->moveResize(next_x, m_bevel, 1146 m_buttons_right[i]->moveResize(next_x, m_bevel,
1138 button_size, button_size); 1147 button_size, button_size);
1139 } 1148 }