Skip to content

Make tooltips use gdk_window_move_to_rect()

Jonas Ådahl requested to merge jadahl/gtk:wip/tooltip-move-to-rect into gtk-3-24

Copying the commit message from the last commit:

    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.

Initially marking as WIP, because I suspect this might have consequences for at least the OSX backend. At least if I understand https://bugzilla.gnome.org/show_bug.cgi?id=693313 correctly, OSX doesn't understand "transient-for" well for tooltips.

Edited by Matthias Clasen

Merge request reports