Skip to content
  • Jonas Ådahl's avatar
    tooltip: Implement positioning using gdk_window_move_to_rect() · 6df28420
    Jonas Ådahl authored and Matthias Clasen's avatar Matthias Clasen committed
    In order to make tooltip positioning portable, make use of the
    move_to_rect API. Some semantical changes are made, as identical
    semantics cannot be implemented using the move-to-rect API.
    
    Primarily the implemented semantics are:
    
    Position the tooltip in the center pixels slightly below (defaults to 4
    units below) the tooltipped widget. This is always the case for keyboard
    driven tooltips; the case where it tries to avoid the pointer cursor is
    not implemented.
    
    For pointer position triggered tooltips, implement the following
    additional semantics:
    
    Use the current cursor size to determine the padding used to enlarge the
    anchor rectangle. This is to try to avoid the cursor overlapping the
    tooltip.
    
    If the anchor rectangle is too tall (meaning if we'd be constrained
    and flip on the Y axis, it'd flip too far away from the originally
    intended position), rely only on the pointer position to position the
    tooltip. The approximate pointer cursor rectangle is used as a anchor
    rectangle. Ideally we should use the actual pointer cursor rectangle
    (image used as well as hotspot coordinate), but we don't have API to
    get that information.
    
    If the anchor rectangle isn't to tall, just make sure the tooltip isn't
    too far away from the pointer position on the X axis.
    
    Closes: #134
    Closes: #432
    Closes: #574
    Closes: #579
    Closes: #878
    6df28420