[mutter/wip/carlosg/xwayland-on-demand: 154/159] wayland: Refactor code setting up the display socket
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/xwayland-on-demand: 154/159] wayland: Refactor code setting up the display socket
- Date: Sat, 22 Jun 2019 09:01:26 +0000 (UTC)
commit 9ec25bc34f2453007e6f36a67e7c356a074ec4d5
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun May 26 00:37:57 2019 +0200
wayland: Refactor code setting up the display socket
So it may be reused when we need to open those again.
src/wayland/meta-xwayland.c | 40 ++++++++++++++++++++++++++++------------
1 file changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 1c1f327b6..ca9ca98da 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -387,6 +387,32 @@ meta_xwayland_override_display_number (int number)
display_number_override = number;
}
+static gboolean
+open_display_sockets (MetaXWaylandManager *manager,
+ int display_index,
+ gboolean *fatal)
+{
+ int abstract_fd, unix_fd;
+
+ abstract_fd = bind_to_abstract_socket (display_index,
+ fatal);
+ if (abstract_fd < 0)
+ return FALSE;
+
+ unix_fd = bind_to_unix_socket (display_index);
+ if (unix_fd < 0)
+ {
+ *fatal = FALSE;
+ close (abstract_fd);
+ return FALSE;
+ }
+
+ manager->abstract_fd = abstract_fd;
+ manager->unix_fd = unix_fd;
+
+ return TRUE;
+}
+
static gboolean
choose_xdisplay (MetaXWaylandManager *manager)
{
@@ -408,8 +434,7 @@ choose_xdisplay (MetaXWaylandManager *manager)
return FALSE;
}
- manager->abstract_fd = bind_to_abstract_socket (display, &fatal);
- if (manager->abstract_fd < 0)
+ if (!open_display_sockets (manager, display, &fatal))
{
unlink (lock_file);
@@ -420,20 +445,11 @@ choose_xdisplay (MetaXWaylandManager *manager)
}
else
{
- g_warning ("Failed to bind abstract socket");
+ g_warning ("Failed to bind X11 socket");
return FALSE;
}
}
- manager->unix_fd = bind_to_unix_socket (display);
- if (manager->unix_fd < 0)
- {
- unlink (lock_file);
- close (manager->abstract_fd);
- display++;
- continue;
- }
-
break;
}
while (1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]