Termux x11 port

This commit is contained in:
Caten
2024-09-20 21:39:48 +08:00
parent 958d7839ff
commit a117050fde
136 changed files with 19410 additions and 92 deletions

View File

@@ -0,0 +1,127 @@
diff --git a/Xtranssock.c b/Xtranssock.c
index b06579c..bb5238b 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -200,20 +200,28 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
#if defined(X11_t)
-#define UNIX_PATH "/tmp/.X11-unix/X"
-#define UNIX_DIR "/tmp/.X11-unix"
+extern char* xtrans_unix_path_x11;
+extern char* xtrans_unix_dir_x11;
+#define UNIX_PATH xtrans_unix_path_x11
+#define UNIX_DIR xtrans_unix_dir_x11
#endif /* X11_t */
#if defined(XIM_t)
-#define UNIX_PATH "/tmp/.XIM-unix/XIM"
-#define UNIX_DIR "/tmp/.XIM-unix"
+extern char* xtrans_unix_path_xim;
+extern char* xtrans_unix_dir_xim;
+#define UNIX_PATH xtrans_unix_path_xim
+#define UNIX_DIR xtrans_unix_dir_xim
#endif /* XIM_t */
#if defined(FS_t) || defined(FONT_t)
-#define UNIX_PATH "/tmp/.font-unix/fs"
-#define UNIX_DIR "/tmp/.font-unix"
+extern char* xtrans_unix_path_fs;
+extern char* xtrans_unix_dir_fs;
+#define UNIX_PATH xtrans_unix_path_fs
+#define UNIX_DIR xtrans_unix_dir_fs
#endif /* FS_t || FONT_t */
#if defined(ICE_t)
-#define UNIX_PATH "/tmp/.ICE-unix/"
-#define UNIX_DIR "/tmp/.ICE-unix"
+extern char* xtrans_unix_path_ice;
+extern char* xtrans_unix_dir_ice;
+#define UNIX_PATH xtrans_unix_path_ice
+#define UNIX_DIR xtrans_unix_dir_ice
#endif /* ICE_t */
diff --git a/Xtransutil.c b/Xtransutil.c
index 63f0fc3..a9620a6 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -478,27 +478,6 @@
}
/* Dir doesn't exist. Try to create it */
-#if !defined(WIN32) && !defined(__CYGWIN__)
- /*
- * 'sticky' bit requested: assume application makes
- * certain security implications. If effective user ID
- * is != 0: fail as we may not be able to meet them.
- */
- if (geteuid() != 0) {
- if (mode & 01000) {
- prmsg(1, "mkdir: ERROR: euid != 0,"
- "directory %s will not be created.\n",
- path);
-#ifdef FAIL_HARD
- return -1;
-#endif
- } else {
- prmsg(1, "mkdir: Cannot create %s with root ownership\n",
- path);
- }
- }
-#endif
-
#ifndef WIN32
if (mkdir(path, mode) == 0) {
if (chmod(path, mode)) {
@@ -521,14 +500,9 @@
} else {
if (S_ISDIR(buf.st_mode)) {
- int updateOwner = 0;
int updateMode = 0;
- int updatedOwner = 0;
int updatedMode = 0;
int status = 0;
- /* Check if the directory's ownership is OK. */
- if (buf.st_uid != 0)
- updateOwner = 1;
/*
* Check if the directory's mode is OK. An exact match isn't
@@ -566,7 +540,7 @@
* directory's owner and mode. Otherwise it isn't safe to attempt
* to do this.
*/
- if (updateMode || updateOwner) {
+ if (updateMode) {
int fd = -1;
struct stat fbuf;
if ((fd = open(path, O_RDONLY)) != -1) {
@@ -588,8 +562,6 @@
close(fd);
return -1;
}
- if (updateOwner && fchown(fd, 0, 0) == 0)
- updatedOwner = 1;
if (updateMode && fchmod(fd, mode) == 0)
updatedMode = 1;
close(fd);
@@ -597,20 +569,6 @@
}
#endif
- if (updateOwner && !updatedOwner) {
-#ifdef FAIL_HARD
- if (status & FAIL_IF_NOT_ROOT) {
- prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n",
- path);
- return -1;
- }
-#endif
-#if !defined(__APPLE_CC__) && !defined(__CYGWIN__)
- prmsg(1, "mkdir: Owner of %s should be set to root\n",
- path);
-#endif
- }
-
if (updateMode && !updatedMode) {
#ifdef FAIL_HARD
if (status & FAIL_IF_NOMODE) {

View File

@@ -0,0 +1,207 @@
#pragma once
#define _DIX_CONFIG_H_ 1
#define HAVE_TYPEOF 1
#define MONOTONIC_CLOCK 1
#undef XSERVER_DTRACE
#define X_BYTE_ORDER X_LITTLE_ENDIAN
#define _GNU_SOURCE 1
#undef HAS_APERTURE_DRV
#define INPUTTHREAD 1
#define HAVE_PTHREAD_SETNAME_NP_WITH_TID 1
#undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID
#undef HAVE_LIBBSD
#undef HAVE_SYSTEMD_DAEMON
#undef CONFIG_UDEV
#undef CONFIG_UDEV_KMS
#undef HAVE_DBUS
#undef CONFIG_HAL
#undef SYSTEMD_LOGIND
#undef NEED_DBUS
#undef CONFIG_WSCONS
#define HAVE_XSHMFENCE 1
#undef WITH_LIBDRM
#undef GLAMOR_HAS_EGL_QUERY_DMABUF
#undef GLAMOR_HAS_EGL_QUERY_DRIVER
#define GLXEXT 1
#undef GLAMOR
#undef GLAMOR_HAS_GBM
#undef GLAMOR_HAS_GBM_LINEAR
#undef GBM_BO_WITH_MODIFIERS
#undef GBM_BO_FD_FOR_PLANE
#define SERVER_MISC_CONFIG_PATH "/usr/lib/xorg"
#define PROJECTROOT "/usr"
#define SYSCONFDIR "/usr/etc"
#define SUID_WRAPPER_DIR "/usr/libexec"
#define COMPILEDDEFAULTFONTPATH "/usr/share/fonts/X11/misc,/usr/share/fonts/X11/TTF,/usr/share/fonts/X11/OTF,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi"
#define HASXDMAUTH 1
#define SECURE_RPC 1
#define HAVE_DLFCN_H 1
#define HAVE_EXECINFO_H 1
#define HAVE_FNMATCH_H 1
#define HAVE_LINUX_AGPGART_H 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_AGPGART_H 1
#define HAVE_SYS_UN_H 1
#define HAVE_SYS_UTSNAME_H 1
#define HAVE_SYS_SYSMACROS_H 1
#define HAVE_ARC4RANDOM_BUF 1
#undef HAVE_BACKTRACE
#undef HAVE_LIBUNWIND
#undef HAVE_PSTACK
#define HAVE_CBRT 1
#define HAVE_EPOLL_CREATE1 1
#define HAVE_GETUID 1
#define HAVE_GETEUID 1
#undef HAVE_ISASTREAM
#undef HAVE_ISSETUGID
#define HAVE_GETIFADDRS 1
#undef HAVE_GETPEEREID
#undef HAVE_GETPEERUCRED
#define HAVE_GETPROGNAME 1
#undef HAVE_GETZONEID
#define HAVE_MEMFD_CREATE 1
#define HAVE_MKOSTEMP 1
#define HAVE_MMAP 1
#undef HAVE_OPEN_DEVICE
#define HAVE_POLL 1
#undef HAVE_POLLSET_CREATE
#define HAVE_POSIX_FALLOCATE 1
#undef HAVE_PORT_CREATE
#undef HAVE_REALLOCARRAY
#define HAVE_SETEUID 1
#define HAVE_SETITIMER 1
#undef HAVE_SHMCTL64
#define HAVE_SIGACTION 1
#define HAVE_SIGPROCMASK 1
#define HAVE_STRCASECMP 1
#define HAVE_STRCASESTR 1
#define HAVE_STRLCAT 1
#define HAVE_STRLCPY 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRNDUP 1
#undef HAVE_TIMINGSAFE_MEMCMP
#define HAVE_VASPRINTF 1
#define HAVE_VSNPRINTF 1
#undef HAVE_WALKCONTEXT
#define BUSFAULT 1
#define _XTYPEDEF_POINTER 1
#define _XITYPEDEF_POINTER 1
#define LISTEN_UNIX
#define LISTEN_LOCAL
#define XTRANS_SEND_FDS 1
#define TCPCONN 1
#define UNIXCONN 1
#define IPv6 1
#define BIGREQS 1
#define COMPOSITE 1
#define DAMAGE 1
#define DBE 1
#define DGA 1
#define DPMSExtension 1
#define DRI2 1
#define DRI3 1
#define HAS_SHM 1
#define MITSHM 1
#define PANORAMIX 1
#define PRESENT 1
#define RANDR 1
#define RES 1
#define RENDER 1
#define SCREENSAVER 1
#define SHAPE 1
#define XACE 1
#define XCMISC 1
#undef XCSECURITY
#define XDMCP 1
#undef XF86BIGFONT
#define XF86DRI 1
#define XF86VIDMODE 1
#define XFIXES 1
#define XFreeXDGA 1
#define XINERAMA 1
#define XINPUT 1
#define XRECORD 1
#undef XSELINUX
#define XSYNC 1
#define XTEST 1
#define XV 1
#define XvExtension 1
#define XvMCExtension 1
/* Use libmd SHA1 functions */
#define HAVE_SHA1_IN_LIBMD 1
#define HAVE_APM 1
#define HAVE_ACPI 1
#undef DDXOSVERRORF
#undef DDXBEFORERESET
#undef DEBUG
#define XVENDORNAME "The X.Org Foundation"
#define XVENDORNAMESHORT "X.Org"
#define __VENDORDWEBSUPPORT__ "http://wiki.x.org"
#define BUILDERADDR "xorg@lists.freedesktop.org"
#define BUILDERSTRING ""
#undef SVR4
#define XKB_DFLT_RULES "evdev"
#undef XORGSERVER
#define XCONFIGFILE "xorg.conf"
#define __XSERVERNAME__ "Xorg"
#define WITH_VGAHW 1
#undef CSRG_BASED
#undef PCCONS_SUPPORT
#undef PCVT_SUPPORT
#undef SYSCONS_SUPPORT
#undef WSCONS_SUPPORT
#undef XSERVER_LIBPCIACCESS
#undef XSERVER_PLATFORM_BUS
#ifdef ANDROID
typedef long long quad_t;
typedef unsigned long long u_quad_t;
#include <unistd.h>
__attribute__((unused))
static int memfd_create(const char *name, unsigned int flags) {
#ifndef __NR_memfd_create
#if defined __i386__
#define __NR_memfd_create 356
#elif defined __x86_64__
#define __NR_memfd_create 319
#elif defined __arm__
#define __NR_memfd_create 385
#elif defined __aarch64__
#define __NR_memfd_create 279
#endif
#endif
#ifdef __NR_memfd_create
return syscall(__NR_memfd_create, name, flags); // NOLINT(cppcoreguidelines-narrowing-conversions)
#else
errno = ENOSYS;
return -1;
#endif
}
#endif
#ifdef __ANDROID__
#define CHECK_EUID 0
extern int execl_xkbcomp(const char * path, const char * arg, ...);
#define setgid(a) 0
#define setuid(a) 0
#endif

View File

@@ -0,0 +1,170 @@
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py
index 3daad84..b27931d 100755
--- a/src/gen_dispatch.py
+++ b/src/gen_dispatch.py
@@ -222,7 +222,7 @@ class Generator(object):
for child in t:
if child.tag == 'apientry':
- self.typedefs += 'APIENTRY'
+ self.typedefs += ''
if child.text:
self.typedefs += child.text
if child.tail:
@@ -462,13 +462,14 @@ class Generator(object):
def write_function_ptr_typedefs(self):
for func in self.sorted_functions:
- self.outln('typedef {0} (GLAPIENTRY *{1})({2});'.format(func.ret_type,
+ self.outln('typedef {0} (*{1})({2});'.format(func.ret_type,
func.ptr_type,
func.args_decl))
def write_header_header(self, out_file):
self.close()
self.out_file = open(out_file, 'w')
+ self.out_file.truncate(0)
self.outln('/* GL dispatch header.')
self.outln(' * This is code-generated from the GL API XML files from Khronos.')
@@ -482,7 +483,7 @@ class Generator(object):
self.outln('#include <stddef.h>')
self.outln('')
- def write_header(self, out_file):
+ def write_header2(self, out_file):
self.write_header_header(out_file)
self.outln('#include "epoxy/common.h"')
@@ -858,6 +859,82 @@ class Generator(object):
for func in self.sorted_functions:
self.write_function_pointer(func)
+ def write_header(self, out_file):
+ self.close()
+ self.out_file = open(out_file, 'w')
+ self.out_file.truncate(0)
+
+ self.outln('/* GL dispatch header.')
+ self.outln(' * This is code-generated from the GL API XML files from Khronos.')
+ self.write_copyright_comment_body()
+ self.outln(' */')
+ self.outln('')
+
+ self.outln('#pragma once')
+
+ self.outln('#include <inttypes.h>')
+ self.outln('#include <stddef.h>')
+ self.outln('')
+
+ # Add some ridiculous inttypes.h redefinitions that are
+ # from khrplatform.h and not included in the XML. We
+ # don't directly include khrplatform.h because it's not
+ # present on many systems, and coming up with #ifdefs to
+ # decide when it's not present would be hard.
+ self.outln('#define __khrplatform_h_ 1')
+ self.outln('typedef int8_t khronos_int8_t;')
+ self.outln('typedef int16_t khronos_int16_t;')
+ self.outln('typedef int32_t khronos_int32_t;')
+ self.outln('typedef int64_t khronos_int64_t;')
+ self.outln('typedef uint8_t khronos_uint8_t;')
+ self.outln('typedef uint16_t khronos_uint16_t;')
+ self.outln('typedef uint32_t khronos_uint32_t;')
+ self.outln('typedef uint64_t khronos_uint64_t;')
+ self.outln('typedef float khronos_float_t;')
+ self.outln('#ifdef _WIN64')
+ self.outln('typedef signed long long int khronos_intptr_t;')
+ self.outln('typedef unsigned long long int khronos_uintptr_t;')
+ self.outln('typedef signed long long int khronos_ssize_t;')
+ self.outln('typedef unsigned long long int khronos_usize_t;')
+ self.outln('#else')
+ self.outln('typedef signed long int khronos_intptr_t;')
+ self.outln('typedef unsigned long int khronos_uintptr_t;')
+ self.outln('typedef signed long int khronos_ssize_t;')
+ self.outln('typedef unsigned long int khronos_usize_t;')
+ self.outln('#endif')
+ self.outln('typedef uint64_t khronos_utime_nanoseconds_t;')
+ self.outln('typedef int64_t khronos_stime_nanoseconds_t;')
+ self.outln('#define KHRONOS_MAX_ENUM 0x7FFFFFFF')
+ self.outln('typedef enum {')
+ self.outln(' KHRONOS_FALSE = 0,')
+ self.outln(' KHRONOS_TRUE = 1,')
+ self.outln(' KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM')
+ self.outln('} khronos_boolean_enum_t;')
+
+ if self.target == "glx":
+ self.outln('#include <X11/Xlib.h>')
+ self.outln('#include <X11/Xutil.h>')
+
+ self.out(self.typedefs)
+ self.outln('')
+ self.write_enums()
+ self.outln('')
+ self.write_function_ptr_typedefs()
+
+ for func in self.sorted_functions:
+ ret = ""
+ if func.ret_type in ("void"):
+ ret = ""
+ elif func.ret_type in ("GLhandleARB", "GLsync", "const GLubyte *", "GLVULKANPROCNV", "void *"):
+ ret = "NULL"
+ elif func.ret_type in ("GLuint", "GLboolean", "GLenum", "GLint", "GLfloat", "GLushort", \
+ "GLintptr", "GLbitfield", "GLvdpauSurfaceNV", "GLsizei", "GLuint64"):
+ ret = "0"
+ else:
+ raise ValueError('Wrong return type "' + func.ret_type + '"')
+ self.outln('#define {0}(...) {1}'.format(func.name, ret))
+
+
def close(self):
if self.out_file:
self.out_file.close()
@@ -869,10 +946,6 @@ argparser.add_argument('files', metavar='file.xml', nargs='+', help='GL API XML
argparser.add_argument('--outputdir', metavar='dir', required=False, help='Destination directory for files (default to current dir)')
argparser.add_argument('--includedir', metavar='dir', required=False, help='Destination directory for headers')
argparser.add_argument('--srcdir', metavar='dir', required=False, help='Destination directory for source')
-argparser.add_argument('--source', dest='source', action='store_true', required=False, help='Generate the source file')
-argparser.add_argument('--no-source', dest='source', action='store_false', required=False, help='Do not generate the source file')
-argparser.add_argument('--header', dest='header', action='store_true', required=False, help='Generate the header file')
-argparser.add_argument('--no-header', dest='header', action='store_false', required=False, help='Do not generate the header file')
args = argparser.parse_args()
if args.outputdir:
@@ -890,13 +963,6 @@ if args.srcdir:
else:
srcdir = outputdir
-build_source = args.source
-build_header = args.header
-
-if not build_source and not build_header:
- build_source = True
- build_header = True
-
for f in args.files:
name = os.path.basename(f).split('.xml')[0]
generator = Generator(name)
@@ -911,22 +977,8 @@ for f in args.files:
generator.sort_functions()
generator.resolve_aliases()
- generator.fixup_bootstrap_function('glGetString',
- 'epoxy_get_bootstrap_proc_address({0})')
- generator.fixup_bootstrap_function('glGetIntegerv',
- 'epoxy_get_bootstrap_proc_address({0})')
-
- # While this is technically exposed as a GLX extension, it's
- # required to be present as a public symbol by the Linux OpenGL
- # ABI.
- generator.fixup_bootstrap_function('glXGetProcAddress',
- 'epoxy_glx_dlsym({0})')
generator.prepare_provider_enum()
-
- if build_header:
- generator.write_header(os.path.join(includedir, name + '_generated.h'))
- if build_source:
- generator.write_source(os.path.join(srcdir, name + '_generated_dispatch.c'))
+ generator.write_header(os.path.join(includedir, name + '.h'))
generator.close()

View File

@@ -0,0 +1,35 @@
diff -u -r ../pixman-0.32.6/pixman/pixman-arm.c ./pixman/pixman-arm.c
--- ../pixman-0.32.6/pixman/pixman-arm.c 2013-11-17 09:43:18.000000000 +0100
+++ ./pixman/pixman-arm.c 2014-08-05 12:54:39.252322492 +0200
@@ -96,30 +96,10 @@
#elif defined(__ANDROID__) || defined(ANDROID) /* Android */
-#include <cpu-features.h>
-
static arm_cpu_features_t
detect_cpu_features (void)
{
- arm_cpu_features_t features = 0;
- AndroidCpuFamily cpu_family;
- uint64_t cpu_features;
-
- cpu_family = android_getCpuFamily();
- cpu_features = android_getCpuFeatures();
-
- if (cpu_family == ANDROID_CPU_FAMILY_ARM)
- {
- if (cpu_features & ANDROID_CPU_ARM_FEATURE_ARMv7)
- features |= ARM_V7;
-
- if (cpu_features & ANDROID_CPU_ARM_FEATURE_VFPv3)
- features |= ARM_VFP;
-
- if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON)
- features |= ARM_NEON;
- }
-
+ arm_cpu_features_t features = (ARM_V7 | ARM_VFP | ARM_NEON);
return features;
}

View File

@@ -0,0 +1,58 @@
diff --git a/src/Quarks.c b/src/Quarks.c
index 0dd91968..dbaf5086 100644
--- a/src/Quarks.c
+++ b/src/Quarks.c
@@ -105,6 +105,11 @@ static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */
#define CLEARPERM(q) BYTEREF(q) &= ~(1 << ((q) & 7))
#endif
+#undef _XLockMutex
+#undef _XUnlockMutex
+#define _XLockMutex(m)
+#define _XUnlockMutex(m)
+
/* Permanent memory allocation */
#define WALIGN sizeof(unsigned long)
diff --git a/src/Xrm.c b/src/Xrm.c
index a8ebf883..d716fdb0 100644
--- a/src/Xrm.c
+++ b/src/Xrm.c
@@ -301,6 +301,13 @@ typedef unsigned char XrmBits;
#define is_simple(bits) ((bits) & (NORMAL|BSLASH))
#define is_special(bits) ((bits) & (ENDOF|BSLASH))
+#undef _XLockMutex
+#undef _XUnlockMutex
+#undef _XCreateMutex
+#define _XLockMutex(m)
+#define _XUnlockMutex(m)
+#define _XCreateMutex(m)
+
/* parsing types */
static XrmBits const xrmtypes[256] = {
EOS,0,0,0,0,0,0,0,
@@ -500,9 +507,7 @@ static XrmDatabase NewDatabase(void)
_XCreateMutex(&db->linfo);
db->table = (NTable)NULL;
db->mbstate = (XPointer)NULL;
- db->methods = _XrmInitParseInfo(&db->mbstate);
- if (!db->methods)
- db->methods = &mb_methods;
+ db->methods = &mb_methods;
}
return db;
}
--- a/include/X11/Xlocale.h
+++ b/include/X11/Xlocale.h
@@ -32,6 +32,9 @@ from The Open Group.
#include <X11/Xfuncproto.h>
#include <X11/Xosdefs.h>
+struct __locale_t;
+typedef struct __locale_t* locale_t;
+
#include <locale.h>
#endif /* _X11_XLOCALE_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
diff --git a/src/xkbatom.c b/src/xkbatom.c
index 564cc83..723e6da 100644
--- a/src/xkbatom.c
+++ b/src/xkbatom.c
@@ -202,9 +202,7 @@ XkbAtomGetString(Display *dpy, Atom atm)
{
if (atm == None)
return NULL;
- if (dpy == NULL)
- return _XkbNameForAtom(atm);
- return XGetAtomName(dpy, atm);
+ return _XkbNameForAtom(atm);
}
/***====================================================================***/
@@ -214,10 +212,7 @@ XkbInternAtom(Display *dpy, const char *name, Bool onlyIfExists)
{
if (name == NULL)
return None;
- if (dpy == NULL) {
- return _XkbMakeAtom(name, strlen(name), (!onlyIfExists));
- }
- return XInternAtom(dpy, name, onlyIfExists);
+ return _XkbMakeAtom(name, strlen(name), (!onlyIfExists));
}
/***====================================================================***/

View File

@@ -0,0 +1,208 @@
diff --git a/Xext/shm.c b/Xext/shm.c
index 071bd1a41..011969283 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -193,6 +193,10 @@ CheckForShmSyscall(void)
#endif
+const DevPrivateKey ShmGetDevPrivateKeyRec(void) {
+ return shmPixmapPrivateKey;
+}
+
static Bool
ShmCloseScreen(ScreenPtr pScreen)
{
diff --git a/Xext/shmint.h b/Xext/shmint.h
index 9dadea756..e4e6f4db6 100644
--- a/Xext/shmint.h
+++ b/Xext/shmint.h
@@ -80,6 +80,8 @@ typedef struct _ShmDesc {
#define SHMDESC_IS_FD(shmdesc) (0)
#endif
+extern const DevPrivateKey ShmGetDevPrivateKeyRec(void);
+
extern _X_EXPORT void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
diff --git a/dix/main.c b/dix/main.c
index bfc8addbe..56fb30b63 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -266,6 +266,7 @@ dix_main(int argc, char *argv[], char *envp[])
}
NotifyParentProcess();
+ ddxReady();
InputThreadInit();
diff --git a/include/os.h b/include/os.h
index bb3348b18..1a5400717 100644
--- a/include/os.h
+++ b/include/os.h
@@ -560,6 +560,8 @@ enum ExitCode {
extern _X_EXPORT void
ddxGiveUp(enum ExitCode error);
extern _X_EXPORT void
+ddxReady(void);
+extern _X_EXPORT void
ddxInputThreadInit(void);
extern _X_EXPORT int
TimeSinceLastInputEvent(void);
diff --git a/include/xkbfile.h b/include/xkbfile.h
index f93d31ab0..f65338ac4 100644
--- a/include/xkbfile.h
+++ b/include/xkbfile.h
@@ -79,6 +79,36 @@ typedef void (*XkbFileAddOnFunc) (FILE * /* file */ ,
/***====================================================================***/
+#define XkbInternAtom XXkbInternAtom
+#define XkbAtomText XXkbAtomText
+#define XkbStringText XXkbStringText
+#define XkbVModIndexText XXkbVModIndexText
+#define XkbVModMaskText XXkbVModMaskText
+#define XkbModMaskText XXkbModMaskText
+#define XkbModIndexText XXkbModIndexText
+#define XkbConfigText XXkbConfigText
+#define XkbKeysymText XXkbKeysymText
+#define XkbKeyNameText XXkbKeyNameText
+#define XkbSIMatchText XXkbSIMatchText
+#define XkbIMWhichStateMaskText XXkbIMWhichStateMaskText
+#define XkbControlsMaskText XXkbControlsMaskText
+#define XkbGeomFPText XXkbGeomFPText
+#define XkbDoodadTypeText XXkbDoodadTypeText
+#define XkbActionTypeText XXkbActionTypeText
+#define XkbActionText XXkbActionText
+#define XkbBehaviorText XXkbBehaviorText
+#define XkbIndentText XXkbIndentText
+#define XkbWriteXKBKeycodes XXkbWriteXKBKeycodes
+#define XkbWriteXKBKeyTypes XXkbWriteXKBKeyTypes
+#define XkbWriteXKBCompatMap XXkbWriteXKBCompatMap
+#define XkbWriteXKBSymbols XXkbWriteXKBSymbols
+#define XkbWriteXKBGeometry XXkbWriteXKBGeometry
+#define XkbWriteXKBKeymapForNames XXkbWriteXKBKeymapForNames
+#define XkbFindKeycodeByName XXkbFindKeycodeByName
+#define XkbConvertGetByNameComponents XXkbConvertGetByNameComponents
+#define XkbNameMatchesPattern XXkbNameMatchesPattern
+#define _XkbKSCheckCase _XXkbKSCheckCase
+
_XFUNCPROTOBEGIN
extern _X_EXPORT char *XkbIndentText(unsigned /* size */
diff --git a/os/osinit.c b/os/osinit.c
index 8575319ff..06c44a416 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -170,11 +170,11 @@ OsInit(void)
#endif
if (!been_here) {
-#if !defined(WIN32) || defined(__CYGWIN__)
+#if !defined(WIN32) || defined(__CYGWIN__) || !defined(__ANDROID__)
struct sigaction act, oact;
int i;
- int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
+ int siglist[] = { SIGQUIT, SIGILL, SIGFPE, SIGBUS,
SIGABRT,
SIGSYS,
SIGXCPU,
diff --git a/os/utils.c b/os/utils.c
index 92a66e81a..d2ca69684 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -212,6 +212,8 @@ OsSignal(int sig, OsSigHandlerPtr handler)
{
#if defined(WIN32) && !defined(__CYGWIN__)
return signal(sig, handler);
+#elif defined(__ANDROID__)
+ return SIG_DFL;
#else
struct sigaction act, oact;
@@ -232,7 +234,7 @@ OsSignal(int sig, OsSigHandlerPtr handler)
* server at a time. This keeps the servers from stomping on each other
* if the user forgets to give them different display numbers.
*/
-#define LOCK_DIR "/tmp"
+#define LOCK_DIR (getenv("TMPDIR") ?: "/tmp")
#define LOCK_TMP_PREFIX "/.tX"
#define LOCK_PREFIX "/.X"
#define LOCK_SUFFIX "-lock"
@@ -324,7 +326,7 @@ LockServer(void)
i = 0;
haslock = 0;
while ((!haslock) && (i++ < 3)) {
- haslock = (link(tmp, LockFile) == 0);
+ haslock = (rename(tmp, LockFile) == 0);
if (haslock) {
/*
* We're done.
@@ -1412,6 +1414,10 @@ static struct pid {
int pid;
} *pidlist;
+extern char* xkbcomp_argv[];
+extern int xkbcomp_argc;
+int xkbcomp_main(int argc, char *argv[]);
+
void *
Popen(const char *command, const char *type)
{
@@ -1475,8 +1481,11 @@ Popen(const char *command, const char *type)
}
close(pdes[1]);
}
- execl("/bin/sh", "sh", "-c", command, (char *) NULL);
- _exit(127);
+
+ for(int j=1; j<= SIGUNUSED; j++)
+ signal(j, SIG_DFL);
+
+ _exit(xkbcomp_main(xkbcomp_argc, xkbcomp_argv));
}
/* Avoid EINTR during stdio calls */
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index f9b7b06d9..f4b2aeddc 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -56,6 +56,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define PATHSEPARATOR "/"
#endif
+char* xkbcomp_argv[16] = {0};
+int xkbcomp_argc = 0;
+
static unsigned
LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn);
@@ -152,6 +155,25 @@ RunXkbComp(xkbcomp_buffer_callback callback, void *userdata)
xkm_output_dir, keymap) == -1)
buf = NULL;
+ char buf2[256];
+ char buf3[256];
+ sprintf(buf2, "-R%s", XkbBaseDirectory);
+ sprintf(buf3, "%s%s.xkm", xkm_output_dir, keymap);
+ xkbcomp_argv[0] = "xkbcomp";
+ xkbcomp_argv[1] = "-w";
+ xkbcomp_argv[2] = "1";
+ xkbcomp_argv[3] = buf2;
+ xkbcomp_argv[4] = "-xkm";
+ xkbcomp_argv[5] = (char*) xkmfile;
+ xkbcomp_argv[6] = "-em1";
+ xkbcomp_argv[7] = PRE_ERROR_MSG;
+ xkbcomp_argv[8] = "-emp";
+ xkbcomp_argv[9] = ERROR_PREFIX;
+ xkbcomp_argv[10] = "-eml";
+ xkbcomp_argv[11] = POST_ERROR_MSG1;
+ xkbcomp_argv[12] = buf3;
+ xkbcomp_argc = 13;
+
free(xkbbasedirflag);
if (!buf) {