summaryrefslogtreecommitdiff
path: root/plugingui/widget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/widget.cc')
-rw-r--r--plugingui/widget.cc49
1 files changed, 42 insertions, 7 deletions
diff --git a/plugingui/widget.cc b/plugingui/widget.cc
index 7d92a22..00acfbf 100644
--- a/plugingui/widget.cc
+++ b/plugingui/widget.cc
@@ -42,6 +42,9 @@ Widget::Widget(Widget* parent)
parent->addChild(this);
_window = parent->window();
}
+
+ pixbuf.x = translateToWindowX();
+ pixbuf.y = translateToWindowY();
}
Widget::~Widget()
@@ -64,12 +67,14 @@ void Widget::hide()
void Widget::setVisible(bool visible)
{
- _visible = visible;
-
- if(visible)
+ if(_visible == visible)
{
- redraw();
+ return;
}
+
+ _visible = visible;
+ pixbuf.visible = visible;
+ redraw();
}
bool Widget::visible() const
@@ -130,7 +135,20 @@ void Widget::resize(std::size_t width, std::size_t height)
_width = width;
_height = height;
+
+ // Store old size/position in pixelbuffer for rendering invalidation.
+ if(!pixbuf.has_last)
+ {
+ pixbuf.last_width = pixbuf.width;
+ pixbuf.last_height = pixbuf.height;
+ pixbuf.last_x = pixbuf.x;
+ pixbuf.last_y = pixbuf.y;
+ pixbuf.has_last = true;
+ }
+
pixbuf.realloc(width, height);
+ pixbuf.x = translateToWindowX();
+ pixbuf.y = translateToWindowY();
redraw();
sizeChangeNotifier(width, height);
}
@@ -145,6 +163,20 @@ void Widget::move(int x, int y)
_x = x;
_y = y;
+
+ // Store old size/position in pixelbuffer for rendering invalidation.
+ if(!pixbuf.has_last)
+ {
+ pixbuf.last_width = pixbuf.width;
+ pixbuf.last_height = pixbuf.height;
+ pixbuf.last_x = pixbuf.x;
+ pixbuf.last_y = pixbuf.y;
+ pixbuf.has_last = true;
+ }
+
+ //pixbuf.x = translateToWindowX();
+ //pixbuf.y = translateToWindowY();
+
positionChangeNotifier(x, y);
}
@@ -216,11 +248,14 @@ std::vector<PixelBufferAlpha*> Widget::getPixelBuffers()
dirty = false;
}
- pixelBuffers.push_back(&pixbuf);
+ if(pixbuf.dirty || visible())
+ {
+ pixelBuffers.push_back(&pixbuf);
+ }
- for(auto child : children)
+ if(visible())
{
- if(child->visible())
+ for(auto child : children)
{
auto childPixelBuffers = child->getPixelBuffers();
pixelBuffers.insert(pixelBuffers.end(),