aboutsummaryrefslogtreecommitdiff
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
parent62431956b4813e45a77c4b0c925fdb8eba3305e8 (diff)
downloadfluxbox-007c495239f0dc111bfc94610fb561320ec27232.zip
fluxbox-007c495239f0dc111bfc94610fb561320ec27232.tar.bz2
Tidy up some redundant pixmap allocs
-rw-r--r--ChangeLog3
-rw-r--r--src/FbTk/FbPixmap.hh5
-rw-r--r--src/FbTk/Menu.cc33
-rw-r--r--src/FbTk/TextButton.cc16
4 files changed, 40 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e92e0b..3ca9965 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.13 2Changes for 0.9.13
3*05/04/03:
4 * Tidy up some redundant pixmap allocations (Simon)
5 Menu.cc TextButton.cc FbPixmap.hh
3*05/03/23: 6*05/03/23:
4 * added "Fullscreen" as a command (Mathias) 7 * added "Fullscreen" as a command (Mathias)
5 CurrentWindow.cc/hh FbCommandFactory.cc 8 CurrentWindow.cc/hh FbCommandFactory.cc
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh
index c00aa99..a1c17a5 100644
--- a/src/FbTk/FbPixmap.hh
+++ b/src/FbTk/FbPixmap.hh
@@ -70,11 +70,12 @@ public:
70 70
71 static Pixmap getRootPixmap(int screen_num); 71 static Pixmap getRootPixmap(int screen_num);
72 72
73private:
74 void free();
75 void create(Drawable src, 73 void create(Drawable src,
76 unsigned int width, unsigned int height, 74 unsigned int width, unsigned int height,
77 int depth); 75 int depth);
76
77private:
78 void free();
78 Pixmap m_pm; 79 Pixmap m_pm;
79 unsigned int m_width, m_height; 80 unsigned int m_width, m_height;
80 int m_depth; 81 int m_depth;
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 34f876f..f803709 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -473,12 +473,19 @@ void Menu::updateMenu(int active_index) {
473 // buffer pixmap -> resize buffer pixmap 473 // buffer pixmap -> resize buffer pixmap
474 if (m_title_pm.width() != width() || 474 if (m_title_pm.width() != width() ||
475 m_title_pm.height() != theme().titleHeight()) { 475 m_title_pm.height() != theme().titleHeight()) {
476 m_title_pm = FbPixmap(menu.title.window(), 476
477 width(), theme().titleHeight(), 477 if (m_title_pm.drawable() != None) {
478 menu.title.depth()); 478 m_title_pm.resize(width(), theme().titleHeight());
479 m_real_title_pm = FbPixmap(menu.title.window(), 479 m_real_title_pm.resize(width(), theme().titleHeight());
480 } else {
481 m_title_pm.create(menu.title.window(),
482 width(), theme().titleHeight(),
483 menu.title.depth());
484 m_real_title_pm.create(menu.title.window(),
480 width(), theme().titleHeight(), 485 width(), theme().titleHeight(),
481 menu.title.depth()); 486 menu.title.depth());
487 }
488
482 // set pixmap that we have as real face to the user 489 // set pixmap that we have as real face to the user
483 menu.title.setBackgroundPixmap(m_real_title_pm.drawable()); 490 menu.title.setBackgroundPixmap(m_real_title_pm.drawable());
484 menu.title.setBufferPixmap(m_real_title_pm.drawable()); 491 menu.title.setBufferPixmap(m_real_title_pm.drawable());
@@ -560,13 +567,18 @@ void Menu::updateMenu(int active_index) {
560 if (m_need_update || m_frame_pm.width() != menu.frame.width() || 567 if (m_need_update || m_frame_pm.width() != menu.frame.width() ||
561 m_frame_pm.height() != menu.frame.height()){ 568 m_frame_pm.height() != menu.frame.height()){
562 569
563 m_frame_pm = FbTk::FbPixmap(menu.frame.window(), 570 if (m_frame_pm.drawable() != None) {
564 menu.frame.width(), menu.frame.height(), 571 m_frame_pm.resize(menu.frame.width(), menu.frame.height());
565 menu.frame.depth()); 572 m_real_frame_pm.resize(menu.frame.width(), menu.frame.height());
573 } else {
574 m_frame_pm.create(menu.frame.window(),
575 menu.frame.width(), menu.frame.height(),
576 menu.frame.depth());
566 577
567 m_real_frame_pm = FbTk::FbPixmap(menu.frame.window(), 578 m_real_frame_pm.create(menu.frame.window(),
568 menu.frame.width(), menu.frame.height(), 579 menu.frame.width(), menu.frame.height(),
569 menu.frame.depth()); 580 menu.frame.depth());
581 }
570 if (m_transp.get() != 0) 582 if (m_transp.get() != 0)
571 m_transp->setDest(m_real_frame_pm.drawable(), screenNumber()); 583 m_transp->setDest(m_real_frame_pm.drawable(), screenNumber());
572 584
@@ -591,7 +603,6 @@ void Menu::updateMenu(int active_index) {
591 0, 0, 603 0, 0,
592 width(), menu.frame_h); 604 width(), menu.frame_h);
593 } 605 }
594
595 606
596 } 607 }
597 608
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) {