GNOME Bugzilla – Bug 703460
Misplaced tooltips due to positioning using the allocation, which may not yet be set
Last modified: 2018-05-02 15:42:15 UTC
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.
Created attachment 248221 [details] [review] tooltip: fix missplaced tooltips
Created attachment 248222 [details] screenshot of the issue
*** This bug has been marked as a duplicate of bug 703471 ***
Matthias, I'm reopening because these 2 bugs are separate issues. This one is a about an incorrect positioning of tooltips because the allocation reported by gtk_widget_get_allocation is invalid, which leads to a wrong positioning. 703471 is about the positioning code not doing something "pretty", regardless of whether the allocation of the widget is correct or not.
Created attachment 249596 [details] [review] tooltip: fix missplaced tooltips Reword the patch's comment.
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
*** Bug 698730 has been marked as a duplicate of this bug. ***
It looks like a partial fix for this was committed from Bug 698730, but the core point of this one still stands, I think. And I think that at a glance, the patch here is tidier, simplier, and more future-proof (iirc in GTK+ 4, widgets can have 0x0 allocations)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/431.