mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Revert 9a82f5c, bring back Cygwin support.
Brought back the code removed in that commit so that we can bring back Cygwin support. Small changes are done in the process of resolving conflicts against the current head. Some checks have not been reverted, because they were not necessary anymore. Signed-off-by: b-aaz <b-aazbsd@proton.me>
This commit is contained in:
@@ -160,7 +160,7 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||
|
||||
static Bool badSysCall = FALSE;
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef CONFIG_MITSHM
|
||||
# if defined(__CYGWIN__)
|
||||
# include <sys/param.h>
|
||||
# include <sys/sysmacros.h>
|
||||
# endif
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
@@ -88,7 +92,7 @@ static unsigned int pagesize;
|
||||
|
||||
static Bool badSysCall = FALSE;
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||
|
||||
static void
|
||||
SigSysHandler(int signo)
|
||||
@@ -639,7 +643,7 @@ XFree86BigfontExtensionInit(void)
|
||||
|
||||
FontShmdescIndex = xfont2_allocate_font_private_index();
|
||||
|
||||
#if !defined(CSRG_BASED)
|
||||
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
|
||||
pagesize = SHMLBA;
|
||||
#else
|
||||
#ifdef _SC_PAGESIZE
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
#include "indirect_reqsize.h"
|
||||
#include "misc.h"
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#undef HAVE_ALIAS
|
||||
#endif
|
||||
#ifdef HAVE_ALIAS
|
||||
#define ALIAS2(from,to) \
|
||||
GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \
|
||||
|
||||
@@ -43,10 +43,6 @@
|
||||
#define FASTCALL
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__MINGW32__) || defined(GLX_USE_APPLEGL)
|
||||
#undef HAVE_ALIAS
|
||||
#endif
|
||||
#ifdef HAVE_ALIAS
|
||||
#define ALIAS2(from,to) \
|
||||
_X_INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \
|
||||
|
||||
@@ -122,6 +122,11 @@
|
||||
static ModuleDefault ModuleDefaults[] = {
|
||||
#ifdef GLXEXT
|
||||
{.name = "glx",.toLoad = TRUE,.load_opt = NULL},
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
/* load DIX modules used by drivers first */
|
||||
{.name = "fb",.toLoad = TRUE,.load_opt = NULL},
|
||||
{.name = "shadow",.toLoad = TRUE,.load_opt = NULL},
|
||||
#endif
|
||||
{.name = NULL,.toLoad = FALSE,.load_opt = NULL}
|
||||
};
|
||||
|
||||
@@ -279,9 +279,15 @@ static const char *stdSubdirs[] = {
|
||||
* to port this DDX to, say, Darwin, we'll need to fix this.
|
||||
*/
|
||||
static PatternRec stdPatterns[] = {
|
||||
#ifdef __CYGWIN__
|
||||
{"^cyg(.*)\\.dll$",},
|
||||
{"(.*)_drv\\.dll$",},
|
||||
{"(.*)\\.dll$",},
|
||||
#else
|
||||
{"^lib(.*)\\.so$",},
|
||||
{"(.*)_drv\\.so$",},
|
||||
{"(.*)\\.so$",},
|
||||
#endif
|
||||
{NULL,}
|
||||
};
|
||||
|
||||
@@ -370,21 +376,33 @@ FindModuleInSubdir(const char *dirpath, const char *module)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
snprintf(tmpBuf, PATH_MAX, "cyg%s.dll", module);
|
||||
#else
|
||||
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
|
||||
#endif
|
||||
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
||||
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
|
||||
ret = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
snprintf(tmpBuf, PATH_MAX, "%s_drv.dll", module);
|
||||
#else
|
||||
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
|
||||
#endif
|
||||
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
||||
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
|
||||
ret = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
snprintf(tmpBuf, PATH_MAX, "%s.dll", module);
|
||||
#else
|
||||
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
|
||||
#endif
|
||||
if (strcmp(direntry->d_name, tmpBuf) == 0) {
|
||||
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
|
||||
ret = NULL;
|
||||
|
||||
@@ -80,7 +80,7 @@ if build_dri2
|
||||
xorg_link += xorg_dri2
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
|
||||
linker_export_flags = '-Wl,--export-all-symbols'
|
||||
elif host_machine.system() == 'sunos' or host_machine.system() == 'darwin'
|
||||
linker_export_flags = []
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
/**************************************************************************/
|
||||
/* Linux or Glibc-based system */
|
||||
/**************************************************************************/
|
||||
#if defined(__linux__) || defined(__GLIBC__)
|
||||
#if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__)
|
||||
#include <sys/ioctl.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -75,6 +75,18 @@ DDXRingBell(int volume, int pitch, int duration)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
static void
|
||||
xwinDevWindowsHandlerNotify(int fd, int ready, void *data)
|
||||
{
|
||||
/* This should process Windows messages, but instead all of that is delayed
|
||||
* until the wakeup handler is called.
|
||||
*/
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* See Porting Layer Definition - p. 17 */
|
||||
void
|
||||
InitInput(int argc, char *argv[])
|
||||
|
||||
@@ -48,6 +48,9 @@ from The Open Group.
|
||||
#ifdef DPMSExtension
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
#ifdef RELOCATE_PROJECTROOT
|
||||
#pragma push_macro("Status")
|
||||
#undef Status
|
||||
@@ -207,6 +210,17 @@ ddxGiveUp(enum ExitCode error)
|
||||
/* Notify the worker threads we're exiting */
|
||||
winDeinitMultiWindowWM();
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
/* Close our handle to our message queue */
|
||||
if (g_fdMessageQueue != WIN_FD_INVALID) {
|
||||
/* Close /dev/windows */
|
||||
close(g_fdMessageQueue);
|
||||
|
||||
/* Set the file handle to invalid */
|
||||
g_fdMessageQueue = WIN_FD_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!g_fLogInited) {
|
||||
g_pszLogFile = LogInit(g_pszLogFile, ".old");
|
||||
g_fLogInited = TRUE;
|
||||
@@ -243,6 +257,95 @@ ddxGiveUp(enum ExitCode error)
|
||||
winDebug("ddxGiveUp - End\n");
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
/* hasmntopt is currently not implemented for cygwin */
|
||||
static const char *
|
||||
winCheckMntOpt(const struct mntent *mnt, const char *opt)
|
||||
{
|
||||
const char *s;
|
||||
size_t len;
|
||||
|
||||
if (mnt == NULL)
|
||||
return NULL;
|
||||
if (opt == NULL)
|
||||
return NULL;
|
||||
if (mnt->mnt_opts == NULL)
|
||||
return NULL;
|
||||
|
||||
len = strlen(opt);
|
||||
s = strstr(mnt->mnt_opts, opt);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
if ((s == mnt->mnt_opts || *(s - 1) == ',') &&
|
||||
(s[len] == 0 || s[len] == ','))
|
||||
return (char *) opt;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
winCheckMount(void)
|
||||
{
|
||||
FILE *mnt;
|
||||
struct mntent *ent;
|
||||
|
||||
enum { none = 0, sys_root, user_root, sys_tmp, user_tmp }
|
||||
level = none, curlevel;
|
||||
BOOL binary = TRUE;
|
||||
|
||||
mnt = setmntent("/etc/mtab", "r");
|
||||
if (mnt == NULL) {
|
||||
ErrorF("setmntent failed");
|
||||
return;
|
||||
}
|
||||
|
||||
while ((ent = getmntent(mnt)) != NULL) {
|
||||
BOOL sys = (winCheckMntOpt(ent, "user") != NULL);
|
||||
BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
|
||||
BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
|
||||
|
||||
if (sys) {
|
||||
if (root)
|
||||
curlevel = sys_root;
|
||||
else if (tmp)
|
||||
curlevel = sys_tmp;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (root)
|
||||
curlevel = user_root;
|
||||
else if (tmp)
|
||||
curlevel = user_tmp;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
if (curlevel <= level)
|
||||
continue;
|
||||
level = curlevel;
|
||||
|
||||
if ((winCheckMntOpt(ent, "binary") == NULL) &&
|
||||
(winCheckMntOpt(ent, "binmode") == NULL))
|
||||
binary = FALSE;
|
||||
else
|
||||
binary = TRUE;
|
||||
}
|
||||
|
||||
if (endmntent(mnt) != 1) {
|
||||
ErrorF("endmntent failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!binary)
|
||||
winMsg(X_WARNING, "/tmp mounted in textmode\n");
|
||||
}
|
||||
#else
|
||||
static void
|
||||
winCheckMount(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RELOCATE_PROJECTROOT
|
||||
const char *
|
||||
winGetBaseDir(void)
|
||||
@@ -539,6 +642,8 @@ OsVendorInit(void)
|
||||
if (serverGeneration == 1)
|
||||
winLogVersionInfo();
|
||||
|
||||
winCheckMount();
|
||||
|
||||
/* Add a default screen if no screens were specified */
|
||||
if (g_iNumScreens == 0) {
|
||||
winDebug("OsVendorInit - Creating default screen 0\n");
|
||||
|
||||
@@ -7,8 +7,12 @@ build_windowsdri = windowsdri_dep.found()
|
||||
xwin_sys_libs = []
|
||||
xwin_sys_libs += '-ldxguid'
|
||||
|
||||
server_name = 'Xming'
|
||||
xwin_sys_libs += ['-lpthread', '-lws2_32']
|
||||
if host_machine.system() == 'cygwin'
|
||||
server_name = 'XWin'
|
||||
else
|
||||
server_name = 'Xming'
|
||||
xwin_sys_libs += ['-lpthread', '-lws2_32']
|
||||
endif
|
||||
|
||||
xwin_c_args = []
|
||||
xwin_c_args += '-DHAVE_XWIN_CONFIG_H'
|
||||
|
||||
@@ -520,6 +520,9 @@ extern winScreenInfo *g_ScreenInfo;
|
||||
extern miPointerScreenFuncRec g_winPointerCursorFuncs;
|
||||
extern DWORD g_dwEvents;
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
extern int g_fdMessageQueue;
|
||||
#endif
|
||||
extern DevPrivateKeyRec g_iScreenPrivateKeyRec;
|
||||
|
||||
#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec)
|
||||
|
||||
@@ -43,6 +43,7 @@ winBlockHandler(ScreenPtr pScreen, void *pTimeout)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
|
||||
#ifndef HAS_DEVWINDOWS
|
||||
struct timeval **tvp = pTimeout;
|
||||
|
||||
if (*tvp != NULL) {
|
||||
@@ -62,6 +63,7 @@ winBlockHandler(ScreenPtr pScreen, void *pTimeout)
|
||||
(*tvp)->tv_usec = 100;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Signal threaded modules to begin */
|
||||
if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) {
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
|
||||
#define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip"
|
||||
#define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip"
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
@@ -107,7 +110,11 @@ winClipboardProc(char *szDisplay, xcb_auth_info_t *auth_info)
|
||||
int iReturn;
|
||||
HWND hwnd = NULL;
|
||||
int iConnectionNumber = 0;
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
int fdMessageQueue = 0;
|
||||
#else
|
||||
struct timeval tvTimeout;
|
||||
#endif
|
||||
fd_set fdsRead;
|
||||
int iMaxDescriptor;
|
||||
xcb_connection_t *conn;
|
||||
@@ -132,7 +139,19 @@ winClipboardProc(char *szDisplay, xcb_auth_info_t *auth_info)
|
||||
/* Get our connection number */
|
||||
iConnectionNumber = xcb_get_file_descriptor(conn);
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
/* Open a file descriptor for the windows message queue */
|
||||
fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY);
|
||||
if (fdMessageQueue == -1) {
|
||||
ErrorF("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
|
||||
goto winClipboardProc_Done;
|
||||
}
|
||||
|
||||
/* Find max of our file descriptors */
|
||||
iMaxDescriptor = MAX(fdMessageQueue, iConnectionNumber) + 1;
|
||||
#else
|
||||
iMaxDescriptor = iConnectionNumber + 1;
|
||||
#endif
|
||||
|
||||
const xcb_query_extension_reply_t *xfixes_query;
|
||||
xfixes_query = xcb_get_extension_data(conn, &xcb_xfixes_id);
|
||||
@@ -253,15 +272,23 @@ winClipboardProc(char *szDisplay, xcb_auth_info_t *auth_info)
|
||||
*/
|
||||
FD_ZERO(&fdsRead);
|
||||
FD_SET(iConnectionNumber, &fdsRead);
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
FD_SET(fdMessageQueue, &fdsRead);
|
||||
#else
|
||||
tvTimeout.tv_sec = 0;
|
||||
tvTimeout.tv_usec = 100;
|
||||
#endif
|
||||
|
||||
/* Wait for a Windows event or an X event */
|
||||
iReturn = select(iMaxDescriptor, /* Highest fds number */
|
||||
&fdsRead, /* Read mask */
|
||||
NULL, /* No write mask */
|
||||
NULL, /* No exception mask */
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
NULL /* No timeout */
|
||||
#else
|
||||
&tvTimeout /* Set timeout */
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifndef HAS_WINSOCK
|
||||
@@ -287,6 +314,24 @@ winClipboardProc(char *szDisplay, xcb_auth_info_t *auth_info)
|
||||
winDebug
|
||||
("winClipboardProc - X connection ready, pumping X event queue\n");
|
||||
}
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
/* Check for Windows event ready */
|
||||
if (FD_ISSET(fdMessageQueue, &fdsRead))
|
||||
#else
|
||||
if (1)
|
||||
#endif
|
||||
{
|
||||
winDebug
|
||||
("winClipboardProc - /dev/windows ready, pumping Windows message queue\n");
|
||||
}
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
if (!(FD_ISSET(iConnectionNumber, &fdsRead)) &&
|
||||
!(FD_ISSET(fdMessageQueue, &fdsRead))) {
|
||||
winDebug("winClipboardProc - Spurious wake, select() returned %d\n", iReturn);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* broke out of while loop on a shutdown message */
|
||||
@@ -308,6 +353,12 @@ winClipboardProc(char *szDisplay, xcb_auth_info_t *auth_info)
|
||||
free(error);
|
||||
}
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
/* Close our Win32 message handle */
|
||||
if (fdMessageQueue)
|
||||
close(fdMessageQueue);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xcb_disconnect() does not sync, so is safe to call even when we are built
|
||||
* into the server. Unlike XCloseDisplay() there will be no deadlock if the
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
int g_iNumScreens = 0;
|
||||
winScreenInfo *g_ScreenInfo = 0;
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
int g_fdMessageQueue = WIN_FD_INVALID;
|
||||
#endif
|
||||
DevPrivateKeyRec g_iScreenPrivateKeyRec;
|
||||
DevPrivateKeyRec g_iCmapPrivateKeyRec;
|
||||
DevPrivateKeyRec g_iGCPrivateKeyRec;
|
||||
|
||||
@@ -471,6 +471,12 @@ winKeybdReleaseKeys(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
/* Verify that the mi input system has been initialized */
|
||||
if (g_fdMessageQueue == WIN_FD_INVALID)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Loop through all keys */
|
||||
for (i = 0; i < NUM_KEYCODES; ++i) {
|
||||
/* Pop key if pressed */
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __CYGWIN__
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <setjmp.h>
|
||||
#define HANDLE void *
|
||||
@@ -84,6 +87,9 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
|
||||
|
||||
#define WIN_CONNECT_RETRIES 5
|
||||
#define WIN_CONNECT_DELAY 5
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local structures
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __CYGWIN__
|
||||
#include <sys/resource.h>
|
||||
#include <sys/cygwin.h>
|
||||
#endif
|
||||
#include "win.h"
|
||||
|
||||
#include <X11/Xwindows.h>
|
||||
@@ -309,6 +313,28 @@ HandleCustomWM_COMMAND(HWND hwnd, WORD command, winPrivScreenPtr pScreenPriv)
|
||||
if (command == m->menuItem[j].commandID) {
|
||||
/* Match! */
|
||||
switch (m->menuItem[j].cmd) {
|
||||
#ifdef __CYGWIN__
|
||||
case CMD_EXEC:
|
||||
if (fork() == 0) {
|
||||
struct rlimit rl;
|
||||
int fd;
|
||||
|
||||
/* Close any open descriptors except for STD* */
|
||||
getrlimit(RLIMIT_NOFILE, &rl);
|
||||
for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++)
|
||||
close(fd);
|
||||
|
||||
/* Disassociate any TTYs */
|
||||
setsid();
|
||||
|
||||
execl("/bin/sh",
|
||||
"/bin/sh", "-c", m->menuItem[j].param, NULL);
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
#else
|
||||
case CMD_EXEC:
|
||||
{
|
||||
/* Start process without console window */
|
||||
@@ -334,6 +360,7 @@ HandleCustomWM_COMMAND(HWND hwnd, WORD command, winPrivScreenPtr pScreenPriv)
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
return TRUE;
|
||||
#endif
|
||||
case CMD_ALWAYSONTOP:
|
||||
if (!hwnd)
|
||||
return FALSE;
|
||||
@@ -515,6 +542,9 @@ LoadImageComma(char *fname, char *iconDirectory, int sx, int sy, int flags)
|
||||
}
|
||||
else {
|
||||
char *file = calloc(1, PATH_MAX + NAME_MAX + 2);
|
||||
#ifdef __CYGWIN__
|
||||
Bool convert = FALSE;
|
||||
#endif
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
@@ -523,6 +553,14 @@ LoadImageComma(char *fname, char *iconDirectory, int sx, int sy, int flags)
|
||||
|
||||
/* If fname starts 'X:\', it's an absolute Windows path, do nothing */
|
||||
if (!(fname[0] && fname[1] == ':' && fname[2] == '\\')) {
|
||||
#ifdef __CYGWIN__
|
||||
/* If fname starts with '/', it's an absolute cygwin path, we'll
|
||||
need to convert it */
|
||||
if (fname[0] == '/') {
|
||||
convert = TRUE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (iconDirectory) {
|
||||
/* Otherwise, prepend the default icon directory, which
|
||||
currently must be in absolute Windows path form */
|
||||
@@ -543,6 +581,17 @@ LoadImageComma(char *fname, char *iconDirectory, int sx, int sy, int flags)
|
||||
i = -1;
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
/* Convert from Cygwin path to Windows path */
|
||||
if (convert) {
|
||||
char *converted_file = cygwin_create_path(CCP_POSIX_TO_WIN_A | CCP_ABSOLUTE, file);
|
||||
if (converted_file) {
|
||||
free(file);
|
||||
file = converted_file;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (i >= 0) {
|
||||
/* Specified as <fname>,<index> */
|
||||
hicon = ExtractIcon(g_hInstance, file, i);
|
||||
@@ -616,7 +665,23 @@ winIconIsOverride(HICON hicon)
|
||||
static int
|
||||
winPrefsLoadPreferences(const char *path)
|
||||
{
|
||||
FILE *prefFile = fopen(path, "r");
|
||||
FILE *prefFile = NULL;
|
||||
|
||||
if (path)
|
||||
prefFile = fopen(path, "r");
|
||||
#ifdef __CYGWIN__
|
||||
else {
|
||||
char defaultPrefs[] =
|
||||
"MENU rmenu {\n"
|
||||
" \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n"
|
||||
" \"Launch xterm\" EXEC xterm\n"
|
||||
" \"Load .XWinrc\" RELOAD\n"
|
||||
" SEPARATOR\n" "}\n" "\n" "ROOTMENU rmenu\n";
|
||||
|
||||
path = "built-in default";
|
||||
prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!prefFile) {
|
||||
ErrorF("LoadPreferences: %s not found\n", path);
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
#define WINDOW_CLASS_X_MSG "cygwin/x X msg"
|
||||
#define WINDOW_TITLE_X PROJECT_NAME " X"
|
||||
#define WIN_WINDOW_PROP "cyg_window_prop_rl"
|
||||
#ifdef HAS_DEVWINDOWS
|
||||
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
|
||||
#endif
|
||||
#define WIN_WID_PROP "cyg_wid_prop_rl"
|
||||
#define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl"
|
||||
|
||||
|
||||
@@ -395,6 +395,8 @@ xwin_data = configuration_data()
|
||||
xwin_data.set_quoted('DEFAULT_LOGDIR', log_dir)
|
||||
xwin_data.set('HAS_WINSOCK', host_machine.system() == 'windows' ? '1' : false,
|
||||
description: 'Use Windows sockets')
|
||||
xwin_data.set('HAS_DEVWINDOWS', host_machine.system() == 'cygwin' ? '1' : false,
|
||||
description: 'Has /dev/windows for signaling new win32 messages')
|
||||
xwin_data.set('RELOCATE_PROJECTROOT', host_machine.system() == 'windows' ? '1' : false,
|
||||
description: 'Make paths relative to the xserver installation location')
|
||||
xwin_data.set10('ENABLE_DEBUG', enable_debugging)
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
/* Winsock networking */
|
||||
#mesondefine HAS_WINSOCK
|
||||
|
||||
/* Cygwin has /dev/windows for signaling new win32 messages */
|
||||
#mesondefine HAS_DEVWINDOWS
|
||||
|
||||
/* Switch on debug messages */
|
||||
#mesondefine ENABLE_DEBUG
|
||||
|
||||
|
||||
@@ -254,7 +254,8 @@ build_xnest = get_option('xnest') != 'false'
|
||||
|
||||
build_xwin = false
|
||||
if get_option('xwin') == 'auto'
|
||||
if host_machine.system() == 'windows'
|
||||
if (host_machine.system() == 'cygwin' or
|
||||
host_machine.system() == 'windows')
|
||||
build_xwin = true
|
||||
endif
|
||||
else
|
||||
@@ -536,7 +537,8 @@ build_modesetting = libdrm_dep.found() and dri2proto_dep.found()
|
||||
build_vgahw = false
|
||||
if get_option('vgahw') == 'auto'
|
||||
if (host_machine.system() != 'darwin' and
|
||||
host_machine.system() != 'windows')
|
||||
host_machine.system() != 'windows' and
|
||||
host_machine.system() != 'cygwin')
|
||||
build_vgahw = true
|
||||
endif
|
||||
else
|
||||
@@ -878,7 +880,8 @@ if build_xorg
|
||||
|
||||
# On Windows, modules built with the SDK will need to link with server and
|
||||
# module implibs to resolve symbols
|
||||
if host_machine.system() == 'windows'
|
||||
if (host_machine.system() == 'cygwin' or
|
||||
host_machine.system() == 'windows')
|
||||
sdkconfig.set('XORG_DRIVER_LIBS', '-lXorg.exe -L\${moduledir} -lshadow -no-undefined')
|
||||
endif
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ SOFTWARE.
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
@@ -1073,7 +1073,7 @@ ComputeLocalClient(ClientPtr client)
|
||||
*/
|
||||
char *tok = strtok(cmd, ":");
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
ret = strcmp(basename(tok), "ssh") != 0;
|
||||
#else
|
||||
ret = strcmp(tok, "ssh") != 0;
|
||||
|
||||
@@ -103,9 +103,10 @@ _X_EXPORT Bool TimerForce(OsTimerPtr);
|
||||
|
||||
#ifdef WIN32
|
||||
#include <X11/Xwinsock.h>
|
||||
#include <signal.h>
|
||||
|
||||
#if ! defined(__CYGWIN__)
|
||||
typedef _sigset_t sigset_t;
|
||||
#endif
|
||||
|
||||
#undef CreateWindow
|
||||
|
||||
|
||||
10
os/osinit.c
10
os/osinit.c
@@ -94,7 +94,7 @@ OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
|
||||
* OsSigHandler --
|
||||
* Catch unexpected signals and exit or continue cleanly.
|
||||
*/
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
static void
|
||||
#ifdef SA_SIGINFO
|
||||
OsSigHandler(int signo, siginfo_t * sip, void *unused)
|
||||
@@ -144,7 +144,7 @@ OsSigHandler(int signo)
|
||||
FatalError("Caught signal %d (%s). Server aborting\n",
|
||||
signo, strsignal(signo));
|
||||
}
|
||||
#endif /* !WIN32 */
|
||||
#endif /* !WIN32 || __CYGWIN__ */
|
||||
|
||||
void
|
||||
OsInit(void)
|
||||
@@ -152,7 +152,7 @@ OsInit(void)
|
||||
static Bool been_here = FALSE;
|
||||
|
||||
if (!been_here) {
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
struct sigaction act, oact;
|
||||
int i;
|
||||
|
||||
@@ -180,7 +180,7 @@ OsInit(void)
|
||||
siglist[i], strerror(errno));
|
||||
}
|
||||
}
|
||||
#endif /* !WIN32 */
|
||||
#endif /* !WIN32 || __CYGWIN__ */
|
||||
busfault_init();
|
||||
server_poll = ospoll_create();
|
||||
if (!server_poll)
|
||||
@@ -210,7 +210,7 @@ OsInit(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
if (getpgrp() == 0)
|
||||
setpgid(0, 0);
|
||||
#endif
|
||||
|
||||
22
os/utils.c
22
os/utils.c
@@ -50,7 +50,17 @@ OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include <dix-config.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#ifdef __CYGWIN__
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
/*
|
||||
Sigh... We really need a prototype for this to know it is stdcall,
|
||||
but #include-ing <windows.h> here is not a good idea...
|
||||
*/
|
||||
__stdcall unsigned long GetTickCount(void);
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#include <X11/Xwinsock.h>
|
||||
#endif
|
||||
#include <X11/Xos.h>
|
||||
@@ -141,7 +151,7 @@ static clockid_t clockid;
|
||||
OsSigHandlerPtr
|
||||
OsSignal(int sig, OsSigHandlerPtr handler)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
return signal(sig, handler);
|
||||
#else
|
||||
struct sigaction act, oact;
|
||||
@@ -187,7 +197,7 @@ ForceClockId(clockid_t forced_clockid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined WIN32 && defined __MINGW32__)
|
||||
#if (defined WIN32 && defined __MINGW32__) || defined(__CYGWIN__)
|
||||
CARD32
|
||||
GetTimeInMillis(void)
|
||||
{
|
||||
@@ -555,7 +565,7 @@ ProcessCommandLine(int argc, char *argv[])
|
||||
}
|
||||
#ifdef LOCK_SERVER
|
||||
else if (strcmp(argv[i], "-nolock") == 0) {
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) && !defined(__CYGWIN__)
|
||||
if (getuid() != 0)
|
||||
ErrorF
|
||||
("Warning: the -nolock option can only be used by root\n");
|
||||
@@ -990,7 +1000,7 @@ OsAbort(void)
|
||||
#ifndef __APPLE__
|
||||
OsBlockSignals();
|
||||
#endif
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
/* abort() raises SIGABRT, so we have to stop handling that to prevent
|
||||
* recursion
|
||||
*/
|
||||
@@ -1430,7 +1440,7 @@ CheckUserAuthorization(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
/* Move a file descriptor out of the way of our select mask; this
|
||||
* is useful for file descriptors which will never appear in the
|
||||
* select mask to avoid reducing the number of clients that can
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
#include <assert.h> /* assertion macros */
|
||||
#include <string.h> /* string functions */
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#include <X11/Xwinsock.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -738,7 +738,7 @@ XkbProcessArguments(int argc, char *argv[], int i)
|
||||
{
|
||||
if (strncmp(argv[i], "-xkbdir", 7) == 0) {
|
||||
if (++i < argc) {
|
||||
#if !defined(WIN32)
|
||||
#if !defined(WIN32) && !defined(__CYGWIN__)
|
||||
if (getuid() != geteuid()) {
|
||||
LogMessage(X_WARNING,
|
||||
"-xkbdir is not available for setuid X servers\n");
|
||||
|
||||
Reference in New Issue
Block a user