draw only when needed

This commit is contained in:
Dana Jansens 2002-12-27 16:29:32 +00:00
parent 5fdd493d0d
commit d222c56543
2 changed files with 66 additions and 59 deletions

View file

@ -81,9 +81,11 @@ void OBButtonWidget::update()
{ {
otk::PixmapMask *pm; otk::PixmapMask *pm;
int width; int width;
bool draw = _dirty;
otk::OtkWidget::update(); otk::OtkWidget::update();
if (draw) {
switch (type()) { switch (type()) {
case Type_StickyButton: case Type_StickyButton:
pm = _style->getStickyButtonMask(); pm = _style->getStickyButtonMask();
@ -124,6 +126,7 @@ void OBButtonWidget::update()
// unset the clip region // unset the clip region
XSetClipMask(otk::OBDisplay::display, pen.gc(), None); XSetClipMask(otk::OBDisplay::display, pen.gc(), None);
XSetClipOrigin(otk::OBDisplay::display, pen.gc(), 0, 0); XSetClipOrigin(otk::OBDisplay::display, pen.gc(), 0, 0);
}
} }

View file

@ -72,8 +72,11 @@ void OBLabelWidget::unfocus()
void OBLabelWidget::update() void OBLabelWidget::update()
{ {
bool draw = _dirty;
OtkWidget::update(); OtkWidget::update();
if (draw) {
std::string t = _text; std::string t = _text;
int x = _sidemargin; // x coord for the text int x = _sidemargin; // x coord for the text
@ -104,6 +107,7 @@ void OBLabelWidget::update()
} }
_font->drawString(_xftdraw, x, 0, *_text_color, t); _font->drawString(_xftdraw, x, 0, *_text_color, t);
}
} }