diff options
-rw-r--r-- | include/opaque.h | 1 | ||||
-rw-r--r-- | include/os.h | 6 | ||||
-rw-r--r-- | include/xkbsrv.h | 3 | ||||
-rw-r--r-- | os/connection.c | 41 | ||||
-rw-r--r-- | os/utils.c | 4 | ||||
-rw-r--r-- | test/Makefile.am | 1 | ||||
-rw-r--r-- | xkb/xkbUtils.c | 6 |
7 files changed, 50 insertions, 12 deletions
diff --git a/include/opaque.h b/include/opaque.h index 73d40c345..7ec1d850f 100644 --- a/include/opaque.h +++ b/include/opaque.h @@ -74,5 +74,6 @@ extern _X_EXPORT Bool whiteRoot; extern _X_EXPORT Bool bgNoneRoot; extern _X_EXPORT Bool CoreDump; +extern _X_EXPORT Bool NoListenAll; #endif /* OPAQUE_H */ diff --git a/include/os.h b/include/os.h index e5f86d67d..d26e399b6 100644 --- a/include/os.h +++ b/include/os.h @@ -166,9 +166,9 @@ extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ ); extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); -#ifdef XQUARTZ -extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); -#endif +extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); + +extern _X_EXPORT Bool AddClientOnOpenFD(int /* fd */ ); extern _X_EXPORT CARD32 GetTimeInMillis(void); extern _X_EXPORT CARD64 GetTimeInMicros(void); diff --git a/include/xkbsrv.h b/include/xkbsrv.h index a80e11970..229de2194 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -824,6 +824,9 @@ extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ , extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ , XkbDescPtr /* src */ ); +extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */, + DeviceIntPtr /* src */); + extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ , XkbDescPtr /* src */ ); diff --git a/os/connection.c b/os/connection.c index ddf4f0a3a..b3640b8e4 100644 --- a/os/connection.c +++ b/os/connection.c @@ -138,6 +138,7 @@ fd_set OutputPending; /* clients with reply/event data ready to go */ int MaxClients = 0; Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ +Bool NoListenAll; /* Don't establish any listening sockets */ static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or @@ -406,7 +407,10 @@ CreateWellKnownSockets(void) /* display is initialized to "0" by main(). It is then set to the display * number if specified on the command line, or to NULL when the -displayfd * option is used. */ - if (display) { + if (NoListenAll) { + ListenTransCount = 0; + } + else if (display) { if (TryCreateSocket(atoi(display), &partial) && ListenTransCount >= 1) if (!PartialNetwork && partial) @@ -440,9 +444,10 @@ CreateWellKnownSockets(void) DefineSelf (fd); } - if (!XFD_ANYSET(&WellKnownConnections)) + if (!XFD_ANYSET(&WellKnownConnections) && !NoListenAll) FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running"); + #if !defined(WIN32) OsSignal(SIGPIPE, SIG_IGN); OsSignal(SIGHUP, AutoResetServer); @@ -1253,8 +1258,7 @@ MakeClientGrabPervious(ClientPtr client) } } -#ifdef XQUARTZ -/* Add a fd (from launchd) to our listeners */ +/* Add a fd (from launchd or similar) to our listeners */ void ListenOnOpenFD(int fd, int noxauth) { @@ -1276,7 +1280,7 @@ ListenOnOpenFD(int fd, int noxauth) */ ciptr = _XSERVTransReopenCOTSServer(5, fd, port); if (ciptr == NULL) { - ErrorF("Got NULL while trying to Reopen launchd port.\n"); + ErrorF("Got NULL while trying to Reopen listen port.\n"); return; } @@ -1309,4 +1313,29 @@ ListenOnOpenFD(int fd, int noxauth) #endif } -#endif +/* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */ +Bool +AddClientOnOpenFD(int fd) +{ + XtransConnInfo ciptr; + CARD32 connect_time; + char port[20]; + + snprintf(port, sizeof(port), ":%d", atoi(display)); + ciptr = _XSERVTransReopenCOTSServer(5, fd, port); + if (ciptr == NULL) + return FALSE; + + _XSERVTransSetOption(ciptr, TRANS_NONBLOCKING, 1); + ciptr->flags |= TRANS_NOXAUTH; + + connect_time = GetTimeInMillis(); + + if (!AllocNewConnection(ciptr, fd, connect_time)) { + ErrorConnMax(ciptr); + _XSERVTransClose(ciptr); + return FALSE; + } + + return TRUE; +} diff --git a/os/utils.c b/os/utils.c index 497779b52..c513968ad 100644 --- a/os/utils.c +++ b/os/utils.c @@ -270,7 +270,7 @@ LockServer(void) int len; char port[20]; - if (nolock) + if (nolock || NoListenAll) return; /* * Path names @@ -390,7 +390,7 @@ LockServer(void) void UnlockServer(void) { - if (nolock) + if (nolock || NoListenAll) return; if (!StillLocking) { diff --git a/test/Makefile.am b/test/Makefile.am index f8aa65950..88fb6aa96 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -30,7 +30,6 @@ endif xkb_LDADD=$(TEST_LDADD) input_LDADD=$(TEST_LDADD) xtest_LDADD=$(TEST_LDADD) -list_LDADD=$(TEST_LDADD) misc_LDADD=$(TEST_LDADD) fixes_LDADD=$(TEST_LDADD) xfree86_LDADD=$(TEST_LDADD) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 6cf6e79df..c14a790df 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -2027,6 +2027,12 @@ XkbDeviceApplyKeymap(DeviceIntPtr dst, XkbDescPtr desc) return ret; } +Bool +XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) +{ + return XkbDeviceApplyKeymap(dst, src->key->xkbInfo->desc); +} + int XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode) { |