From 48de81b63ec1ea6ce0c0aaacf8b47e756caeae2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 2 Apr 2020 16:05:54 +0200 Subject: [PATCH] tests/test-client: Remove shadow from X11 test client CSS style Gtk is quite buggy and "fluid" in how it handles the shadow margins for windows under X11. The "size" of the window fluctuate between including and excluding a shadow margin in a way that causes issues, as there are no atomic update of any state going on. In order to avoid running into those particular issues now, lets get rid of shadows so the margins are always zero, when the client is using the X11 backend. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1171 --- src/tests/test-client.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/tests/test-client.c b/src/tests/test-client.c index 2c19d9a36..8b37a4225 100644 --- a/src/tests/test-client.c +++ b/src/tests/test-client.c @@ -813,6 +813,32 @@ main(int argc, char **argv) gtk_init (NULL, NULL); + if (!wayland) + { + GdkScreen *screen; + GtkCssProvider *provider; + + screen = gdk_screen_get_default (); + provider = gtk_css_provider_new (); + static const char *no_decoration_css = + "decoration {" + " border-radius: 0 0 0 0;" + " border-width: 0;" + " box-shadow: 0 0 0 0 rgba(0, 0, 0, 0), 0 0 0 0 rgba(0, 0, 0, 0);" + " margin: 0px;" + "}"; + if (!gtk_css_provider_load_from_data (provider, + no_decoration_css, + strlen (no_decoration_css), + &error)) + { + g_printerr ("%s", error->message); + return 1; + } + gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } + windows = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); event_source_quark = g_quark_from_static_string ("event-source");