summaryrefslogtreecommitdiff
path: root/plugingui/widget.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-11-29 21:27:20 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-11-29 21:27:20 +0100
commite4088c3bbfd71f1a9f4ae7344bd5c43202b2ed3e (patch)
treeb8b3a0168115cf409ea690d803586da9a662c500 /plugingui/widget.cc
parent66a51cd2c4474c89bce6a7429bd9b8172f748ac0 (diff)
Fix find of child widgets starting 'before' (0,0).
Diffstat (limited to 'plugingui/widget.cc')
-rw-r--r--plugingui/widget.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/plugingui/widget.cc b/plugingui/widget.cc
index 9b766df..4b92e65 100644
--- a/plugingui/widget.cc
+++ b/plugingui/widget.cc
@@ -103,6 +103,8 @@ void Widget::resize(int width, int height)
_width = width;
_height = height;
pixbuf.realloc(width, height);
+
+ sizeChangeNotifier(width, height);
}
void Widget::move(size_t x, size_t y)
@@ -111,12 +113,12 @@ void Widget::move(size_t x, size_t y)
_y = y;
}
-size_t Widget::x()
+int Widget::x()
{
return _x;
}
-size_t Widget::y()
+int Widget::y()
{
return _y;
}
@@ -153,26 +155,21 @@ size_t Widget::windowY()
return window_y;
}
-Widget* Widget::find(size_t x, size_t y)
+Widget* Widget::find(int x, int y)
{
for(auto i = children.rbegin(); i != children.rend(); ++i)
{
Widget* widget = *i;
if(widget->visible())
{
- if((widget->x() <= x) && ((widget->x() + widget->width()) >= x) &&
- (widget->y() <= y) && ((widget->y() + widget->height()) >= y))
+ if((x >= widget->x()) && (x < (widget->x() + (int)widget->width())) &&
+ (y >= widget->y()) && (y < (widget->y() + (int)widget->height())))
{
return widget->find(x - widget->x(), y - widget->y());
}
}
}
- if((x > width()) || (y > height()))
- {
- return nullptr;
- }
-
return this;
}