all repos — fluxbox @ 007c495239f0dc111bfc94610fb561320ec27232

custom fork of the fluxbox windowmanager

Tidy up some redundant pixmap allocs
simonb simonb
commit

007c495239f0dc111bfc94610fb561320ec27232

parent

62431956b4813e45a77c4b0c925fdb8eba3305e8

4 files changed, 40 insertions(+), 17 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.13 +*05/04/03: + * Tidy up some redundant pixmap allocations (Simon) + Menu.cc TextButton.cc FbPixmap.hh *05/03/23: * added "Fullscreen" as a command (Mathias) CurrentWindow.cc/hh FbCommandFactory.cc
M src/FbTk/FbPixmap.hhsrc/FbTk/FbPixmap.hh

@@ -70,11 +70,12 @@ inline int depth() const { return m_depth; }

static Pixmap getRootPixmap(int screen_num); -private: - void free(); void create(Drawable src, unsigned int width, unsigned int height, int depth); + +private: + void free(); Pixmap m_pm; unsigned int m_width, m_height; int m_depth;
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -473,12 +473,19 @@ // if new size of title doesn't match our

// buffer pixmap -> resize buffer pixmap if (m_title_pm.width() != width() || m_title_pm.height() != theme().titleHeight()) { - m_title_pm = FbPixmap(menu.title.window(), - width(), theme().titleHeight(), - menu.title.depth()); - m_real_title_pm = FbPixmap(menu.title.window(), + + if (m_title_pm.drawable() != None) { + m_title_pm.resize(width(), theme().titleHeight()); + m_real_title_pm.resize(width(), theme().titleHeight()); + } else { + m_title_pm.create(menu.title.window(), + width(), theme().titleHeight(), + menu.title.depth()); + m_real_title_pm.create(menu.title.window(), width(), theme().titleHeight(), menu.title.depth()); + } + // set pixmap that we have as real face to the user menu.title.setBackgroundPixmap(m_real_title_pm.drawable()); menu.title.setBufferPixmap(m_real_title_pm.drawable());

@@ -560,13 +567,18 @@

if (m_need_update || m_frame_pm.width() != menu.frame.width() || m_frame_pm.height() != menu.frame.height()){ - m_frame_pm = FbTk::FbPixmap(menu.frame.window(), - menu.frame.width(), menu.frame.height(), - menu.frame.depth()); + if (m_frame_pm.drawable() != None) { + m_frame_pm.resize(menu.frame.width(), menu.frame.height()); + m_real_frame_pm.resize(menu.frame.width(), menu.frame.height()); + } else { + m_frame_pm.create(menu.frame.window(), + menu.frame.width(), menu.frame.height(), + menu.frame.depth()); - m_real_frame_pm = FbTk::FbPixmap(menu.frame.window(), - menu.frame.width(), menu.frame.height(), - menu.frame.depth()); + m_real_frame_pm.create(menu.frame.window(), + menu.frame.width(), menu.frame.height(), + menu.frame.depth()); + } if (m_transp.get() != 0) m_transp->setDest(m_real_frame_pm.drawable(), screenNumber());

@@ -591,7 +603,6 @@ 0, 0,

0, 0, width(), menu.frame_h); } - }
M src/FbTk/TextButton.ccsrc/FbTk/TextButton.cc

@@ -43,7 +43,10 @@

} void TextButton::resize(unsigned int width, unsigned int height) { - m_buffer.resize(width, height); + if (this->width() == width && height == this->height()) + return; + + m_buffer.resize(width, height); if (backgroundPixmap() != ParentRelative) FbWindow::setBackgroundPixmap(m_buffer.drawable());

@@ -52,10 +55,16 @@ }

void TextButton::moveResize(int x, int y, unsigned int width, unsigned int height) { - m_buffer.resize(width, height); + if (this->width() == width && height == this->height() && + x == this->x() && y == this->y()) + return; + + if (this->width() != width || height != this->height()) + m_buffer.resize(width, height); if (backgroundPixmap() != ParentRelative) FbWindow::setBackgroundPixmap(m_buffer.drawable()); + Button::moveResize(x, y, width, height); }

@@ -104,7 +113,6 @@ void TextButton::clearArea(int x, int y,

unsigned int width, unsigned int height, bool exposure) { if (backgroundPixmap() != ParentRelative) { - if (backgroundPixmap()) { m_buffer.copyArea(backgroundPixmap(), gc(),

@@ -120,7 +128,6 @@ x, y,

width, height); } - drawText(); setBufferPixmap(m_buffer.drawable());

@@ -163,6 +170,7 @@ screenNumber(),

gc(), // graphic context text().c_str(), textlen, // string and string size align_x + x_offset + m_left_padding, center_pos + y_offset); // position + } void TextButton::exposeEvent(XExposeEvent &event) {