GtkTooltip: Prevent tooltips from appearing offscreen

This commit adds a single additional condition to the maybe_flip_position
function in gdkwindowimpl.c. If a tooltip's unflipped position is below
the bounds of its containing area, the tooltip uses its flipped position
instead. This prevents tooltips from appearing below the bounds of the
screen when a small widget is positioned very close to the bottom edge
of the screen, such as in Budgie and XFCE panel applets.

Fixes #2784.
This commit is contained in:
Campbell Jones
2020-09-30 11:44:41 -04:00
parent ce02673b8b
commit f5bf4aeaa6

View File

@ -166,7 +166,7 @@ maybe_flip_position (gint bounds_pos,
*flipped = TRUE;
secondary = rect_pos + (1 - rect_sign) * rect_size / 2 - offset - (1 - window_sign) * window_size / 2;
if (secondary >= bounds_pos && secondary + window_size <= bounds_pos + bounds_size)
if (secondary >= bounds_pos && secondary + window_size <= bounds_pos + bounds_size || primary > bounds_pos + bounds_size)
return secondary;
*flipped = FALSE;