D7874: Show tooltip for annotations without handle too

Tobias Deiminger noreply at phabricator.kde.org
Tue Sep 19 08:26:26 UTC 2017


tobiasdeiminger added a comment.


  Sorry for the regression! I don't have a development environment for okular atm., the following is only from top of my head...
  
  > Anyone knows why he would have thought of requiring a handle for showing the tooltip?
  
  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...).
  
    bool MouseAnnotation::isMouseOver() const
    {
        return ( m_mouseOverAnnotation.isValid() || m_handle != RH_None );
    }
  
  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.
  
  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():
  
    if ( d->mouseAnnotation->isMouseOver() )
    {
        d->mouseAnnotation->routeTooltipEvent( he );
    }
  
  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?

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D7874

To: aacid
Cc: tobiasdeiminger, #okular, aacid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20170919/8cd08c30/attachment-0001.html>


More information about the Okular-devel mailing list