<table><tr><td style="">tobiasdeiminger added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D7874" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Sorry for the regression! I don't have a development environment for okular atm., the following is only from top of my head...</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>Anyone knows why he would have thought of requiring a handle for showing the tooltip?</p></blockquote>

<p>MouseAnnotation can be in a state where an annotation has been selected by left-click, but then the mouse went further somewhere else on the document - maybe even over another yet unselected annotation. We do not want to show a tooltip for the selected annotation (m_focusedAnnotation), but for that one where the cursor is actually over (m_mouseOverAnnotation). To distinct those cases, MouseAnnotation can internally look at m_handle. m_handle tracks the current position of the mouse while it represents the different functional areas of an annotation under the cursor (upper left corner, upper left corner, inside, nowhere...).</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">bool MouseAnnotation::isMouseOver() const
{
    return ( m_mouseOverAnnotation.isValid() || m_handle != RH_None );
}</pre></div>

<p>IIRC, isValid() and m_handle != RH_None are not exactly equal. The latter condition is true if the cursor is inside the imaginary surrounding rectangle, while isValid() is only true if mouse is over actual graphics. That makes a difference when you have an annotation like a circle, where only the border is drawn, and the inner area is not part of the annotation.</p>

<p>It seems good to remove the lines as you're doing it with your patch, as they seem to be redundant. We do the same check right before in pageView.cpp by calling MouseAnnotation::isMouseOver():</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">if ( d->mouseAnnotation->isMouseOver() )
{
    d->mouseAnnotation->routeTooltipEvent( he );
}</pre></div>

<p>Does removing the lines already fix the bug? I'm not sure if it can, it removes redundancy and makes the code cleaner - but does it also change effective behavior?</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7874" rel="noreferrer">https://phabricator.kde.org/D7874</a></div></div><br /><div><strong>To: </strong>aacid<br /><strong>Cc: </strong>tobiasdeiminger, Okular, aacid<br /></div>