optimized rendering
This commit is contained in:
parent
48ea10e22f
commit
a6b3e25679
3 changed files with 70 additions and 45 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "FbWinFrame.hh"
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ FbWinFrame::FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FbWinFrame::~FbWinFrame() {
|
FbWinFrame::~FbWinFrame() {
|
||||||
|
m_update_timer.stop();
|
||||||
removeEventHandler();
|
removeEventHandler();
|
||||||
removeAllButtons();
|
removeAllButtons();
|
||||||
}
|
}
|
||||||
|
@ -137,7 +138,6 @@ void FbWinFrame::hide() {
|
||||||
|
|
||||||
void FbWinFrame::show() {
|
void FbWinFrame::show() {
|
||||||
m_visible = true;
|
m_visible = true;
|
||||||
reconfigure();
|
|
||||||
m_window.showSubwindows();
|
m_window.showSubwindows();
|
||||||
m_window.show();
|
m_window.show();
|
||||||
}
|
}
|
||||||
|
@ -221,8 +221,17 @@ void FbWinFrame::setFocus(bool newvalue) {
|
||||||
if (m_focused == newvalue) // no need to change focus
|
if (m_focused == newvalue) // no need to change focus
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (m_focused && !newvalue && currentLabel()) {
|
||||||
|
renderButtonUnfocus(*m_current_label);
|
||||||
|
} else if (!m_focused && newvalue && currentLabel()) {
|
||||||
|
renderButtonFocus(*m_current_label);
|
||||||
|
}
|
||||||
|
|
||||||
m_focused = newvalue;
|
m_focused = newvalue;
|
||||||
reconfigure(); // reconfigure rendering for new focus value
|
renderButtons();
|
||||||
|
renderHandles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::setDoubleClickTime(unsigned int time) {
|
void FbWinFrame::setDoubleClickTime(unsigned int time) {
|
||||||
|
@ -231,7 +240,6 @@ void FbWinFrame::setDoubleClickTime(unsigned int time) {
|
||||||
|
|
||||||
void FbWinFrame::setBevel(int bevel) {
|
void FbWinFrame::setBevel(int bevel) {
|
||||||
m_bevel = bevel;
|
m_bevel = bevel;
|
||||||
reconfigure();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::addLeftButton(FbTk::Button *btn) {
|
void FbWinFrame::addLeftButton(FbTk::Button *btn) {
|
||||||
|
@ -284,6 +292,9 @@ void FbWinFrame::removeLabelButton(FbTk::TextButton &btn) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_labelbuttons.erase(erase_it);
|
m_labelbuttons.erase(erase_it);
|
||||||
|
|
||||||
|
if (*erase_it == m_current_label)
|
||||||
|
m_current_label = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -333,9 +344,7 @@ void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
|
||||||
|
|
||||||
|
|
||||||
// render label buttons
|
// render label buttons
|
||||||
|
if (currentLabel() != 0)
|
||||||
|
|
||||||
if (m_current_label != 0)
|
|
||||||
renderButtonUnfocus(*m_current_label);
|
renderButtonUnfocus(*m_current_label);
|
||||||
|
|
||||||
m_current_label = *it; // current focused button
|
m_current_label = *it; // current focused button
|
||||||
|
@ -528,9 +537,10 @@ void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::exposeEvent(XExposeEvent &event) {
|
void FbWinFrame::exposeEvent(XExposeEvent &event) {
|
||||||
if (m_label == event.window)
|
if (m_label == event.window) {
|
||||||
redrawTitle();
|
m_label.clearArea(event.x, event.y, event.width, event.height);
|
||||||
else if (m_handle == event.window) {
|
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.clearArea(event.x, event.y, event.width, event.height);
|
||||||
m_handle.updateTransparent();
|
m_handle.updateTransparent();
|
||||||
} else if (m_grip_left == event.window) {
|
} else if (m_grip_left == event.window) {
|
||||||
|
@ -570,6 +580,7 @@ void FbWinFrame::exposeEvent(XExposeEvent &event) {
|
||||||
if (it != m_buttons_right.end())
|
if (it != m_buttons_right.end())
|
||||||
(*it)->exposeEvent(event);
|
(*it)->exposeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::handleEvent(XEvent &event) {
|
void FbWinFrame::handleEvent(XEvent &event) {
|
||||||
|
@ -582,6 +593,8 @@ void FbWinFrame::configureNotifyEvent(XConfigureEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::reconfigure() {
|
void FbWinFrame::reconfigure() {
|
||||||
|
if (m_labelbuttons.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
// align titlebar and render it
|
// align titlebar and render it
|
||||||
if (m_use_titlebar)
|
if (m_use_titlebar)
|
||||||
|
@ -660,14 +673,13 @@ unsigned int FbWinFrame::buttonHeight() const {
|
||||||
return m_titlebar.height() - m_bevel*2;
|
return m_titlebar.height() - m_bevel*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------- private area
|
//--------------------- private area
|
||||||
|
|
||||||
/**
|
/**
|
||||||
aligns and redraws title
|
aligns and redraws title
|
||||||
*/
|
*/
|
||||||
void FbWinFrame::redrawTitle() {
|
void FbWinFrame::redrawTitle() {
|
||||||
if (m_labelbuttons.size() == 0 || !m_visible)
|
if (m_labelbuttons.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int button_width = label().width()/m_labelbuttons.size();
|
int button_width = label().width()/m_labelbuttons.size();
|
||||||
|
@ -696,7 +708,7 @@ void FbWinFrame::redrawTitle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::redrawTitlebar() {
|
void FbWinFrame::redrawTitlebar() {
|
||||||
if (!m_use_titlebar || !m_visible)
|
if (!m_use_titlebar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
redrawTitle();
|
redrawTitle();
|
||||||
|
@ -754,7 +766,7 @@ void FbWinFrame::reconfigureTitlebar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::renderTitlebar() {
|
void FbWinFrame::renderTitlebar() {
|
||||||
if (!m_use_titlebar || !m_visible)
|
if (!m_use_titlebar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// render pixmaps
|
// render pixmaps
|
||||||
|
@ -918,7 +930,7 @@ void FbWinFrame::init() {
|
||||||
// Note: we don't show clientarea yet
|
// Note: we don't show clientarea yet
|
||||||
|
|
||||||
setEventHandler(*this);
|
setEventHandler(*this);
|
||||||
reconfigure();
|
// reconfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1063,9 +1075,12 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) {
|
||||||
button.setBorderWidth(1);
|
button.setBorderWidth(1);
|
||||||
button.setAlpha(theme().alpha());
|
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);
|
button.setBackgroundPixmap(m_label_focused_pm);
|
||||||
else
|
} else
|
||||||
button.setBackgroundColor(m_label_focused_color);
|
button.setBackgroundColor(m_label_focused_color);
|
||||||
|
|
||||||
button.clear();
|
button.clear();
|
||||||
|
@ -1078,9 +1093,12 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
|
||||||
button.setBorderWidth(1);
|
button.setBorderWidth(1);
|
||||||
button.setAlpha(theme().alpha());
|
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);
|
button.setBackgroundPixmap(m_label_unfocused_pm);
|
||||||
else
|
} else
|
||||||
button.setBackgroundColor(m_label_unfocused_color);
|
button.setBackgroundColor(m_label_unfocused_color);
|
||||||
|
|
||||||
button.clear();
|
button.clear();
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef FBWINFRAME_HH
|
||||||
#define FBWINFRAME_HH
|
#define FBWINFRAME_HH
|
||||||
|
@ -168,6 +168,7 @@ public:
|
||||||
inline FbTk::FbWindow &gripLeft() { return m_grip_left; }
|
inline FbTk::FbWindow &gripLeft() { return m_grip_left; }
|
||||||
inline const FbTk::FbWindow &gripRight() const { return m_grip_right; }
|
inline const FbTk::FbWindow &gripRight() const { return m_grip_right; }
|
||||||
inline FbTk::FbWindow &gripRight() { 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 focused() const { return m_focused; }
|
||||||
inline bool isShaded() const { return m_shaded; }
|
inline bool isShaded() const { return m_shaded; }
|
||||||
inline const FbWinFrameTheme &theme() const { return m_theme; }
|
inline const FbWinFrameTheme &theme() const { return m_theme; }
|
||||||
|
@ -179,8 +180,9 @@ public:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void redrawTitle();
|
|
||||||
void redrawTitlebar();
|
void redrawTitlebar();
|
||||||
|
void redrawTitle();
|
||||||
|
|
||||||
/// reposition titlebar items
|
/// reposition titlebar items
|
||||||
void reconfigureTitlebar();
|
void reconfigureTitlebar();
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "Window.hh"
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ void FluxboxWindow::init() {
|
||||||
frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor());
|
frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor());
|
||||||
frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor());
|
frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor());
|
||||||
|
|
||||||
frame().resize(m_client->width(), m_client->height());
|
|
||||||
FbTk::TextButton *btn = new FbTk::TextButton(frame().label(),
|
FbTk::TextButton *btn = new FbTk::TextButton(frame().label(),
|
||||||
frame().theme().font(),
|
frame().theme().font(),
|
||||||
m_client->title());
|
m_client->title());
|
||||||
|
@ -385,6 +385,8 @@ void FluxboxWindow::init() {
|
||||||
|
|
||||||
frame().setEventHandler(*this);
|
frame().setEventHandler(*this);
|
||||||
|
|
||||||
|
frame().resize(m_client->width(), m_client->height());
|
||||||
|
|
||||||
m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0;
|
m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0;
|
||||||
|
|
||||||
// display connection
|
// display connection
|
||||||
|
@ -510,6 +512,7 @@ void FluxboxWindow::init() {
|
||||||
if (!place_window)
|
if (!place_window)
|
||||||
moveResize(frame().x(), frame().y(), frame().width(), frame().height());
|
moveResize(frame().x(), frame().y(), frame().width(), frame().height());
|
||||||
|
|
||||||
|
|
||||||
screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window);
|
screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window);
|
||||||
|
|
||||||
if (shaded) { // start shaded
|
if (shaded) { // start shaded
|
||||||
|
@ -549,6 +552,8 @@ void FluxboxWindow::init() {
|
||||||
|
|
||||||
if (m_shaped)
|
if (m_shaped)
|
||||||
shape();
|
shape();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// apply shape to this window
|
/// apply shape to this window
|
||||||
|
@ -777,6 +782,8 @@ bool FluxboxWindow::removeClient(WinClient &client) {
|
||||||
|
|
||||||
m_labelbuttons.erase(&client);
|
m_labelbuttons.erase(&client);
|
||||||
|
|
||||||
|
frame().reconfigure();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"] numClients = "<<numClients()<<endl;
|
cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"] numClients = "<<numClients()<<endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
@ -811,7 +818,7 @@ void FluxboxWindow::nextClient() {
|
||||||
m_client = *it;
|
m_client = *it;
|
||||||
m_client->raise();
|
m_client->raise();
|
||||||
frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
|
frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
|
||||||
setInputFocus();
|
frame().setFocus(setInputFocus());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxboxWindow::prevClient() {
|
void FluxboxWindow::prevClient() {
|
||||||
|
@ -830,7 +837,7 @@ void FluxboxWindow::prevClient() {
|
||||||
|
|
||||||
m_client->raise();
|
m_client->raise();
|
||||||
frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
|
frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
|
||||||
setInputFocus();
|
frame().setFocus(setInputFocus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -908,8 +915,6 @@ void FluxboxWindow::associateClientWindow() {
|
||||||
|
|
||||||
frame().setClientWindow(*m_client);
|
frame().setClientWindow(*m_client);
|
||||||
frame().resizeForClient(m_client->width(), m_client->height());
|
frame().resizeForClient(m_client->width(), m_client->height());
|
||||||
// make sure the frame reconfigures
|
|
||||||
frame().reconfigure();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -955,6 +960,8 @@ void FluxboxWindow::reconfigure() {
|
||||||
frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
|
frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
|
||||||
frame().setUpdateDelayTime(Fluxbox::instance()->getUpdateDelayTime());
|
frame().setUpdateDelayTime(Fluxbox::instance()->getUpdateDelayTime());
|
||||||
|
|
||||||
|
frame().reconfigure();
|
||||||
|
|
||||||
m_windowmenu.reconfigure();
|
m_windowmenu.reconfigure();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1100,9 +1107,10 @@ void FluxboxWindow::moveResize(int new_x, int new_y,
|
||||||
new_width = width();
|
new_width = width();
|
||||||
new_height = height();
|
new_height = height();
|
||||||
}
|
}
|
||||||
frame().moveResize(new_x, new_y, new_width, new_height);
|
|
||||||
|
|
||||||
setFocusFlag(focused);
|
setFocusFlag(focused);
|
||||||
|
frame().moveResize(new_x, new_y, new_width, new_height);
|
||||||
|
|
||||||
shaded = false;
|
shaded = false;
|
||||||
send_event = true;
|
send_event = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1258,13 +1266,8 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
|
||||||
|
|
||||||
frame().show();
|
frame().show();
|
||||||
|
|
||||||
if (was_iconic && screen().doFocusNew()) {
|
if (was_iconic && screen().doFocusNew())
|
||||||
setInputFocus();
|
setInputFocus();
|
||||||
}
|
|
||||||
|
|
||||||
if (focused != frame().focused())
|
|
||||||
frame().setFocus(focused);
|
|
||||||
|
|
||||||
|
|
||||||
if (reassoc && !m_client->transients.empty()) {
|
if (reassoc && !m_client->transients.empty()) {
|
||||||
// deiconify all transients
|
// deiconify all transients
|
||||||
|
@ -1281,7 +1284,9 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oplock = false;
|
oplock = false;
|
||||||
|
|
||||||
if (do_raise)
|
if (do_raise)
|
||||||
raise();
|
raise();
|
||||||
}
|
}
|
||||||
|
@ -1646,7 +1651,10 @@ void FluxboxWindow::setFocusFlag(bool focus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
installColormap(focus);
|
installColormap(focus);
|
||||||
|
|
||||||
|
if (focus != frame().focused()) {
|
||||||
frame().setFocus(focus);
|
frame().setFocus(focus);
|
||||||
|
}
|
||||||
|
|
||||||
if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus())
|
if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus())
|
||||||
&& screen().doAutoRaise()) {
|
&& screen().doAutoRaise()) {
|
||||||
|
@ -1712,8 +1720,7 @@ void FluxboxWindow::saveBlackboxAttribs() {
|
||||||
PropModeReplace,
|
PropModeReplace,
|
||||||
(unsigned char *)&m_blackbox_attrib,
|
(unsigned char *)&m_blackbox_attrib,
|
||||||
PropBlackboxAttributesElements
|
PropBlackboxAttributesElements
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2013,9 +2020,8 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
|
||||||
|
|
||||||
setState(NormalState);
|
setState(NormalState);
|
||||||
|
|
||||||
if (client->isTransient() || screen().doFocusNew()) {
|
if (client->isTransient() || screen().doFocusNew())
|
||||||
setCurrentClient(*client, true);
|
setCurrentClient(*client, true);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
setFocusFlag(false);
|
setFocusFlag(false);
|
||||||
|
|
||||||
|
@ -2169,7 +2175,6 @@ void FluxboxWindow::exposeEvent(XExposeEvent &ee) {
|
||||||
frame().exposeEvent(ee);
|
frame().exposeEvent(ee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
|
void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
|
||||||
WinClient *client = findClient(cr.window);
|
WinClient *client = findClient(cr.window);
|
||||||
if (client == 0)
|
if (client == 0)
|
||||||
|
@ -2609,10 +2614,10 @@ void FluxboxWindow::applyDecorations(bool initial) {
|
||||||
|
|
||||||
if (decorations.handle) {
|
if (decorations.handle) {
|
||||||
frame().showHandle();
|
frame().showHandle();
|
||||||
frame().reconfigure(); // show handle requires reconfigure
|
|
||||||
} else
|
} else
|
||||||
frame().hideHandle();
|
frame().hideHandle();
|
||||||
|
|
||||||
|
frame().reconfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxboxWindow::toggleDecoration() {
|
void FluxboxWindow::toggleDecoration() {
|
||||||
|
|
Loading…
Reference in a new issue