Commit 8f480147 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer
Browse files

Drop Xwin DDX

parent 69cc6a6c
......@@ -72,7 +72,7 @@ cache:
- '%CYGWIN_ROOT%\home\%USERNAME%\.ccache'
build_script:
- SET PATH=%CYGWIN_ROOT%/bin
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dhal=false -Dudev=false -Dpciaccess=false -Dint10=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxvfb=true -Dxorg=true -Dhal=false -Dudev=false -Dpciaccess=false -Dint10=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson configure build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ccache -s"'
......
......@@ -13,7 +13,3 @@ endif
if build_xwayland
subdir('xwayland')
endif
if build_xwin
subdir('xwin')
endif
winprefslex.c
winprefsyacc.c
winprefsyacc.h
/*
Copyright 1993, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include "win.h"
#include "dixstruct.h"
#include "inputstr.h"
/*
* Local function prototypes
*/
int winProcEstablishConnection(ClientPtr /* client */ );
/*
* Local global declarations
*/
DeviceIntPtr g_pwinPointer;
DeviceIntPtr g_pwinKeyboard;
/* Called from dix/dispatch.c */
/*
* Run through the Windows message queue(s) one more time.
* Tell mi to dequeue the events that we have sent it.
*/
void
ProcessInputEvents(void)
{
#if 0
ErrorF("ProcessInputEvents\n");
#endif
mieqProcessInputEvents();
#if 0
ErrorF("ProcessInputEvents - returning\n");
#endif
}
void
DDXRingBell(int volume, int pitch, int duration)
{
/* winKeybdBell is used instead */
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[])
{
#if CYGDEBUG
winDebug("InitInput\n");
#endif
/*
* Wrap some functions at every generation of the server.
*/
if (InitialVector[2] != winProcEstablishConnection) {
winProcEstablishConnectionOrig = InitialVector[2];
InitialVector[2] = winProcEstablishConnection;
}
if (AllocDevicePair(serverClient, "Windows",
&g_pwinPointer, &g_pwinKeyboard,
winMouseProc, winKeybdProc,
FALSE) != Success)
FatalError("InitInput - Failed to allocate slave devices.\n");
mieqInit();
/* Initialize the mode key states */
winInitializeModeKeyStates();
#ifdef HAS_DEVWINDOWS
/* Only open the windows message queue device once */
if (g_fdMessageQueue == WIN_FD_INVALID) {
/* Open a file descriptor for the Windows message queue */
g_fdMessageQueue = open(WIN_MSG_QUEUE_FNAME, O_RDONLY);
if (g_fdMessageQueue == -1) {
FatalError("InitInput - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
}
/* Add the message queue as a device to wait for in WaitForSomething */
SetNotifyFd(g_fdMessageQueue, xwinDevWindowsHandlerNotify, X_NOTIFY_READ, NULL);
}
#endif
#if CYGDEBUG
winDebug("InitInput - returning\n");
#endif
}
void
CloseInput(void)
{
mieqFini();
}
/*
Copyright 1993, 1998 The Open Group
Copyright (C) Colin Harrison 2005-2008
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include "win.h"
#include "winmsg.h"
#include "winconfig.h"
#include "winprefs.h"
#ifdef DPMSExtension
#include "dpmsproc.h"
#endif
#ifdef __CYGWIN__
#include <mntent.h>
#endif
#if defined(WIN32)
#include "xkbsrv.h"
#endif
#ifdef RELOCATE_PROJECTROOT
#pragma push_macro("Status")
#undef Status
#define Status wStatus
#include <shlobj.h>
#pragma pop_macro("Status")
typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags, LPTSTR pszPath);
#endif
#include "winmonitors.h"
#include "nonsdk_extinit.h"
#include "pseudoramiX/pseudoramiX.h"
#include "glx_extinit.h"
#ifdef XWIN_GLX_WINDOWS
#include "glx/glwindows.h"
#include "dri/windowsdri.h"
#endif
#include "winauth.h"
/*
* References to external symbols
*/
/*
* Function prototypes
*/
void
winLogCommandLine(int argc, char *argv[]);
void
winLogVersionInfo(void);
Bool
winValidateArgs(void);
#ifdef RELOCATE_PROJECTROOT
const char *winGetBaseDir(void);
#endif
/*
* For the depth 24 pixmap we default to 32 bits per pixel, but
* we change this pixmap format later if we detect that the display
* is going to be running at 24 bits per pixel.
*
* FIXME: On second thought, don't DIBs only support 32 bits per pixel?
* DIBs are the underlying bitmap used for DirectDraw surfaces, so it
* seems that all pixmap formats with depth 24 would be 32 bits per pixel.
* Confirm whether depth 24 DIBs can have 24 bits per pixel, then remove/keep
* the bits per pixel adjustment and update this comment to reflect the
* situation. Harold Hunt - 2002/07/02
*/
static PixmapFormatRec g_PixmapFormats[] = {
{1, 1, BITMAP_SCANLINE_PAD},
{4, 8, BITMAP_SCANLINE_PAD},
{8, 8, BITMAP_SCANLINE_PAD},
{15, 16, BITMAP_SCANLINE_PAD},
{16, 16, BITMAP_SCANLINE_PAD},
{24, 32, BITMAP_SCANLINE_PAD},
{32, 32, BITMAP_SCANLINE_PAD}
};
static Bool noDriExtension;
static const ExtensionModule xwinExtensions[] = {
#ifdef GLXEXT
#ifdef XWIN_WINDOWS_DRI
{ WindowsDRIExtensionInit, "Windows-DRI", &noDriExtension },
#endif
#endif
};
/*
* XwinExtensionInit
* Initialises Xwin-specific extensions.
*/
static
void XwinExtensionInit(void)
{
#ifdef XWIN_GLX_WINDOWS
if (g_fNativeGl) {
/* install the native GL provider */
glxWinPushNativeProvider();
}
#endif
LoadExtensionList(xwinExtensions, ARRAY_SIZE(xwinExtensions), TRUE);
}
#if defined(DDXBEFORERESET)
/*
* Called right before KillAllClients when the server is going to reset,
* allows us to shutdown our separate threads cleanly.
*/
void
ddxBeforeReset(void)
{
winDebug("ddxBeforeReset - Hello\n");
winClipboardShutdown();
}
#endif
#if INPUTTHREAD
/** This function is called in Xserver/os/inputthread.c when starting
the input thread. */
void
ddxInputThreadInit(void)
{
}
#endif
int
main(int argc, char *argv[], char *envp[])
{
int iReturn;
/* Create & acquire the termination mutex */
iReturn = pthread_mutex_init(&g_pmTerminating, NULL);
if (iReturn != 0) {
ErrorF("ddxMain - pthread_mutex_init () failed: %d\n", iReturn);
}
iReturn = pthread_mutex_lock(&g_pmTerminating);
if (iReturn != 0) {
ErrorF("ddxMain - pthread_mutex_lock () failed: %d\n", iReturn);
}
return dix_main(argc, argv, envp);
}
/* See Porting Layer Definition - p. 57 */
void
ddxGiveUp(enum ExitCode error)
{
int i;
#if CYGDEBUG
winDebug("ddxGiveUp\n");
#endif
/* Perform per-screen deinitialization */
for (i = 0; i < g_iNumScreens; ++i) {
/* Delete the tray icon */
if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen)
winDeleteNotifyIcon(winGetScreenPriv(g_ScreenInfo[i].pScreen));
}
/* Unload libraries for taskbar grouping */
winPropertyStoreDestroy();
/* 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;
}
LogClose(error);
/*
* At this point we aren't creating any new screens, so
* we are guaranteed to not need the DirectDraw functions.
*/
winReleaseDDProcAddresses();
/* Free concatenated command line */
free(g_pszCommandLine);
g_pszCommandLine = NULL;
/* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL();
/* Tell Windows that we want to end the app */
PostQuitMessage(0);
{
int iReturn = pthread_mutex_unlock(&g_pmTerminating);
winDebug("ddxGiveUp - Releasing termination mutex\n");
if (iReturn != 0) {
ErrorF("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n",
iReturn);
}
}
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)
{
static BOOL inited = FALSE;
static char buffer[MAX_PATH];
if (!inited) {
char *fendptr;
HMODULE module = GetModuleHandle(NULL);
DWORD size = GetModuleFileName(module, buffer, sizeof(buffer));
if (sizeof(buffer) > 0)
buffer[sizeof(buffer) - 1] = 0;
fendptr = buffer + size;
while (fendptr > buffer) {
if (*fendptr == '\\' || *fendptr == '/') {
*fendptr = 0;
break;
}
fendptr--;
}
inited = TRUE;
}
return buffer;
}
#endif
static void
winFixupPaths(void)
{
BOOL changed_fontpath = FALSE;
MessageType font_from = X_DEFAULT;
#ifdef RELOCATE_PROJECTROOT
const char *basedir = winGetBaseDir();
size_t basedirlen = strlen(basedir);
#endif
#ifdef READ_FONTDIRS
{
/* Open fontpath configuration file */
FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt");
if (fontdirs != NULL) {
char buffer[256];
int needs_sep = TRUE;
int comment_block = FALSE;
/* get default fontpath */
char *fontpath = strdup(defaultFontPath);
size_t size = strlen(fontpath);
/* read all lines */
while (!feof(fontdirs)) {
size_t blen;
char *hashchar;
char *str;
int has_eol = FALSE;
/* read one line */
str = fgets(buffer, sizeof(buffer), fontdirs);
if (str == NULL) /* stop on error or eof */
break;
if (strchr(str, '\n') != NULL)
has_eol = TRUE;
/* check if block is continued comment */
if (comment_block) {
/* ignore all input */
*str = 0;
blen = 0;
if (has_eol) /* check if line ended in this block */
comment_block = FALSE;
}
else {
/* find comment character. ignore all trailing input */
hashchar = strchr(str, '#');
if (hashchar != NULL) {
*hashchar = 0;
if (!has_eol) /* mark next block as continued comment */
comment_block = TRUE;
}
}
/* strip whitespaces from beginning */
while (*str == ' ' || *str == '\t')
str++;
/* get size, strip whitespaces from end */
blen = strlen(str);
while (blen > 0 && (str[blen - 1] == ' ' ||
str[blen - 1] == '\t' ||
str[blen - 1] == '\n')) {
str[--blen] = 0;
}
/* still something left to add? */
if (blen > 0) {
size_t newsize = size + blen;
/* reserve one character more for ',' */
if (needs_sep)
newsize++;
/* allocate memory */
if (fontpath == NULL)
fontpath = malloc(newsize + 1);
else
fontpath = realloc(fontpath, newsize + 1);
/* add separator */
if (needs_sep) {
fontpath[size] = ',';
size++;
needs_sep = FALSE;