all repos — fluxbox @ a6b3e25679d80c7d703682a85692f75a8f6a8f75

custom fork of the fluxbox windowmanager

optimized rendering
fluxgen fluxgen
commit

a6b3e25679d80c7d703682a85692f75a8f6a8f75

parent

48ea10e22f74e2718578dbf4634f059cbe59fa9f

3 files changed, 70 insertions(+), 45 deletions(-)

jump to
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.48 2003/09/11 19:55:27 rathnor Exp $ +// $Id: FbWinFrame.cc,v 1.49 2003/09/12 22:49:14 fluxgen Exp $ #include "FbWinFrame.hh"

@@ -109,6 +109,7 @@ }

*/ FbWinFrame::~FbWinFrame() { + m_update_timer.stop(); removeEventHandler(); removeAllButtons(); }

@@ -137,7 +138,6 @@ }

void FbWinFrame::show() { m_visible = true; - reconfigure(); m_window.showSubwindows(); m_window.show(); }

@@ -221,8 +221,17 @@ void FbWinFrame::setFocus(bool newvalue) {

if (m_focused == newvalue) // no need to change focus return; + + + if (m_focused && !newvalue && currentLabel()) { + renderButtonUnfocus(*m_current_label); + } else if (!m_focused && newvalue && currentLabel()) { + renderButtonFocus(*m_current_label); + } + m_focused = newvalue; - reconfigure(); // reconfigure rendering for new focus value + renderButtons(); + renderHandles(); } void FbWinFrame::setDoubleClickTime(unsigned int time) {

@@ -231,7 +240,6 @@ }

void FbWinFrame::setBevel(int bevel) { m_bevel = bevel; - reconfigure(); } void FbWinFrame::addLeftButton(FbTk::Button *btn) {

@@ -284,13 +292,16 @@ if (erase_it == m_labelbuttons.end())

return; m_labelbuttons.erase(erase_it); + + if (*erase_it == m_current_label) + m_current_label = 0; } void FbWinFrame::moveLabelButtonLeft(const FbTk::TextButton &btn) { LabelList::iterator it = find(m_labelbuttons.begin(), - m_labelbuttons.end(), - &btn); + m_labelbuttons.end(), + &btn); // make sure we found it and we're not at the begining if (it == m_labelbuttons.end() || it == m_labelbuttons.begin()) return;

@@ -333,9 +344,7 @@ return;

// render label buttons - - - if (m_current_label != 0) + if (currentLabel() != 0) renderButtonUnfocus(*m_current_label); m_current_label = *it; // current focused button

@@ -528,9 +537,10 @@

} void FbWinFrame::exposeEvent(XExposeEvent &event) { - if (m_label == event.window) - redrawTitle(); - else if (m_handle == event.window) { + if (m_label == event.window) { + m_label.clearArea(event.x, event.y, event.width, event.height); + m_label.updateTransparent(event.x, event.y, event.width, event.height); + } else if (m_handle == event.window) { m_handle.clearArea(event.x, event.y, event.width, event.height); m_handle.updateTransparent(); } else if (m_grip_left == event.window) {

@@ -570,6 +580,7 @@

if (it != m_buttons_right.end()) (*it)->exposeEvent(event); } + } void FbWinFrame::handleEvent(XEvent &event) {

@@ -582,6 +593,8 @@ resize(event.width, event.height);

} void FbWinFrame::reconfigure() { + if (m_labelbuttons.size() == 0) + return; // align titlebar and render it if (m_use_titlebar)

@@ -660,14 +673,13 @@ unsigned int FbWinFrame::buttonHeight() const {

return m_titlebar.height() - m_bevel*2; } - //--------------------- private area /** aligns and redraws title */ void FbWinFrame::redrawTitle() { - if (m_labelbuttons.size() == 0 || !m_visible) + if (m_labelbuttons.size() == 0) return; int button_width = label().width()/m_labelbuttons.size();

@@ -687,7 +699,7 @@ (*btn_it)->moveResize(last_x - border_width, - border_width,

button_width, label().height() + border_width); (*btn_it)->clear(); - (*btn_it)->updateTransparent(); + (*btn_it)->updateTransparent(); } m_titlebar.clear(); m_titlebar.updateTransparent();

@@ -696,7 +708,7 @@ m_label.updateTransparent();

} void FbWinFrame::redrawTitlebar() { - if (!m_use_titlebar || !m_visible) + if (!m_use_titlebar) return; redrawTitle();

@@ -754,7 +766,7 @@ m_titlebar.raise(); // always on top

} void FbWinFrame::renderTitlebar() { - if (!m_use_titlebar || !m_visible) + if (!m_use_titlebar) return; // render pixmaps

@@ -918,7 +930,7 @@

// Note: we don't show clientarea yet setEventHandler(*this); - reconfigure(); + // reconfigure(); } /**

@@ -1063,9 +1075,12 @@ button.setJustify(theme().justify());

button.setBorderWidth(1); button.setAlpha(theme().alpha()); - if (m_label_focused_pm != 0) + if (m_label_focused_pm != 0) { + // already set + if (button.backgroundPixmap() == m_label_focused_pm) + return; button.setBackgroundPixmap(m_label_focused_pm); - else + } else button.setBackgroundColor(m_label_focused_color); button.clear();

@@ -1078,9 +1093,12 @@ button.setJustify(theme().justify());

button.setBorderWidth(1); button.setAlpha(theme().alpha()); - if (m_label_unfocused_pm != 0) + if (m_label_unfocused_pm != 0) { + // already set + if (button.backgroundPixmap() == m_label_unfocused_pm) + return; button.setBackgroundPixmap(m_label_unfocused_pm); - else + } else button.setBackgroundColor(m_label_unfocused_color); button.clear();
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.hh,v 1.17 2003/09/11 13:17:14 rathnor Exp $ +// $Id: FbWinFrame.hh,v 1.18 2003/09/12 22:49:14 fluxgen Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH

@@ -168,6 +168,7 @@ inline const FbTk::FbWindow &gripLeft() const { return m_grip_left; }

inline FbTk::FbWindow &gripLeft() { return m_grip_left; } inline const FbTk::FbWindow &gripRight() const { return m_grip_right; } inline FbTk::FbWindow &gripRight() { return m_grip_right; } + inline const FbTk::TextButton *currentLabel() const { return m_current_label; } inline bool focused() const { return m_focused; } inline bool isShaded() const { return m_shaded; } inline const FbWinFrameTheme &theme() const { return m_theme; }

@@ -179,8 +180,9 @@

//@} private: + void redrawTitlebar(); void redrawTitle(); - void redrawTitlebar(); + /// reposition titlebar items void reconfigureTitlebar(); /**
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.225 2003/09/11 21:30:20 rathnor Exp $ +// $Id: Window.cc,v 1.226 2003/09/12 22:48:49 fluxgen Exp $ #include "Window.hh"

@@ -362,7 +362,7 @@ // setup cursors for resize grips

frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor()); frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor()); - frame().resize(m_client->width(), m_client->height()); + FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), frame().theme().font(), m_client->title());

