aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/TextButton.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2005-04-02 14:59:38 (GMT)
committersimonb <simonb>2005-04-02 14:59:38 (GMT)
commit007c495239f0dc111bfc94610fb561320ec27232 (patch)
treee077f83dd601bc7b9e3ece85a7b9503c05e137de /src/FbTk/TextButton.cc
parent62431956b4813e45a77c4b0c925fdb8eba3305e8 (diff)
downloadfluxbox-007c495239f0dc111bfc94610fb561320ec27232.zip
fluxbox-007c495239f0dc111bfc94610fb561320ec27232.tar.bz2
Tidy up some redundant pixmap allocs
Diffstat (limited to 'src/FbTk/TextButton.cc')
-rw-r--r--src/FbTk/TextButton.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc
index 30cc62a..e623b9a 100644
--- a/src/FbTk/TextButton.cc
+++ b/src/FbTk/TextButton.cc
@@ -43,7 +43,10 @@ TextButton::TextButton(const FbTk::FbWindow &parent,
43} 43}
44 44
45void TextButton::resize(unsigned int width, unsigned int height) { 45void TextButton::resize(unsigned int width, unsigned int height) {
46 m_buffer.resize(width, height); 46 if (this->width() == width && height == this->height())
47 return;
48
49 m_buffer.resize(width, height);
47 50
48 if (backgroundPixmap() != ParentRelative) 51 if (backgroundPixmap() != ParentRelative)
49 FbWindow::setBackgroundPixmap(m_buffer.drawable()); 52 FbWindow::setBackgroundPixmap(m_buffer.drawable());
@@ -52,10 +55,16 @@ void TextButton::resize(unsigned int width, unsigned int height) {
52 55
53void TextButton::moveResize(int x, int y, 56void TextButton::moveResize(int x, int y,
54 unsigned int width, unsigned int height) { 57 unsigned int width, unsigned int height) {
55 m_buffer.resize(width, height); 58 if (this->width() == width && height == this->height() &&
59 x == this->x() && y == this->y())
60 return;
61
62 if (this->width() != width || height != this->height())
63 m_buffer.resize(width, height);
56 64
57 if (backgroundPixmap() != ParentRelative) 65 if (backgroundPixmap() != ParentRelative)
58 FbWindow::setBackgroundPixmap(m_buffer.drawable()); 66 FbWindow::setBackgroundPixmap(m_buffer.drawable());
67
59 Button::moveResize(x, y, width, height); 68 Button::moveResize(x, y, width, height);
60} 69}
61 70
@@ -104,7 +113,6 @@ void TextButton::clearArea(int x, int y,
104 unsigned int width, unsigned int height, 113 unsigned int width, unsigned int height,
105 bool exposure) { 114 bool exposure) {
106 if (backgroundPixmap() != ParentRelative) { 115 if (backgroundPixmap() != ParentRelative) {
107
108 if (backgroundPixmap()) { 116 if (backgroundPixmap()) {
109 m_buffer.copyArea(backgroundPixmap(), 117 m_buffer.copyArea(backgroundPixmap(),
110 gc(), 118 gc(),
@@ -120,7 +128,6 @@ void TextButton::clearArea(int x, int y,
120 width, height); 128 width, height);
121 129
122 } 130 }
123
124 drawText(); 131 drawText();
125 132
126 setBufferPixmap(m_buffer.drawable()); 133 setBufferPixmap(m_buffer.drawable());
@@ -163,6 +170,7 @@ void TextButton::drawText(int x_offset, int y_offset) {
163 gc(), // graphic context 170 gc(), // graphic context
164 text().c_str(), textlen, // string and string size 171 text().c_str(), textlen, // string and string size
165 align_x + x_offset + m_left_padding, center_pos + y_offset); // position 172 align_x + x_offset + m_left_padding, center_pos + y_offset); // position
173
166} 174}
167 175
168void TextButton::exposeEvent(XExposeEvent &event) { 176void TextButton::exposeEvent(XExposeEvent &event) {