xwayland: Check for X11 unix directory only once

The function choose_xdisplay() calls open_display_sockets() which calls
ensure_x11_unix_dir().

We don't need to do that from within the loop though, as the directory
/tmp/.X11-unix is the same regardless of the display number.

Move the call to ensure_x11_unix_dir() from open_display_sockets() to
choose_xdisplay() prior to enter the display loop.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1669>
This commit is contained in:
Olivier Fourdan 2021-01-13 18:28:46 +01:00
parent 1bd42e8779
commit f6b4665b02

View File

@ -649,9 +649,6 @@ open_display_sockets (MetaXWaylandManager *manager,
{
int abstract_fd, unix_fd;
if (!ensure_x11_unix_dir (error))
return FALSE;
abstract_fd = bind_to_abstract_socket (display_index, fatal, error);
if (abstract_fd < 0)
return FALSE;
@ -684,6 +681,9 @@ choose_xdisplay (MetaXWaylandManager *manager,
else if (g_getenv ("RUNNING_UNDER_GDM"))
display = 1024;
if (!ensure_x11_unix_dir (error))
return FALSE;
do
{
g_autoptr (GError) local_error = NULL;