plugins/default: Initialize background color in a predictable manner

The order of which function argument expressions are executed is
undefined, so don't rely on this for setting the background colors, as
it results in different colors on different architectures.

For example, it has been observed that the order of execution is
reversed comparing x86_64 and aarch64, making these two architectures
having different background color.

Fix this confusion, and also reproduceability in future reference tests,
by making the order of execution predictable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
Jonas Ådahl 2021-02-14 00:17:36 +01:00 committed by Marge Bot
parent c8089f07a3
commit ba38057067

View File

@ -338,6 +338,9 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
MetaRectangle rect;
ClutterActor *background_actor;
MetaBackground *background;
uint8_t red;
uint8_t green;
uint8_t blue;
ClutterColor color;
meta_display_get_monitor_geometry (display, i, &rect);
@ -353,11 +356,11 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
parsing the driconf XML, but it's nice if the colors are
reproducible.
*/
clutter_color_init (&color,
g_rand_int_range (rand, 0, 255),
g_rand_int_range (rand, 0, 255),
g_rand_int_range (rand, 0, 255),
255);
blue = g_rand_int_range (rand, 0, 255);
green = g_rand_int_range (rand, 0, 255);
red = g_rand_int_range (rand, 0, 255);
clutter_color_init (&color, red, green, blue, 255);
background = meta_background_new (display);
meta_background_set_color (background, &color);