GNOME Bugzilla – Bug 599618
better tooltip positioning
Last modified: 2016-04-15 04:20:12 UTC
Created attachment 146242 [details] [review] the patch In Fedora 12, we have a GTK+ patch that changes the tooltip positioning to try harder to avoid overlapping the tool you are tipping. I think it works very well and gives a much more predictable behavior.
I can see why it is useful to try harder to overlap the tool you are tipping. This works well in the general case. I think there's a couple of special cases where such behavior does not work well; and I guess the MAX_DISTANCE of 32 pixels is a way to make it not that bad for such cases. You can find such cases in the testtooltips tests under gtk+/tests. Try the test with the three boxes, for the yellow box the tooltip usually pops up near the cursor and the box. For the top-left and top-right corners of the blue box it pops up at an awkward position (IMHO). Same for the bottom corners of the red box. If you point at the leftmost part of the rows in the tree view, the position of the tooltip does not have any predictable behavior. It feels like this will be the case for many widgets that cover a large area and have individual contents that are not widgets. For many of the labels in testtooltips, the tooltip pops up centered below the cursor. For the original positioning function, I have followed advice from Soeren, see: http://mail.gnome.org/archives/gtk-devel-list/2006-April/msg00201.html He advised to have the tooltips position themselves right of the cursor and not centered below. Of course, he is not a UI designer. Maybe this is the right time to actually ask UI designers about good guidelines for tooltips positioning?
One thing that is worth mentioning here is that one could do a bit better than the algorithm in the patch does with widget-specific hints for preferred tooltip positioning. In some cases (menu items, vertical panels), it would be better to prefer left/right positioning over below/above.
This patch break gtk2 tooltip positions in some cases. My case: 1. OS: Fedora 22, Fedora 23 2. gtk2 with this patch (default installation) 3. xfce4-panel, tint2 - system tray notifications has invalid position (http://imgur.com/mC27Pj2) 4. nouveau video driver After rebuild gtk2 package without this patch problem is gone.