From 5c00dc7ef4646455b1007701fcfee982b773a76b Mon Sep 17 00:00:00 2001 From: Campbell Jones Date: Sat, 10 Dec 2022 18:39:13 -0500 Subject: [PATCH] GdkSurface: prevent popups from appearing offscreen in edge cases This commit adds a single additional condition to the maybe_flip_position function in gdksurface.c. If a popup's unflipped position is below the bounds of its containing area, the popup 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. --- gdk/gdksurface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index bcdff00db3..052ec0030a 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -256,7 +256,7 @@ maybe_flip_position (int bounds_pos, *flipped = TRUE; secondary = rect_pos + (1 - rect_sign) * rect_size / 2 - offset - (1 - surface_sign) * surface_size / 2; - if (secondary >= bounds_pos && secondary + surface_size <= bounds_pos + bounds_size) + if ((secondary >= bounds_pos && secondary + surface_size <= bounds_pos + bounds_size) || primary > bounds_pos + bounds_size) return secondary; *flipped = FALSE;