xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 13 15:25:10 UTC 2018


 hw/xwayland/xwayland.c |   57 +++++++++++++++++++++++--------------------------
 hw/xwayland/xwayland.h |    3 --
 2 files changed, 27 insertions(+), 33 deletions(-)

New commits:
commit 0a95a8ae625accaf0ef5e2372ef7f65a52658d9d
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 23 15:07:48 2018 -0400

    xwayland: Move command line fd initialization to InitOutput
    
    Again, as this is DDX state not screen state, run it from DDX setup not
    screen setup.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 4b7e2b0d3..2b2274d09 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -984,15 +984,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     else
         xwl_screen->root_clip_mode = ROOT_CLIP_FULL;
 
-    if (listen_fd_count > 0) {
-        if (wm_fd >= 0) {
-            TimerSet(NULL, 0, 1, add_client_fd, NULL);
-            AddCallback(&SelectionCallback, wm_selection_callback, NULL);
-        } else {
-            listen_on_fds();
-        }
-    }
-
     xorg_list_init(&xwl_screen->output_list);
     xorg_list_init(&xwl_screen->seat_list);
     xorg_list_init(&xwl_screen->damage_window_list);
@@ -1161,4 +1152,13 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv)
     xorgGlxCreateVendor();
 
     LocalAccessScopeUser();
+
+    if (listen_fd_count > 0) {
+        if (wm_fd >= 0) {
+            TimerSet(NULL, 0, 1, add_client_fd, NULL);
+            AddCallback(&SelectionCallback, wm_selection_callback, NULL);
+        } else {
+            listen_on_fds();
+        }
+    }
 }
commit 08843efc5940563a2275c654804c999cfc772987
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 23 14:33:24 2018 -0400

    xwayland: Move wm_fd and listen_fds out of xwl_screen
    
    There are logically server state not screen state. Not that multiple
    screens works, at the moment, but that's no excuse to be sloppy.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 605c9f56b..4b7e2b0d3 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -93,6 +93,10 @@ ddxUseMsg(void)
     ErrorF("-eglstream             use eglstream backend for nvidia GPUs\n");
 }
 
+static int wm_fd = -1;
+static int listen_fds[5] = { -1, -1, -1, -1, -1 };
+static int listen_fd_count;
+
 int
 ddxProcessArgument(int argc, char *argv[], int i)
 {
@@ -100,10 +104,19 @@ ddxProcessArgument(int argc, char *argv[], int i)
         return 1;
     }
     else if (strcmp(argv[i], "-listen") == 0) {
+        CHECK_FOR_REQUIRED_ARGUMENTS(1);
+
         NoListenAll = TRUE;
+        if (listen_fd_count == ARRAY_SIZE(listen_fds))
+            FatalError("Too many -listen arguments given, max is %zu\n",
+                       ARRAY_SIZE(listen_fds));
+
+        listen_fds[listen_fd_count++] = atoi(argv[i + 1]);
         return 2;
     }
     else if (strcmp(argv[i], "-wm") == 0) {
+        CHECK_FOR_REQUIRED_ARGUMENTS(1);
+        wm_fd = atoi(argv[i + 1]);
         return 2;
     }
     else if (strcmp(argv[i], "-shm") == 0) {
@@ -880,9 +893,7 @@ xwl_sync_events (struct xwl_screen *xwl_screen)
 static CARD32
 add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
 {
-    struct xwl_screen *xwl_screen = arg;
-
-    if (!AddClientOnOpenFD(xwl_screen->wm_fd))
+    if (!AddClientOnOpenFD(wm_fd))
         FatalError("Failed to add wm client\n");
 
     TimerFree(timer);
@@ -891,12 +902,12 @@ add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
 }
 
 static void
-listen_on_fds(struct xwl_screen *xwl_screen)
+listen_on_fds(void)
 {
     int i;
 
-    for (i = 0; i < xwl_screen->listen_fd_count; i++)
-        ListenOnOpenFD(xwl_screen->listen_fds[i], FALSE);
+    for (i = 0; i < listen_fd_count; i++)
+        ListenOnOpenFD(listen_fds[i], FALSE);
 }
 
 static void
@@ -913,7 +924,7 @@ wm_selection_callback(CallbackListPtr *p, void *data, void *arg)
         info->kind != SelectionSetOwner)
         return;
 
-    listen_on_fds(xwl_screen);
+    listen_on_fds();
 
     DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
 }
@@ -930,7 +941,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     xwl_screen = calloc(1, sizeof *xwl_screen);
     if (xwl_screen == NULL)
         return FALSE;
-    xwl_screen->wm_fd = -1;
 
     if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
         return FALSE;
@@ -950,21 +960,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
         if (strcmp(argv[i], "-rootless") == 0) {
             xwl_screen->rootless = 1;
         }
-        else if (strcmp(argv[i], "-wm") == 0) {
-            xwl_screen->wm_fd = atoi(argv[i + 1]);
-            i++;
-            TimerSet(NULL, 0, 1, add_client_fd, xwl_screen);
-        }
-        else if (strcmp(argv[i], "-listen") == 0) {
-            if (xwl_screen->listen_fd_count ==
-                ARRAY_SIZE(xwl_screen->listen_fds))
-                FatalError("Too many -listen arguments given, max is %zu\n",
-                           ARRAY_SIZE(xwl_screen->listen_fds));
-
-            xwl_screen->listen_fds[xwl_screen->listen_fd_count++] =
-                atoi(argv[i + 1]);
-            i++;
-        }
         else if (strcmp(argv[i], "-shm") == 0) {
             xwl_screen->glamor = 0;
         }
@@ -989,11 +984,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     else
         xwl_screen->root_clip_mode = ROOT_CLIP_FULL;
 
-    if (xwl_screen->listen_fd_count > 0) {
-        if (xwl_screen->wm_fd >= 0)
-            AddCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
-        else
-            listen_on_fds(xwl_screen);
+    if (listen_fd_count > 0) {
+        if (wm_fd >= 0) {
+            TimerSet(NULL, 0, 1, add_client_fd, NULL);
+            AddCallback(&SelectionCallback, wm_selection_callback, NULL);
+        } else {
+            listen_on_fds();
+        }
     }
 
     xorg_list_init(&xwl_screen->output_list);
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 3f4a601fe..3c240c1b0 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -120,9 +120,6 @@ struct xwl_screen {
     int expecting_event;
     enum RootClipMode root_clip_mode;
 
-    int wm_fd;
-    int listen_fds[5];
-    int listen_fd_count;
     int rootless;
     int glamor;
     int present;


More information about the xorg-commit mailing list