GtkTooltip: Fix tooltip positioning on X11
On X11, gdk_window_move_to_rect()
uses the position of the window to
calculate how it should be moved. However, any pending resizes that will
be executed on show()
are not taken into account, resulting in
incorrectly positioned tooltips in case a tooltip window is re-used often. This is
not solved by gtk_widget_realize()
, as this will do nothing if the
window is already realized.
Let's add a call to the private gtk_window_move_resize()
function, so
that the size is always recalculated before the window is sent to
gdk_window_move_to_rect()
.
This exact fix was also needed in GtkMenu (7298e73c), with similar reasoning.
Fixes #2142 (closed)
Fixes #2227 (closed)
#2227 (closed) is hard for me to verify as I can't test on Mac, but it sounds exactly the same with similar behavior. I will ask on the Inkscape issue if they can test. #431 might possibly be related too? That one's very old though.
Edit
I managed to build libgtk-3-0.dll
on Windows with this patch and replace the one Inkscape uses. I can confirm that the bug is present on Windows too (also https://gitlab.com/inkscape/inkscape/-/issues/4118), but it is also resolved with this patch.
Verification
Using Inkscape 1.3 on Fedora 38, with GDK_BACKEND=x11
.