aboutsummaryrefslogtreecommitdiff
path: root/dw/layout.cc
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2011-07-08 11:56:44 -0400
committerJorge Arellano Cid <jcid@dillo.org>2011-07-08 11:56:44 -0400
commitc5dbb7e648f6130544bbf1957d0a558a0634c63b (patch)
tree95d8adf6a4247487116dffe5fc0a52fa0684e8ee /dw/layout.cc
parent165d9c378d9d4153b7396066bb0651737ea17add (diff)
Layout::moveToWidget(): send crossing events considering border cases
i.e. when the source or target widget is NULL (This patch doesn't fix a *known* bug ATM, but it could be doing it, or may avoid one in the future).
Diffstat (limited to 'dw/layout.cc')
-rw-r--r--dw/layout.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index b502ae65..e6aebc62 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -850,9 +850,10 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state)
{
Widget *ancestor, *w;
Widget **track;
- int trackLen, i;
+ int trackLen, i, i_a;
EventCrossing crossingEvent;
+ _MSG("moveToWidget: wap=%p nwap=%p\n",widgetAtPoint,newWidgetAtPoint);
if (newWidgetAtPoint != widgetAtPoint) {
// The mouse pointer has been moved into another widget.
if (newWidgetAtPoint && widgetAtPoint)
@@ -881,6 +882,7 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state)
/* first part */
for (w = widgetAtPoint; w != ancestor; w = w->getParent ())
track[i++] = w;
+ i_a = i;
track[i++] = ancestor;
if (newWidgetAtPoint) {
/* second part */
@@ -889,16 +891,21 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state)
track[i--] = w;
}
- /* Send events to all events on the track */
+ /* Send events to the widgets on the track */
for (i = 0; i < trackLen; i++) {
crossingEvent.state = state;
crossingEvent.currentWidget = widgetAtPoint; // ???
crossingEvent.lastWidget = widgetAtPoint; // ???
-
- if (i != 0)
- track[i]->enterNotify (&crossingEvent);
- if (i != trackLen - 1)
+ if (i < i_a) {
track[i]->leaveNotify (&crossingEvent);
+ } else if (i == i_a) { /* ancestor */
+ if (!widgetAtPoint)
+ track[i]->enterNotify (&crossingEvent);
+ else if (!newWidgetAtPoint)
+ track[i]->leaveNotify (&crossingEvent);
+ } else {
+ track[i]->enterNotify (&crossingEvent);
+ }
}
delete[] track;