clutter/stage: Fix picking of rectangles with negative positions

FLT_MIN is the smallest *positive* number above 0 that can be
represented as floating point number. If this is used to initialize the
maximum x/y coordinates of a rectangle, this will always be used if all
x/y coordinates of the rectangle are negative. This means that picking
at 0,0 will always be a hit for such rectangles.

Since mutter creates such a window for server side decorations on X11,
this window will always be picked at 0,0 preventing clicking/hovering
the activities button in gnome-shell at that coordinate.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/893


(cherry picked from commit 674f52ba74)
This commit is contained in:
Sebastian Keller 2019-12-23 16:53:53 +00:00 committed by Georges Basile Stavracas Neto
parent 9772f084bf
commit 5724310899

View File

@ -486,9 +486,9 @@ is_inside_axis_aligned_rectangle (const ClutterPoint *point,
const ClutterPoint *vertices) const ClutterPoint *vertices)
{ {
float min_x = FLT_MAX; float min_x = FLT_MAX;
float max_x = FLT_MIN; float max_x = -FLT_MAX;
float min_y = FLT_MAX; float min_y = FLT_MAX;
float max_y = FLT_MIN; float max_y = -FLT_MAX;
int i; int i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)