diff options
author | Sebastian Geerken <devnull@localhost> | 2014-09-24 17:41:34 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-09-24 17:41:34 +0200 |
commit | a3073123c9142c53af0f60f1d8a900b989b38d32 (patch) | |
tree | b57aecfb135b01a9de1a4698cab4bd124d29e030 /dw/widget.cc | |
parent | 9513150a0b0582ad444c8d950a185795b2ff5537 (diff) |
Fixed abortion (Widget::intersects for non-allocated widgets).
Diffstat (limited to 'dw/widget.cc')
-rw-r--r-- | dw/widget.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/dw/widget.cc b/dw/widget.cc index 993c4f9c..64414008 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -130,21 +130,24 @@ Widget::~Widget () */ bool Widget::intersects (Rectangle *area, Rectangle *intersection) { - Rectangle parentArea, childArea; - - parentArea = *area; - parentArea.x += parent->allocation.x; - parentArea.y += parent->allocation.y; - - childArea.x = allocation.x; - childArea.y = allocation.y; - childArea.width = allocation.width; - childArea.height = getHeight (); - - if (parentArea.intersectsWith (&childArea, intersection)) { - intersection->x -= allocation.x; - intersection->y -= allocation.y; - return true; + if (wasAllocated ()) { + Rectangle parentArea, childArea; + + parentArea = *area; + parentArea.x += parent->allocation.x; + parentArea.y += parent->allocation.y; + + childArea.x = allocation.x; + childArea.y = allocation.y; + childArea.width = allocation.width; + childArea.height = getHeight (); + + if (parentArea.intersectsWith (&childArea, intersection)) { + intersection->x -= allocation.x; + intersection->y -= allocation.y; + return true; + } else + return false; } else return false; } |