GNOME Bugzilla – Bug 703471
tooltips misplaced on large/tall widgets
Last modified: 2018-05-02 15:42:42 UTC
Attached is a screenshot of nautilus showing the tooltip from the treeview at a fairly unexpected position. I believe the problem is that the positioning code of GtkTooltip is assuming that the whatever widget we display the tooltip on, the widget will always be small enough saw that the distance between the border of the widget and the position of the mouse pointer is inferior to the size of the mouse cursor + 32 pixels. That is not the case on large widget like a treeview. You can also try this on this small example : ======================================================= const GLib = imports.gi.GLib; const Gtk = imports.gi.Gtk; const Lang = imports.lang; for (let i in Gtk) log(Gtk[i]); log(Gtk); Gtk.init(null, null); let mwindow = new Gtk.Window(); mwindow.resize(500,500); let button = new Gtk.Button({ label: "plop" }); button.set_tooltip_text('fffffffffffffffffffffffffffuuuuuu'); mwindow.add(button); mwindow.show_all(); Gtk.main(); ======================================================= The attached patch provides an improvement over tooltip positioning.
Created attachment 248239 [details] screenshot of the issue
Created attachment 248241 [details] [review] tooltip: rework positionning under pointer
> I believe the problem is that the positioning code of GtkTooltip is assuming > that the whatever widget we display the tooltip on, the widget will always be > small enough saw that the distance between the border of the widget and the > position of the mouse pointer is inferior to the size of the mouse cursor + 32 > pixels. I think this is a bit of misunderstanding what the (admittedly undocumented) tooltip positioning code is trying to achieve. We are trying to place the tooltip outside the widget, unless a) that would move it outside the monitor or b) that would put it too far away from the pointer.
*** Bug 703460 has been marked as a duplicate of this bug. ***
I believe there a problem with the algorithm. The screenshot of the issue clearly shows a tooltip not as close as it could be from the pointer's position. I will rework the patch so that the tooltip is always outside of the widget.
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.
It seems this is still relevant. See also https://gitlab.gnome.org/GNOME/gtk/issues/134, in which a larger-than-normal cursor appears over the tooltip - presumably because we assume a fixed, too small size of the cursor when moving the tooltip away from it, so it's too *close* to the pointer. So that may just be a dupe of this.
-- 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/432.