diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2011-07-27 10:06:39 -0400 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2011-07-27 10:06:39 -0400 |
commit | 6f2e86c52fbf90d5efaef55fc9757b23bb27a80f (patch) | |
tree | 2e16dd5cb8b5a798b961ad5680912becd291e2fa /dw/layout.cc | |
parent | 2527eb3a43e4e433cacf8db65265b7195904891f (diff) |
Layout::moveToWidget(): send crossing events (part 2)
This patch fixes 3f74e4d60ac1 (which is partly wrong).
The idea is to avoid spurious leave/enter events, and thus prevent bugs.
* avoid issuing spurious leave/enter events, and send the necessary ones.
* remove the need for a workaround linkEnter() call in
Textblock::leaveNotifyImpl().
Diffstat (limited to 'dw/layout.cc')
-rw-r--r-- | dw/layout.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/dw/layout.cc b/dw/layout.cc index e6aebc62..cf19df37 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -844,7 +844,7 @@ Widget *Layout::getWidgetAtPoint (int x, int y) /* * Emit the necessary crossing events, when the mouse pointer has moved to - * the given widget. + * the given widget (by mouse or scrolling). */ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) { @@ -890,6 +890,12 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) for (w = newWidgetAtPoint; w != ancestor; w = w->getParent ()) track[i--] = w; } +#if 0 + MSG("Track: %s[ ", widgetAtPoint ? "" : "nil "); + for (i = 0; i < trackLen; i++) + MSG("%s%p ", i == i_a ? ">" : "", track[i]); + MSG("] %s\n", newWidgetAtPoint ? "" : "nil"); +#endif /* Send events to the widgets on the track */ for (i = 0; i < trackLen; i++) { @@ -899,10 +905,11 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) if (i < i_a) { track[i]->leaveNotify (&crossingEvent); } else if (i == i_a) { /* ancestor */ - if (!widgetAtPoint) - track[i]->enterNotify (&crossingEvent); - else if (!newWidgetAtPoint) + /* don't touch ancestor unless moving into/from NULL */ + if (i_a == trackLen-1 && !newWidgetAtPoint) track[i]->leaveNotify (&crossingEvent); + else if (i_a == 0 && !widgetAtPoint) + track[i]->enterNotify (&crossingEvent); } else { track[i]->enterNotify (&crossingEvent); } |