Misplaced tooltips due to positioning using the allocation, which may not yet be set
Submitted by Lionel Landwerlin
Link to original bug (#703460)
Description
Attached is a screenshot of nautilus with the mouse pointer positioned in the center of the button. The tooltip's position is fairly offset from where it should be, centered relatively to the position/size of the button and size of the tooltip.
The reason for this is that once you call gtk_widget_hide() on the tooltip, the allocation its allocated size is set to -1x-1. Once you end up if with a hidden and already realized widget, the only to get another valid allocation is to actually show the widget. Unfortunately the tooltip code assumes that once it called gtk_widget_realize() the widget will have a valid allocation.
The attached patch replace the gtk_widget_realize() call by a gtk_widget_get_preferred_size() call.
Version: 3.22.x