summaryrefslogtreecommitdiff
path: root/plugingui/widget.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-03-12 17:25:04 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-03-12 17:33:17 +0100
commit494e7218597a6cd94902b3ae6f827e74b41c00b0 (patch)
tree8b0e7359b9664249945b62a0012c2178b5faf823 /plugingui/widget.cc
parent75de9c0ac782fa6fecb92f3a22f311b517856abb (diff)
Fix redrawing of underlying exposed area on Widget moves/resizing.
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(),