draw only when needed
This commit is contained in:
parent
5fdd493d0d
commit
d222c56543
2 changed files with 66 additions and 59 deletions
|
@ -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();
|
||||||
|
@ -125,6 +127,7 @@ void OBButtonWidget::update()
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void OBButtonWidget::adjust()
|
void OBButtonWidget::adjust()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -105,6 +108,7 @@ void OBLabelWidget::update()
|
||||||
|
|
||||||
_font->drawString(_xftdraw, x, 0, *_text_color, t);
|
_font->drawString(_xftdraw, x, 0, *_text_color, t);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void OBLabelWidget::adjust()
|
void OBLabelWidget::adjust()
|
||||||
|
|
Loading…
Reference in a new issue