less flicker

This commit is contained in:
fluxgen 2003-09-14 10:32:31 +00:00
parent ce1852c293
commit 32a6aa1f54
2 changed files with 43 additions and 43 deletions

View file

@ -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.50 2003/09/12 23:38:50 fluxgen Exp $ // $Id: FbWinFrame.cc,v 1.51 2003/09/14 10:32:31 fluxgen Exp $
#include "FbWinFrame.hh" #include "FbWinFrame.hh"
@ -212,24 +212,19 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
resize(width, height); resize(width, height);
} }
void FbWinFrame::setTitle(const std::string &titletext) {
m_titletext = titletext;
redrawTitle();
}
void FbWinFrame::setFocus(bool newvalue) { void FbWinFrame::setFocus(bool newvalue) {
if (m_focused == newvalue) // no need to change focus if (m_focused == newvalue)
return; return;
if (currentLabel()) {
if (newvalue) // focused
if (m_focused && !newvalue && currentLabel()) { renderButtonFocus(*m_current_label);
renderButtonUnfocus(*m_current_label); else // unfocused
} else if (!m_focused && newvalue && currentLabel()) { renderButtonUnfocus(*m_current_label);
renderButtonFocus(*m_current_label);
} }
m_focused = newvalue; m_focused = newvalue;
renderButtons(); renderButtons();
renderHandles(); renderHandles();
} }
@ -243,7 +238,7 @@ void FbWinFrame::addLeftButton(FbTk::Button *btn) {
return; return;
setupButton(*btn); // setup theme and other stuff setupButton(*btn); // setup theme and other stuff
m_buttons_left.push_back(btn); m_buttons_left.push_back(btn);
} }
@ -332,13 +327,14 @@ void FbWinFrame::moveLabelButtonRight(const FbTk::TextButton &btn) {
} }
void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) { void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
if (&btn == currentLabel())
return;
LabelList::iterator it = find(m_labelbuttons.begin(), LabelList::iterator it = find(m_labelbuttons.begin(),
m_labelbuttons.end(), m_labelbuttons.end(),
&btn); &btn);
if (it == m_labelbuttons.end()) if (it == m_labelbuttons.end())
return; return;
// render label buttons // render label buttons
if (currentLabel() != 0) if (currentLabel() != 0)
renderButtonUnfocus(*m_current_label); renderButtonUnfocus(*m_current_label);
@ -703,13 +699,16 @@ void FbWinFrame::redrawTitle() {
(*btn_it)->moveResize(last_x - border_width, - border_width, (*btn_it)->moveResize(last_x - border_width, - border_width,
button_width, button_width,
label().height() + border_width); label().height() + border_width);
(*btn_it)->clear(); if (isVisible())
(*btn_it)->updateTransparent(); (*btn_it)->clear();
}
if (isVisible()) {
m_titlebar.clear();
m_titlebar.updateTransparent();
m_label.clear();
m_label.updateTransparent();
} }
m_titlebar.clear();
m_titlebar.updateTransparent();
m_label.clear();
m_label.updateTransparent();
} }
void FbWinFrame::redrawTitlebar() { void FbWinFrame::redrawTitlebar() {
@ -868,15 +867,9 @@ void FbWinFrame::renderHandles() {
} }
} }
m_grip_left.clear();
m_grip_left.setAlpha(theme().alpha()); m_grip_left.setAlpha(theme().alpha());
m_grip_left.updateTransparent();
m_grip_right.clear();
m_grip_right.setAlpha(theme().alpha()); m_grip_right.setAlpha(theme().alpha());
m_grip_right.updateTransparent();
m_handle.clear();
m_handle.setAlpha(theme().alpha()); m_handle.setAlpha(theme().alpha());
m_handle.updateTransparent();
} }
@ -885,7 +878,7 @@ void FbWinFrame::renderButtons() {
render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm, render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm,
m_button_size, m_button_size); m_button_size, m_button_size);
render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color, render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color,
m_button_unfocused_pm, m_button_unfocused_pm,
m_button_size, m_button_size); m_button_size, m_button_size);
@ -895,12 +888,22 @@ void FbWinFrame::renderButtons() {
m_button_size, m_button_size); m_button_size, m_button_size);
// setup left and right buttons // setup left and right buttons
for (size_t i=0; i < m_buttons_left.size(); ++i) for (size_t i=0; i < m_buttons_left.size(); ++i) {
setupButton(*m_buttons_left[i]); setupButton(*m_buttons_left[i]);
if (isVisible()) {
m_buttons_left[i]->clear();
m_buttons_left[i]->updateTransparent();
}
}
for (size_t i=0; i < m_buttons_right.size(); ++i) for (size_t i=0; i < m_buttons_right.size(); ++i) {
setupButton(*m_buttons_right[i]); setupButton(*m_buttons_right[i]);
if (isVisible()) {
m_buttons_right[i]->clear();
m_buttons_right[i]->updateTransparent();
}
}
} }
void FbWinFrame::init() { void FbWinFrame::init() {
@ -935,36 +938,33 @@ void FbWinFrame::init() {
// Note: we don't show clientarea yet // Note: we don't show clientarea yet
setEventHandler(*this); setEventHandler(*this);
// reconfigure();
} }
/** /**
Setups upp background, pressed pixmap/color of the button to current theme Setups upp background, pressed pixmap/color of the button to current theme
*/ */
void FbWinFrame::setupButton(FbTk::Button &btn) { void FbWinFrame::setupButton(FbTk::Button &btn) {
if (m_button_pressed_pm) { if (m_button_pressed_pm)
btn.setPressedPixmap(m_button_pressed_pm); btn.setPressedPixmap(m_button_pressed_pm);
}
//!! TODO button pressed color //!! TODO button pressed color
if (m_focused) { if (focused()) { // focused
btn.setGC(m_theme.buttonPicFocusGC()); btn.setGC(m_theme.buttonPicFocusGC());
if (m_button_pm) if (m_button_pm)
btn.setBackgroundPixmap(m_button_pm); btn.setBackgroundPixmap(m_button_pm);
else else
btn.setBackgroundColor(m_button_color); btn.setBackgroundColor(m_button_color);
} else { } else { // unfocused
btn.setGC(m_theme.buttonPicUnfocusGC()); btn.setGC(m_theme.buttonPicUnfocusGC());
if (m_button_unfocused_pm) if (m_button_unfocused_pm)
btn.setBackgroundPixmap(m_button_unfocused_pm); btn.setBackgroundPixmap(m_button_unfocused_pm);
else else
btn.setBackgroundColor(m_button_color); btn.setBackgroundColor(m_button_unfocused_color);
} }
btn.setAlpha(theme().alpha()); btn.setAlpha(theme().alpha());
btn.clear();
} }
void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
@ -1089,7 +1089,6 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) {
button.setBackgroundColor(m_label_focused_color); button.setBackgroundColor(m_label_focused_color);
button.clear(); button.clear();
button.updateTransparent();
} }
void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
@ -1107,7 +1106,6 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
button.setBackgroundColor(m_label_unfocused_color); button.setBackgroundColor(m_label_unfocused_color);
button.clear(); button.clear();
button.updateTransparent();
} }
void FbWinFrame::updateTransparent() { void FbWinFrame::updateTransparent() {
@ -1127,8 +1125,11 @@ void FbWinFrame::updateTransparent() {
(*button_it)->updateTransparent(); (*button_it)->updateTransparent();
} }
m_grip_left.clear();
m_grip_left.updateTransparent(); m_grip_left.updateTransparent();
m_grip_right.clear();
m_grip_right.updateTransparent(); m_grip_right.updateTransparent();
m_handle.clear();
m_handle.updateTransparent(); m_handle.updateTransparent();
} }

View file

@ -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.19 2003/09/12 23:38:50 fluxgen Exp $ // $Id: FbWinFrame.hh,v 1.20 2003/09/14 10:32:31 fluxgen Exp $
#ifndef FBWINFRAME_HH #ifndef FBWINFRAME_HH
#define FBWINFRAME_HH #define FBWINFRAME_HH
@ -81,8 +81,7 @@ public:
/// resize client to specified size and resize frame to it /// resize client to specified size and resize frame to it
void resizeForClient(unsigned int width, unsigned int height); void resizeForClient(unsigned int width, unsigned int height);
void moveResize(int x, int y, unsigned int width, unsigned int height); void moveResize(int x, int y, unsigned int width, unsigned int height);
/// sets title on the titlebar label
void setTitle(const std::string &title);
/// set focus/unfocus style /// set focus/unfocus style
void setFocus(bool newvalue); void setFocus(bool newvalue);
void setDoubleClickTime(unsigned int time); void setDoubleClickTime(unsigned int time);