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@redhat.com>
This commit is contained in:
parent
2118e4471b
commit
08843efc59
|
@ -93,6 +93,10 @@ ddxUseMsg(void)
|
||||||
ErrorF("-eglstream use eglstream backend for nvidia GPUs\n");
|
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
|
int
|
||||||
ddxProcessArgument(int argc, char *argv[], int i)
|
ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
{
|
{
|
||||||
|
@ -100,10 +104,19 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], "-listen") == 0) {
|
else if (strcmp(argv[i], "-listen") == 0) {
|
||||||
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
||||||
|
|
||||||
NoListenAll = TRUE;
|
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;
|
return 2;
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], "-wm") == 0) {
|
else if (strcmp(argv[i], "-wm") == 0) {
|
||||||
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
||||||
|
wm_fd = atoi(argv[i + 1]);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], "-shm") == 0) {
|
else if (strcmp(argv[i], "-shm") == 0) {
|
||||||
|
@ -880,9 +893,7 @@ xwl_sync_events (struct xwl_screen *xwl_screen)
|
||||||
static CARD32
|
static CARD32
|
||||||
add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
|
add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
|
||||||
{
|
{
|
||||||
struct xwl_screen *xwl_screen = arg;
|
if (!AddClientOnOpenFD(wm_fd))
|
||||||
|
|
||||||
if (!AddClientOnOpenFD(xwl_screen->wm_fd))
|
|
||||||
FatalError("Failed to add wm client\n");
|
FatalError("Failed to add wm client\n");
|
||||||
|
|
||||||
TimerFree(timer);
|
TimerFree(timer);
|
||||||
|
@ -891,12 +902,12 @@ add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
listen_on_fds(struct xwl_screen *xwl_screen)
|
listen_on_fds(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < xwl_screen->listen_fd_count; i++)
|
for (i = 0; i < listen_fd_count; i++)
|
||||||
ListenOnOpenFD(xwl_screen->listen_fds[i], FALSE);
|
ListenOnOpenFD(listen_fds[i], FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -913,7 +924,7 @@ wm_selection_callback(CallbackListPtr *p, void *data, void *arg)
|
||||||
info->kind != SelectionSetOwner)
|
info->kind != SelectionSetOwner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
listen_on_fds(xwl_screen);
|
listen_on_fds();
|
||||||
|
|
||||||
DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
|
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);
|
xwl_screen = calloc(1, sizeof *xwl_screen);
|
||||||
if (xwl_screen == NULL)
|
if (xwl_screen == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
xwl_screen->wm_fd = -1;
|
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
|
if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -950,21 +960,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
||||||
if (strcmp(argv[i], "-rootless") == 0) {
|
if (strcmp(argv[i], "-rootless") == 0) {
|
||||||
xwl_screen->rootless = 1;
|
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) {
|
else if (strcmp(argv[i], "-shm") == 0) {
|
||||||
xwl_screen->glamor = 0;
|
xwl_screen->glamor = 0;
|
||||||
}
|
}
|
||||||
|
@ -989,11 +984,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
||||||
else
|
else
|
||||||
xwl_screen->root_clip_mode = ROOT_CLIP_FULL;
|
xwl_screen->root_clip_mode = ROOT_CLIP_FULL;
|
||||||
|
|
||||||
if (xwl_screen->listen_fd_count > 0) {
|
if (listen_fd_count > 0) {
|
||||||
if (xwl_screen->wm_fd >= 0)
|
if (wm_fd >= 0) {
|
||||||
AddCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
|
TimerSet(NULL, 0, 1, add_client_fd, NULL);
|
||||||
else
|
AddCallback(&SelectionCallback, wm_selection_callback, NULL);
|
||||||
listen_on_fds(xwl_screen);
|
} else {
|
||||||
|
listen_on_fds();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xorg_list_init(&xwl_screen->output_list);
|
xorg_list_init(&xwl_screen->output_list);
|
||||||
|
|
|
@ -120,9 +120,6 @@ struct xwl_screen {
|
||||||
int expecting_event;
|
int expecting_event;
|
||||||
enum RootClipMode root_clip_mode;
|
enum RootClipMode root_clip_mode;
|
||||||
|
|
||||||
int wm_fd;
|
|
||||||
int listen_fds[5];
|
|
||||||
int listen_fd_count;
|
|
||||||
int rootless;
|
int rootless;
|
||||||
int glamor;
|
int glamor;
|
||||||
int present;
|
int present;
|
||||||
|
|
Loading…
Reference in New Issue