@@ -384,6 +384,8 @@

// redirect events from frame to us frame().setEventHandler(*this); + + frame().resize(m_client->width(), m_client->height()); m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0;

@@ -510,6 +512,7 @@

if (!place_window) moveResize(frame().x(), frame().y(), frame().width(), frame().height()); + screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); if (shaded) { // start shaded

@@ -549,6 +552,8 @@ setFocusFlag(false);

if (m_shaped) shape(); + + } /// apply shape to this window

@@ -777,6 +782,8 @@ }

m_labelbuttons.erase(&client); + frame().reconfigure(); + #ifdef DEBUG cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"] numClients = "<<numClients()<<endl; #endif // DEBUG

@@ -811,7 +818,7 @@ else

m_client = *it; m_client->raise(); frame().setLabelButtonFocus(*m_labelbuttons[m_client]); - setInputFocus(); + frame().setFocus(setInputFocus()); } void FluxboxWindow::prevClient() {

@@ -830,7 +837,7 @@ m_client = *(--it);

m_client->raise(); frame().setLabelButtonFocus(*m_labelbuttons[m_client]); - setInputFocus(); + frame().setFocus(setInputFocus()); }

@@ -908,8 +915,6 @@ updateIconNameFromClient();

frame().setClientWindow(*m_client); frame().resizeForClient(m_client->width(), m_client->height()); - // make sure the frame reconfigures - frame().reconfigure(); }

@@ -955,6 +960,8 @@

frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); frame().setUpdateDelayTime(Fluxbox::instance()->getUpdateDelayTime()); + frame().reconfigure(); + m_windowmenu.reconfigure(); }

@@ -1100,9 +1107,10 @@ if (!isResizable()) {

new_width = width(); new_height = height(); } + + setFocusFlag(focused); frame().moveResize(new_x, new_y, new_width, new_height); - setFocusFlag(focused); shaded = false; send_event = true; } else {

@@ -1258,13 +1266,8 @@ }

frame().show(); - if (was_iconic && screen().doFocusNew()) { + if (was_iconic && screen().doFocusNew()) setInputFocus(); - } - - if (focused != frame().focused()) - frame().setFocus(focused); - if (reassoc && !m_client->transients.empty()) { // deiconify all transients

@@ -1281,7 +1284,9 @@ (*trans_it)->fbwindow()->deiconify(true, false);

} } } + oplock = false; + if (do_raise) raise(); }

@@ -1646,7 +1651,10 @@ screen().setFocusedWindow(*m_client);

} installColormap(focus); - frame().setFocus(focus); + + if (focus != frame().focused()) { + frame().setFocus(focus); + } if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus()) && screen().doAutoRaise()) {

@@ -1712,8 +1720,7 @@ FbAtoms::instance()->getFluxboxAttributesAtom(),

PropModeReplace, (unsigned char *)&m_blackbox_attrib, PropBlackboxAttributesElements - ) - ); + )); } /**

@@ -2013,11 +2020,10 @@ return;

setState(NormalState); - if (client->isTransient() || screen().doFocusNew()) { + if (client->isTransient() || screen().doFocusNew()) setCurrentClient(*client, true); - } else - setFocusFlag(false); + setFocusFlag(false); iconic = false;

@@ -2168,7 +2174,6 @@

void FluxboxWindow::exposeEvent(XExposeEvent &ee) { frame().exposeEvent(ee); } - void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { WinClient *client = findClient(cr.window);

@@ -2609,10 +2614,10 @@ frame().hideTitlebar();

if (decorations.handle) { frame().showHandle(); - frame().reconfigure(); // show handle requires reconfigure } else frame().hideHandle(); + frame().reconfigure(); } void FluxboxWindow::toggleDecoration() {