Commit 69cc6a6c authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer
Browse files

Drop Xnest DDX

parent 6cae4b39
......@@ -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 -Dxnest=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 -Dxwin=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"'
......
......@@ -6,10 +6,6 @@ if get_option('xvfb')
subdir('vfb')
endif
if build_xnest
subdir('xnest')
endif
if build_xorg
subdir('xfree86')
endif
......
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifdef HAVE_XNEST_CONFIG_H
#include <xnest-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "screenint.h"
#include "input.h"
#include "misc.h"
#include "scrnintstr.h"
#include "servermd.h"
#include "Xnest.h"
#include "Display.h"
#include "Args.h"
char *xnestDisplayName = NULL;
Bool xnestSynchronize = False;
Bool xnestFullGeneration = False;
int xnestDefaultClass;
Bool xnestUserDefaultClass = False;
int xnestDefaultDepth;
Bool xnestUserDefaultDepth = False;
Bool xnestSoftwareScreenSaver = False;
int xnestX;
int xnestY;
unsigned int xnestWidth;
unsigned int xnestHeight;
int xnestUserGeometry = 0;
int xnestBorderWidth;
Bool xnestUserBorderWidth = False;
char *xnestWindowName = NULL;
int xnestNumScreens = 0;
Bool xnestDoDirectColormaps = False;
Window xnestParentWindow = 0;
int
ddxProcessArgument(int argc, char *argv[], int i)
{
if (!strcmp(argv[i], "-display")) {
if (++i < argc) {
xnestDisplayName = argv[i];
return 2;
}
return 0;
}
if (!strcmp(argv[i], "-sync")) {
xnestSynchronize = True;
return 1;
}
if (!strcmp(argv[i], "-full")) {
xnestFullGeneration = True;
return 1;
}
if (!strcmp(argv[i], "-class")) {
if (++i < argc) {
if (!strcmp(argv[i], "StaticGray")) {
xnestDefaultClass = StaticGray;
xnestUserDefaultClass = True;
return 2;
}
else if (!strcmp(argv[i], "GrayScale")) {
xnestDefaultClass = GrayScale;
xnestUserDefaultClass = True;
return 2;
}
else if (!strcmp(argv[i], "StaticColor")) {
xnestDefaultClass = StaticColor;
xnestUserDefaultClass = True;
return 2;
}
else if (!strcmp(argv[i], "PseudoColor")) {
xnestDefaultClass = PseudoColor;
xnestUserDefaultClass = True;
return 2;
}
else if (!strcmp(argv[i], "TrueColor")) {
xnestDefaultClass = TrueColor;
xnestUserDefaultClass = True;
return 2;
}
else if (!strcmp(argv[i], "DirectColor")) {
xnestDefaultClass = DirectColor;
xnestUserDefaultClass = True;
return 2;
}
}
return 0;
}
if (!strcmp(argv[i], "-cc")) {
if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultClass) == 1) {
if (xnestDefaultClass >= 0 && xnestDefaultClass <= 5) {
xnestUserDefaultClass = True;
/* lex the OS layer process it as well, so return 0 */
}
}
return 0;
}
if (!strcmp(argv[i], "-depth")) {
if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultDepth) == 1) {
if (xnestDefaultDepth > 0) {
xnestUserDefaultDepth = True;
return 2;
}
}
return 0;
}
if (!strcmp(argv[i], "-sss")) {
xnestSoftwareScreenSaver = True;
return 1;
}
if (!strcmp(argv[i], "-geometry")) {
if (++i < argc) {
xnestUserGeometry = XParseGeometry(argv[i],
&xnestX, &xnestY,
&xnestWidth, &xnestHeight);
if (xnestUserGeometry)
return 2;
}
return 0;
}
if (!strcmp(argv[i], "-bw")) {
if (++i < argc && sscanf(argv[i], "%i", &xnestBorderWidth) == 1) {
if (xnestBorderWidth >= 0) {
xnestUserBorderWidth = True;
return 2;
}
}
return 0;
}
if (!strcmp(argv[i], "-name")) {
if (++i < argc) {
xnestWindowName = argv[i];
return 2;
}
return 0;
}
if (!strcmp(argv[i], "-scrns")) {
if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
if (xnestNumScreens > 0) {
if (xnestNumScreens > MAXSCREENS) {
ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
xnestNumScreens = MAXSCREENS;
}
return 2;
}
}
return 0;
}
if (!strcmp(argv[i], "-install")) {
xnestDoDirectColormaps = True;
return 1;
}
if (!strcmp(argv[i], "-parent")) {
if (++i < argc) {
xnestParentWindow = (XID) strtol(argv[i], (char **) NULL, 0);
return 2;
}
}
return 0;
}
void
ddxUseMsg(void)
{
ErrorF("-display string display name of the real server\n");
ErrorF("-sync sinchronize with the real server\n");
ErrorF("-full utilize full regeneration\n");
ErrorF("-class string default visual class\n");
ErrorF("-depth int default depth\n");
ErrorF("-sss use software screen saver\n");
ErrorF("-geometry WxH+X+Y window size and position\n");
ErrorF("-bw int window border width\n");
ErrorF("-name string window name\n");
ErrorF("-scrns int number of screens to generate\n");
ErrorF("-install install colormaps directly\n");
}
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifndef XNESTARGS_H
#define XNESTARGS_H
extern char *xnestDisplayName;
extern Bool xnestSynchronize;
extern Bool xnestFullGeneration;
extern int xnestDefaultClass;
extern Bool xnestUserDefaultClass;
extern int xnestDefaultDepth;
extern Bool xnestUserDefaultDepth;
extern Bool xnestSoftwareScreenSaver;
extern int xnestX;
extern int xnestY;
extern unsigned int xnestWidth;
extern unsigned int xnestHeight;
extern int xnestUserGeometry;
extern int xnestBorderWidth;
extern Bool xnestUserBorderWidth;
extern char *xnestWindowName;
extern int xnestNumScreens;
extern Bool xnestDoDirectColormaps;
extern Window xnestParentWindow;
#endif /* XNESTARGS_H */
/*
Copyright 1993 by Davor Matic
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. Davor Matic makes no representations about
the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
#ifdef HAVE_XNEST_CONFIG_H
#include <xnest-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "scrnintstr.h"
#include "window.h"
#include "windowstr.h"
#include "colormapst.h"
#include "resource.h"
#include "Xnest.h"
#include "Display.h"
#include "Screen.h"
#include "Color.h"
#include "Visual.h"
#include "XNWindow.h"
#include "Args.h"
DevPrivateKeyRec xnestColormapPrivateKeyRec;
static DevPrivateKeyRec cmapScrPrivateKeyRec;
#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
Bool
xnestCreateColormap(ColormapPtr pCmap)
{
VisualPtr pVisual;
XColor *colors;
int i, ncolors;
Pixel red, green, blue;
Pixel redInc, greenInc, blueInc;
pVisual = pCmap->pVisual;
ncolors = pVisual->ColormapEntries;
xnestColormapPriv(pCmap)->colormap =
XCreateColormap(xnestDisplay,
xnestDefaultWindows[pCmap->pScreen->myNum],
xnestVisual(pVisual),
(pVisual->class & DynamicClass) ? AllocAll : AllocNone);
switch (pVisual->class) {
case StaticGray: /* read only */
colors = xallocarray(ncolors, sizeof(XColor));
for (i = 0; i < ncolors; i++)
colors[i].pixel = i;
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
for (i = 0; i < ncolors; i++) {
pCmap->red[i].co.local.red = colors[i].red;
pCmap->red[i].co.local.green = colors[i].red;
pCmap->red[i].co.local.blue = colors[i].red;
}
free(colors);
break;
case StaticColor: /* read only */
colors = xallocarray(ncolors, sizeof(XColor));
for (i = 0; i < ncolors; i++)
colors[i].pixel = i;
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
for (i = 0; i < ncolors; i++) {
pCmap->red[i].co.local.red = colors[i].red;
pCmap->red[i].co.local.green = colors[i].green;
pCmap->red[i].co.local.blue = colors[i].blue;
}
free(colors);
break;
case TrueColor: /* read only */
colors = xallocarray(ncolors, sizeof(XColor));
red = green = blue = 0L;
redInc = lowbit(pVisual->redMask);
greenInc = lowbit(pVisual->greenMask);
blueInc = lowbit(pVisual->blueMask);
for (i = 0; i < ncolors; i++) {
colors[i].pixel = red | green | blue;
red += redInc;
if (red > pVisual->redMask)
red = 0L;
green += greenInc;
if (green > pVisual->greenMask)
green = 0L;
blue += blueInc;
if (blue > pVisual->blueMask)
blue = 0L;
}
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
for (i = 0; i < ncolors; i++) {
pCmap->red[i].co.local.red = colors[i].red;
pCmap->green[i].co.local.green = colors[i].green;
pCmap->blue[i].co.local.blue = colors[i].blue;
}
free(colors);
break;
case GrayScale: /* read and write */
break;
case PseudoColor: /* read and write */
break;
case DirectColor: /* read and write */
break;
}
return True;
}
void
xnestDestroyColormap(ColormapPtr pCmap)
{
XFreeColormap(xnestDisplay, xnestColormap(pCmap));
}
#define SEARCH_PREDICATE \
(xnestWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i])
static int
xnestCountInstalledColormapWindows(WindowPtr pWin, void *ptr)
{
xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr;
int i;
for (i = 0; i < icws->numCmapIDs; i++)
if (SEARCH_PREDICATE) {
icws->numWindows++;
return WT_DONTWALKCHILDREN;
}
return WT_WALKCHILDREN;
}
static int
xnestGetInstalledColormapWindows(WindowPtr pWin, void *ptr)
{
xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr;
int i;
for (i = 0; i < icws->numCmapIDs; i++)
if (SEARCH_PREDICATE) {
icws->windows[icws->index++] = xnestWindow(pWin);
return WT_DONTWALKCHILDREN;
}
return WT_WALKCHILDREN;
}
static Window *xnestOldInstalledColormapWindows = NULL;
static int xnestNumOldInstalledColormapWindows = 0;
static Bool
xnestSameInstalledColormapWindows(Window *windows, int numWindows)
{
if (xnestNumOldInstalledColormapWindows != numWindows)
return False;
if (xnestOldInstalledColormapWindows == windows)
return True;
if (xnestOldInstalledColormapWindows == NULL || windows == NULL)
return False;
if (memcmp(xnestOldInstalledColormapWindows, windows,
numWindows * sizeof(Window)))
return False;
return True;
}
void
xnestSetInstalledColormapWindows(ScreenPtr pScreen)
{
xnestInstalledColormapWindows icws;
int numWindows;
icws.cmapIDs = xallocarray(pScreen->maxInstalledCmaps, sizeof(Colormap));
icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
icws.numWindows = 0;
WalkTree(pScreen, xnestCountInstalledColormapWindows, (void *) &icws);
if (icws.numWindows) {
icws.windows = xallocarray(icws.numWindows + 1, sizeof(Window));
icws.index = 0;
WalkTree(pScreen, xnestGetInstalledColormapWindows, (void *) &icws);
icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
numWindows = icws.numWindows + 1;
}
else {
icws.windows = NULL;
numWindows = 0;
}
free(icws.cmapIDs);
if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64
{
int i;
Window64 *windows = xallocarray(numWindows, sizeof(Window64));
for (i = 0; i < numWindows; ++i)
windows[i] = icws.windows[i];
XSetWMColormapWindows(xnestDisplay,
xnestDefaultWindows[pScreen->myNum], windows,
numWindows);
free(windows);
}
#else
XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
icws.windows, numWindows);
#endif
xnestOldInstalledColormapWindows = icws.windows;
xnestNumOldInstalledColormapWindows = icws.numWindows;
#ifdef DUMB_WINDOW_MANAGERS
/*
This code is for dumb window managers.
This will only work with default local visual colormaps.
*/
if (icws.numWindows) {
WindowPtr pWin;
Visual *visual;
ColormapPtr pCmap;
pWin = xnestWindowPtr(icws.windows[0]);
visual = xnestVisualFromID(pScreen, wVisual(pWin));
if (visual == xnestDefaultVisual(pScreen))
dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
RT_COLORMAP, serverClient,
DixUseAccess);
else
dixLookupResourceByType((void **) &pCmap,
pScreen->defColormap, RT_COLORMAP,
serverClient, DixUseAccess);
XSetWindowColormap(xnestDisplay,
xnestDefaultWindows[pScreen->myNum],
xnestColormap(pCmap));
}
#endif /* DUMB_WINDOW_MANAGERS */
}
else
free(icws.windows);
}
void
xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
{
free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64
{
Window64 window;
window = xnestScreenSaverWindows[pScreen->myNum];
XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
&window, 1);
xnestScreenSaverWindows[pScreen->myNum] = window;
}
#else
XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
&xnestScreenSaverWindows[pScreen->myNum], 1);
#endif /* _XSERVER64 */
xnestOldInstalledColormapWindows = NULL;
xnestNumOldInstalledColormapWindows = 0;
xnestDirectUninstallColormaps(pScreen);
}
void
xnestDirectInstallColormaps(ScreenPtr pScreen)
{
int i, n;
Colormap pCmapIDs[MAXCMAPS];
if (!xnestDoDirectColormaps)
return;
n = (*pScreen->ListInstalledColormaps) (pScreen, pCmapIDs);
for (i = 0; i < n; i++) {
ColormapPtr pCmap;
dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP,
serverClient, DixInstallAccess);
if (pCmap)
XInstallColormap(xnestDisplay, xnestColormap(pCmap));
}
}
void
xnestDirectUninstallColormaps(ScreenPtr pScreen)
{
int i, n;
Colormap pCmapIDs[MAXCMAPS];
if (!xnestDoDirectColormaps)
return;
n = (*pScreen->ListInstalledColormaps) (pScreen, pCmapIDs);
for (i = 0; i < n; i++) {
ColormapPtr pCmap;
dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP,
serverClient, DixUninstallAccess);
if (pCmap)
XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
}
}
void
xnestInstallColormap(ColormapPtr pCmap)
{
ColormapPtr pOldCmap = GetInstalledColormap(pCmap->pScreen);
if (pCmap != pOldCmap) {
xnestDirectUninstallColormaps(pCmap->pScreen);
/* Uninstall pInstalledMap. Notify all interested parties. */
if (pOldCmap != (ColormapPtr) None)
WalkTree(pCmap->pScreen, TellLostMap, (void *) &pOldCmap->mid);
SetInstalledColormap(pCmap->pScreen, pCmap);
WalkTree(pCmap->pScreen, TellGainedMap, (void *) &pCmap->mid);
xnestSetInstalledColormapWindows(pCmap->pScreen);
xnestDirectInstallColormaps(pCmap->pScreen);
}
}
void
xnestUninstallColormap(ColormapPtr pCmap)
{
ColormapPtr pCurCmap = GetInstalledColormap(pCmap->pScreen);
if (pCmap == pCurCmap) {