diff options
Diffstat (limited to 'plugingui/widget.cc')
-rw-r--r-- | plugingui/widget.cc | 17 |
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; } |