summaryrefslogtreecommitdiff
path: root/dw/textblock.cc
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2011-07-27 10:06:39 -0400
committerJorge Arellano Cid <jcid@dillo.org>2011-07-27 10:06:39 -0400
commit6f2e86c52fbf90d5efaef55fc9757b23bb27a80f (patch)
tree2e16dd5cb8b5a798b961ad5680912becd291e2fa /dw/textblock.cc
parent2527eb3a43e4e433cacf8db65265b7195904891f (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/textblock.cc')
-rw-r--r--dw/textblock.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 045ab729..e1689ea5 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -536,6 +536,11 @@ bool Textblock::buttonReleaseImpl (core::EventButton *event)
return sendSelectionEvent (core::SelectionState::BUTTON_RELEASE, event);
}
+/*
+ * Handle motion inside the widget
+ * (special care is necessary when switching from another widget,
+ * because hoverLink and hoverTooltip are meaningless then).
+ */
bool Textblock::motionNotifyImpl (core::EventMotion *event)
{
if (event->state & core::BUTTON1_MASK)
@@ -557,6 +562,7 @@ bool Textblock::motionNotifyImpl (core::EventMotion *event)
hoverLink = style->x_link;
hoverTooltip = style->x_tooltip;
}
+
// Show/hide tooltip
if (tooltipOld != hoverTooltip) {
if (tooltipOld)
@@ -566,21 +572,27 @@ bool Textblock::motionNotifyImpl (core::EventMotion *event)
} else if (hoverTooltip)
hoverTooltip->onMotion ();
- if (hoverLink != linkOld)
+ _MSG("tb=%p word=%p linkOld=%d hoverLink=%d\n",
+ this, word, linkOld, hoverLink);
+ if (hoverLink != linkOld) {
+ /* LinkEnter with hoverLink == -1 is the same as LinkLeave */
return layout->emitLinkEnter (this, hoverLink, -1, -1, -1);
- else
+ } else {
return hoverLink != -1;
+ }
}
}
void Textblock::enterNotifyImpl (core::EventCrossing *event)
{
+ _MSG(" tb=%p, ENTER NotifyImpl\n", this);
+ /* reset hoverLink so linkEnter is detected */
+ hoverLink = -2;
}
void Textblock::leaveNotifyImpl (core::EventCrossing *event)
{
- hoverLink = -1;
- (void) layout->emitLinkEnter (this, hoverLink, -1, -1, -1);
+ _MSG(" tb=%p, LEAVE NotifyImpl\n", this);
if (hoverTooltip) {
hoverTooltip->onLeave();
hoverTooltip = NULL;