Unverified Commit 67599026 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/various3' into 3.6.x

parents 5a8f1e92 cf8797c3
......@@ -50,7 +50,7 @@
#ifdef SVR4
#include <sys/sysmacros.h>
#endif
#if defined(ISC) || defined(__CYGWIN__) || defined(__SCO__)
#if defined(__CYGWIN__) || defined(__SCO__)
#include <sys/param.h>
#include <sys/sysmacros.h>
#endif
......
......@@ -387,6 +387,7 @@ ProcXvQueryAdaptors(ClientPtr client)
xvAdaptorInfo ainfo;
xvQueryAdaptorsReply rep;
int totalSize, na, nf;
int nameSize;
XvAdaptorPtr pa;
XvFormatPtr pf;
WindowPtr pWin;
......@@ -450,12 +451,12 @@ ProcXvQueryAdaptors(ClientPtr client)
ainfo.base_id = pa->base_id;
ainfo.num_ports = pa->nPorts;
ainfo.type = pa->type;
ainfo.name_size = strlen(pa->name);
ainfo.name_size = nameSize = strlen(pa->name);
ainfo.num_formats = pa->nFormats;
_WriteAdaptorInfo(client, &ainfo);
WriteToClient(client, ainfo.name_size, pa->name);
WriteToClient(client, nameSize, pa->name);
nf = pa->nFormats;
pf = pa->pFormats;
......@@ -481,6 +482,7 @@ ProcXvQueryEncodings(ClientPtr client)
xvEncodingInfo einfo;
xvQueryEncodingsReply rep;
int totalSize;
int nameSize;
XvPortPtr pPort;
int ne;
XvEncodingPtr pe;
......@@ -525,13 +527,13 @@ ProcXvQueryEncodings(ClientPtr client)
while (ne--)
{
einfo.encoding = pe->id;
einfo.name_size = strlen(pe->name);
einfo.name_size = nameSize = strlen(pe->name);
einfo.width = pe->width;
einfo.height = pe->height;
einfo.rate.numerator = pe->rate.numerator;
einfo.rate.denominator = pe->rate.denominator;
_WriteEncodingInfo(client, &einfo);
WriteToClient(client, einfo.name_size, pe->name);
WriteToClient(client, nameSize, pe->name);
pe++;
}
......@@ -1011,19 +1013,20 @@ ProcXvQueryPortAttributes(ClientPtr client)
rep.num_attributes = pPort->pAdaptor->nAttributes;
rep.text_size = 0;
for(i = 0, pAtt = pPort->pAdaptor->pAttributes;
i < rep.num_attributes; i++, pAtt++)
for(i = 0, pAtt = pPort->pAdaptor->pAttributes;
i < pPort->pAdaptor->nAttributes; i++, pAtt++)
{
rep.text_size += (strlen(pAtt->name) + 1 + 3) & ~3L;
}
rep.length = (rep.num_attributes * sz_xvAttributeInfo) + rep.text_size;
rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo)
+ rep.text_size;
rep.length >>= 2;
_WriteQueryPortAttributesReply(client, &rep);
for(i = 0, pAtt = pPort->pAdaptor->pAttributes;
i < rep.num_attributes; i++, pAtt++)
i < pPort->pAdaptor->nAttributes; i++, pAtt++)
{
size = strlen(pAtt->name) + 1; /* pass the NULL */
Info.flags = pAtt->flags;
......@@ -1233,6 +1236,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
XvPortPtr pPort;
int *offsets;
int *pitches;
int planeLength;
REQUEST(xvQueryImageAttributesReq);
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
......@@ -1272,7 +1276,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = num_planes << 1;
rep.length = planeLength = num_planes << 1;
rep.num_planes = num_planes;
rep.width = width;
rep.height = height;
......@@ -1280,8 +1284,8 @@ ProcXvQueryImageAttributes(ClientPtr client)
_WriteQueryImageAttributesReply(client, &rep);
if(client->swapped)
SwapLongs((CARD32*)offsets, rep.length);
WriteToClient(client, rep.length << 2, offsets);
SwapLongs((CARD32*)offsets, planeLength);
WriteToClient(client, planeLength << 2, offsets);
free(offsets);
......@@ -1309,13 +1313,13 @@ ProcXvListImageFormats(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num_formats = pPort->pAdaptor->nImages;
rep.length = rep.num_formats * sz_xvImageFormatInfo >> 2;
rep.length = pPort->pAdaptor->nImages * sz_xvImageFormatInfo >> 2;
_WriteListImageFormatsReply(client, &rep);
pImage = pPort->pAdaptor->pImages;
for(i = 0; i < rep.num_formats; i++, pImage++) {
for(i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) {
info.id = pImage->id;
info.type = pImage->type;
info.byte_order = pImage->byte_order;
......@@ -1642,7 +1646,7 @@ SWriteQueryExtensionReply(
swaps(&rep->version);
swaps(&rep->revision);
WriteToClient(client, sz_xvQueryExtensionReply, &rep);
WriteToClient(client, sz_xvQueryExtensionReply, rep);
return Success;
}
......@@ -1656,7 +1660,7 @@ SWriteQueryAdaptorsReply(
swapl(&rep->length);
swaps(&rep->num_adaptors);
WriteToClient(client, sz_xvQueryAdaptorsReply, &rep);
WriteToClient(client, sz_xvQueryAdaptorsReply, rep);
return Success;
}
......@@ -1670,7 +1674,7 @@ SWriteQueryEncodingsReply(
swapl(&rep->length);
swaps(&rep->num_encodings);
WriteToClient(client, sz_xvQueryEncodingsReply, &rep);
WriteToClient(client, sz_xvQueryEncodingsReply, rep);
return Success;
}
......@@ -1765,7 +1769,7 @@ SWriteGrabPortReply(
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, sz_xvGrabPortReply, &rep);
WriteToClient(client, sz_xvGrabPortReply, rep);
return Success;
}
......@@ -1779,7 +1783,7 @@ SWriteGetPortAttributeReply(
swapl(&rep->length);
swapl(&rep->value);
WriteToClient(client, sz_xvGetPortAttributeReply, &rep);
WriteToClient(client, sz_xvGetPortAttributeReply, rep);
return Success;
}
......@@ -1794,7 +1798,7 @@ SWriteQueryBestSizeReply(
swaps(&rep->actual_width);
swaps(&rep->actual_height);
WriteToClient(client, sz_xvQueryBestSizeReply, &rep);
WriteToClient(client, sz_xvQueryBestSizeReply, rep);
return Success;
}
......@@ -1809,7 +1813,7 @@ SWriteQueryPortAttributesReply(
swapl(&rep->num_attributes);
swapl(&rep->text_size);
WriteToClient(client, sz_xvQueryPortAttributesReply, &rep);
WriteToClient(client, sz_xvQueryPortAttributesReply, rep);
return Success;
}
......@@ -1826,7 +1830,7 @@ SWriteQueryImageAttributesReply(
swaps(&rep->width);
swaps(&rep->height);
WriteToClient(client, sz_xvQueryImageAttributesReply, &rep);
WriteToClient(client, sz_xvQueryImageAttributesReply, rep);
return Success;
}
......@@ -1841,7 +1845,7 @@ SWriteListImageFormatsReply(
swapl(&rep->length);
swapl(&rep->num_formats);
WriteToClient(client, sz_xvListImageFormatsReply, &rep);
WriteToClient(client, sz_xvListImageFormatsReply, rep);
return Success;
}
......
......@@ -2,9 +2,6 @@ NULL =
#include <Server.tmpl>
XPSRC = xpstubs.c
XPOBJ = xpstubs.o
#if !HasFfs
FFS_SRC = ffs.c
FFS_OBJ = ffs.o
......@@ -129,8 +126,6 @@ VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) $(QUARTZ_DEFINES)
NormalLibraryObjectRule()
NormalLibraryTarget(dix,$(OBJS))
LintLibraryTarget(dix,$(SRCS) $(XPSRC))
NormalLintTarget($(SRCS) $(XPSRC))
SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES) $(EXT_DEFINES))
SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES))
......@@ -138,6 +133,4 @@ SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_))
SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_))
SpecialCObjectRule(window,$(ICONFIGFILES),$(QUARTZ_DEFINES))
NormalLibraryTarget(xpstubs,$(XPOBJ))
DependTarget()
......@@ -73,8 +73,6 @@ SOFTWARE.
#include "swaprep.h"
#include "dixevents.h"
extern void XkbFreePrivates(DeviceIntPtr device);
DeviceIntPtr
AddInputDevice(DeviceProc deviceProc, Bool autoStart)
{
......
......@@ -391,7 +391,6 @@ Dispatch(void)
}
isItTimeToYield = FALSE;
requestingClient = client;
start_tick = SmartScheduleTime;
while (!isItTimeToYield)
{
......@@ -447,7 +446,6 @@ Dispatch(void)
client = clients[clientReady[nready]];
if (client)
client->smart_stop_tick = SmartScheduleTime;
requestingClient = NULL;
}
dispatchException &= ~DE_PRIORITYCHANGE;
}
......
......@@ -2178,34 +2178,27 @@ FontResolutionPtr
GetClientResolutions (int *num)
#endif /* HAS_XFONT2 */
{
if (requestingClient && requestingClient->fontResFunc != NULL &&
!requestingClient->clientGone)
{
return (*requestingClient->fontResFunc)(requestingClient, num);
}
else {
static struct _FontResolution res;
ScreenPtr pScreen;
static struct _FontResolution res;
ScreenPtr pScreen;
pScreen = screenInfo.screens[0];
res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth;
/*
* XXX - we'll want this as long as bitmap instances are prevalent
so that we can match them from scalable fonts
*/
if (res.x_resolution < 88)
res.x_resolution = 75;
else
res.x_resolution = 100;
res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight;
if (res.y_resolution < 88)
res.y_resolution = 75;
else
res.y_resolution = 100;
res.point_size = 120;
*num = 1;
return &res;
}
pScreen = screenInfo.screens[0];
res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth;
/*
* XXX - we'll want this as long as bitmap instances are prevalent
so that we can match them from scalable fonts
*/
if (res.x_resolution < 88)
res.x_resolution = 75;
else
res.x_resolution = 100;
res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight;
if (res.y_resolution < 88)
res.y_resolution = 75;
else
res.y_resolution = 100;
res.point_size = 120;
*num = 1;
return &res;
}
#ifndef HAS_XFONT2
......
......@@ -141,7 +141,6 @@ Bool loadableFonts = FALSE;
CursorPtr rootCursor;
Bool blackRoot=FALSE;
Bool whiteRoot=FALSE;
ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */
TimeStamp currentTime;
TimeStamp lastDeviceEventTime;
......
......@@ -254,7 +254,6 @@ main(int argc, char *argv[], char *envp[])
SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 0;
screenInfo.numVideoScreens = -1;
InitAtoms();
InitEvents();
......@@ -280,8 +279,6 @@ main(int argc, char *argv[], char *envp[])
if (screenInfo.numScreens < 1)
FatalError("no screens found");
if (screenInfo.numVideoScreens < 0)
screenInfo.numVideoScreens = screenInfo.numScreens;
InitExtensions(argc, argv);
if (!InitClientPrivates(serverClient))
FatalError("failed to allocate serverClient devprivates");
......
......@@ -253,11 +253,18 @@ ProcChangeProperty(ClientPtr client)
else
return client->noClientException;
}
#endif /* NXAGENT_SERVER */
int
#ifdef NXAGENT_SERVER
Xorg_ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, void * value,
Bool sendevent)
#else
ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, void * value,
Bool sendevent)
#endif
{
PropertyPtr pProp;
int sizeInBytes;
......@@ -367,7 +374,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
}
return(Success);
}
#endif /* NXAGENT_SERVER */
int
DeleteProperty(WindowPtr pWin, Atom propName)
......
/*
Copyright 1996, 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_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "misc.h"
#include <X11/fonts/font.h>
extern Bool XpClientIsBitmapClient(ClientPtr client);
extern Bool XpClientIsPrintClient(ClientPtr client, FontPathElementPtr fpe);
Bool
XpClientIsBitmapClient(
ClientPtr client)
{
return TRUE;
}
Bool
XpClientIsPrintClient(
ClientPtr client,
FontPathElementPtr fpe)
{
return FALSE;
}
......@@ -75,26 +75,61 @@ Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
{
"NX_IDENTITY", /* 0 */
"WM_PROTOCOLS", /* 1 */
"WM_DELETE_WINDOW", /* 2 */
"WM_NX_READY", /* 3 */
"MCOPGLOBALS", /* 4 */
"NX_CUT_BUFFER_SERVER", /* 5 */
/* Unfortunately we cannot rename this to NX_SELTRANS_TO_AGENT
"NX_IDENTITY", /* 0 */
/* NX_IDENTITY was used in earlier nx versions to communicate
the version to NXwin. Got dropped between nxagent 1.5.0-45
and 1.5.0-112. */
"WM_PROTOCOLS", /* 1 */
/* standard ICCCM Atom */
"WM_DELETE_WINDOW", /* 2 */
/* standard ICCCM Atom */
"WM_NX_READY", /* 3 */
/* nxagent takes the ownership of the selection with this name
to signal the nxclient (or any other watching program)
it is ready. */
"MCOPGLOBALS", /* 4 */
/* used for artsd support. */
"NX_CUT_BUFFER_SERVER", /* 5 */
/* this is the name of a property on nxagent's window on the
real X server. This property is used for passing clipboard
content from clients of the real X server to nxagent's clients
Unfortunately we cannot rename this to NX_SELTRANS_TO_AGENT
because nomachine's nxclient is depending on this
selection */
"TARGETS", /* 6 */
"TEXT", /* 7 */
"NX_AGENT_SIGNATURE", /* 8 */
"NXDARWIN", /* 9 */
"TARGETS", /* 6 */
/* used to request a list of supported data formats from the
selection owner. Standard ICCCM Atom */
"TEXT", /* 7 */
/* one of the supported data formats for selections. Standard
ICCCM Atom */
"NX_AGENT_SIGNATURE", /* 8 */
/* this is used to set a property on nxagent's window if nxagent
is started with the fullscreen option set. Unsure, what this
is used for. */
"NXDARWIN", /* 9 */
/* this was an Atom in nxdarwin, nomachine's X server for MacOS. */
"CLIPBOARD", /* 10 */
/* Atom for the clipboard selection. PRIMARY is fixed in X11 but
CLIPBOARD is not. Standard ICCCM Atom. */
"TIMESTAMP", /* 11 */
/* used to request the time a selection has been owned. Standard
ICCCM Atom */
"UTF8_STRING", /* 12 */
/* one of the supported data formats for selections. Standard
ICCCM Atom */
"_NET_WM_STATE", /* 13 */
/* standard ICCCM Atom */
"_NET_WM_STATE_FULLSCREEN", /* 14 */
/* standard ICCCM Atom */
"NX_SELTRANS_FROM_AGENT", /* 15 */
/* this is the name of a property on nxagent's window on the real
X server. This property is used for passing clipboard content
from nxagent's clients to clients on the real X server */
"COMPOUND_TEXT", /* 16 */
/* one of the supported data formats for selections. Standard
ICCCM Atom */
NULL,
NULL
};
......
......@@ -114,10 +114,11 @@ int nxagentErrorHandler(Display *dpy, XErrorEvent *event)
return 0;
}
/* copied from XlibInt.c */
/* extension stuff roughly commented out */
/* FIXME: why? What's wrong with printing extension stuff?
We could drop this in favour of _XprintDefaultError then! */
/* copied from XlibInt.c:_XprintDefaultError
* We cannot use the whole function because it requires XlibInt
* internals. And we cannot call _XPrintDefaultError because it
* is not exported.
*/
static int nxagentPrintError(dpy, event, fp)
Display *dpy;
XErrorEvent *event;
......@@ -126,11 +127,11 @@ static int nxagentPrintError(dpy, event, fp)
char buffer[BUFSIZ];
char mesg[BUFSIZ];
char number[32];
char *mtype = "XlibMessage";
/*
const char *mtype = "XlibMessage";
#ifndef NXAGENT_SERVER
register _XExtension *ext = (_XExtension *)NULL;
_XExtension *bext = (_XExtension *)NULL;
*/
#endif
XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
(void) fprintf(fp, "%s: %s\n ", mesg, buffer);
......@@ -141,14 +142,16 @@ static int nxagentPrintError(dpy, event, fp)
snprintf(number, sizeof(number), "%d", event->request_code);
XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
} else {
/* for (ext = dpy->ext_procs;
#ifndef NXAGENT_SERVER
for (ext = dpy->ext_procs;
ext && (ext->codes.major_opcode != event->request_code);
ext = ext->next)
;
if (ext)
if (ext) {
strncpy(buffer, ext->name, BUFSIZ);
else
*/
buffer[BUFSIZ - 1] = '\0';
} else
#endif
buffer[0] = '\0';
}
(void) fprintf(fp, " (%s)\n", buffer);
......@@ -157,19 +160,19 @@ static int nxagentPrintError(dpy, event, fp)
mesg, BUFSIZ);
fputs(" ", fp);
(void) fprintf(fp, mesg, event->minor_code);
/*
#ifndef NXAGENT_SERVER
if (ext) {
snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code);
XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
(void) fprintf(fp, " (%s)", buffer);
}
*/
#endif
fputs("\n", fp);
}
if (event->error_code >= 128) {
/* kludge, try to find the extension that caused it */
buffer[0] = '\0';
/*
#ifndef NXAGENT_SERVER
for (ext = dpy->ext_procs; ext; ext = ext->next) {
if (ext->error_string)
(*ext->error_string)(dpy, event->error_code, &ext->codes,
......@@ -187,7 +190,7 @@ static int nxagentPrintError(dpy, event, fp)
snprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
event->error_code - bext->codes.first_error);
else
*/
#endif
strcpy(buffer, "Value");
XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
if (mesg[0]) {
......@@ -196,12 +199,12 @@ static int nxagentPrintError(dpy, event, fp)
fputs("\n", fp);
}
/* let extensions try to print the values */
/*
#ifndef NXAGENT_SERVER
for (ext = dpy->ext_procs; ext; ext = ext->next) {
if (ext->error_values)
(*ext->error_values)(dpy, event, fp);
}
*/
#endif
} else if ((event->error_code == BadWindow) ||
(event->error_code == BadPixmap) ||
(event->error_code == BadCursor) ||
......@@ -229,10 +232,12 @@ static int nxagentPrintError(dpy, event, fp)
mesg, BUFSIZ);
fputs(" ", fp);
(void) fprintf(fp, mesg, event->serial);
/* XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
#ifndef NXAGENT_SERVER
XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
mesg, BUFSIZ);
fputs("\n ", fp);
(void) fprintf(fp, mesg, dpy->request); */
(void) fprintf(fp, mesg, (unsigned long long)(X_DPY_GET_REQUEST(dpy)));
#endif
fputs("\n", fp);
if (event->error_code == BadImplementation) return 0;
return 1;
......
......@@ -2197,7 +2197,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
{
if (nxagentOption(AllScreens) == 0 && nxagentOption(Fullscreen) == 1)
{
nxagentSwitchFullscreen(pScreen, 0);
nxagentSwitchFullscreen(pScreen, False);
}
else
{
......@@ -2578,11 +2578,6 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
{
*result = doNothing;
#ifdef TEST
fprintf(stderr, "%s: ClientMessage event window [%ld] with type [%ld] format [%d].\n",
__func__, X -> xclient.window, X -> xclient.message_type, X -> xclient.format);
#endif
/*
* If window is 0, message_type is 0 and format is 32 then we assume
* event is coming from proxy.
......@@ -2592,11 +2587,25 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
X -> xclient.message_type == 0 &&
X -> xclient.format == 32)
{
#ifdef TEST
fprintf(stderr, "%s: got nxproxy event\n", __func__);
#endif
nxagentHandleProxyEvent(X);
return 1;
}
#ifdef TEST
char * name = XGetAtomName(nxagentDisplay, X -> xclient.message_type);
fprintf(stderr, "nxagentHandleClientMessageEvent: ClientMessage event window [0x%lx] with "
"message_type [%ld][%s] format [%d] type [%d] source_indication [%ld][%s] timestamp [%ld] "
"curwin [0x%lx].\n", X -> xclient.window, X -> xclient.message_type, name,
X -> xclient.format, X -> xclient.type, X -> xclient.data.l[0],
X -> xclient.data.l[0] == 1 ? "'application'" : X -> xclient.data.l[0] == 1 ? "'pager'" : "'none (old spec)'",
X -> xclient.data.l[1], X -> xclient.data.l[2]);
SAFE_XFree(name);
#endif
if (nxagentOption(Rootless))
{
Atom message_type = nxagentRemoteToLocalAtom(X -> xclient.message_type);
......@@ -2611,11 +2620,20 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
}
WindowPtr pWin = nxagentWindowPtr(X -> xclient.window);
if (pWin == NULL)
{
/*
* If some window on the real X server sends a
* _NET_ACTIVE_WINDOW ClientMessage to indicate the active
* window that window will be one not belonging to nxagent so
* this situation is perfectly legal. For all other situations
* we print a warning.
*/
#ifdef WARNING
fprintf(stderr, "WARNING: Invalid window in ClientMessage.\n");
if (message_type != MakeAtom("_NET_ACTIVE_WINDOW", strlen("_NET_ACTIVE_WINDOW"), False))
{
fprintf(stderr, "WARNING: Invalid window in ClientMessage xclient.window [0x%lx].\n", X->xclient.window);
}
#endif
return 0;
......
......@@ -469,9 +469,6 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL);
#endif /* HAS_XFONT2 */
if (requestingClient && XpClientIsPrintClient(requestingClient, NULL))
return True;
name_atom = MakeAtom("FONT", 4, True);
value_atom = 0L;
......
......@@ -726,8 +726,6 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas
}
#endif
#ifndef __CYGWIN32__
if (nxagentReadEvents(nxagentDisplay) > 0 ||
nxagentReadEvents(nxagentShadowDisplay) > 0)
{
......@@ -745,19 +743,6 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas
nxagentShadowAdaptToRatio();
}
#else
if (nxagentReadEvents(nxagentDisplay) > 0)
{
#ifdef TEST
fprintf(stderr, "nxagentShadowBlockHandler: Reading X events queued.\n");
#endif
nxagentDispatchEvents(NULL);
}
#endif
changed = 0;
NXShadowGetScreenSize(&width_, &height_);
......@@ -800,26 +785,6 @@ FIXME: Must queue multiple writes and handle the events by resembling
*timeout = &zero;
}
#ifdef __CYGWIN32__
if (nxagentOption(SleepTime) > 0) {
#ifdef TEST
fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n",
nxagentOption(SleepTime));
#endif
usleep(nxagentOption(SleepTime) * 1000);
}
#ifdef TEST
else if (0 == nxagentOption(SleepTime)) {
fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n");
}
#endif
(*timeout) -> tv_sec = 0;
(*timeout) -> tv_usec = 50 * 1000;
#else
if (changed == 0)
{
(*timeout) -> tv_sec = 0;
......@@ -831,8 +796,6 @@ FIXME: Must queue multiple writes and handle the events by resembling
(*timeout) -> tv_usec = 0;
}
#endif
nxagentPrintGeometry();
#ifdef BLOCKS
......@@ -857,7 +820,6 @@ void nxagentShadowWakeupHandler(void * data, int count, void * mask)
if (!SmartScheduleSignalEnable)
{
#ifdef DEBUG
fprintf(stderr, "nxagentShadowWakeupHandler: Resetting the dispatch state after wakeup.\n");
#endif
......@@ -866,7 +828,6 @@ void nxagentShadowWakeupHandler(void * data, int count, void * mask)
nxagentDispatch.in = nxagentBytesIn;
nxagentDispatch.out = nxagentBytesOut;
}
/*
......
......@@ -99,6 +99,7 @@ extern void nxagentBitOrderInvert(unsigned char *, int);
extern void nxagentTwoByteSwap(unsigned char *, register int);
extern void nxagentFourByteSwap(register unsigned char *, register int);
extern ClientPtr nxagentRequestingClient;
/*
* Store the last visual used to unpack the images for the given
* client.
......@@ -140,9 +141,7 @@ static char *nxagentImageCopy(XImage *source, XImage *destination);
* expensive than a copy.
*/
#define nxagentNeedCache(image, method) \
\
((method) != PACK_BITMAP_16M_COLORS)
#define nxagentNeedCache(image, method) ((method) != PACK_BITMAP_16M_COLORS)
/*
* With the bitmap encoding, if the image is 32 bits-per-pixel the 4th
......@@ -276,6 +275,7 @@ int nxagentImagePad(int width, int format, int leftPad, int depth)
else if (format == XYPixmap)
{
line = BitmapBytePad(width + leftPad);
/* FIXME: shouldn't we multiply by depth here like in nxagentImageLength? */
}
else if (format == ZPixmap)
{
......@@ -1074,7 +1074,7 @@ void nxagentPutSubImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
/*
FIXME: Should use an unpack resource here.
*/
client = requestingClient;
client = nxagentRequestingClient;
if (client == NULL)
{
......@@ -1093,7 +1093,7 @@ FIXME: Should use an unpack resource here.
#ifdef TEST
fprintf(stderr, "nxagentPutSubImage: Display image order is [%d] bitmap order is [%d].\n",
ImageByteOrder(nxagentDisplay), nxagentBitmapBitOrder(nxagentDisplay));
ImageByteOrder(nxagentDisplay), BitmapBitOrder(nxagentDisplay));
#endif
/*
......@@ -1559,7 +1559,6 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio,
XImage **pImage, int *scaledx, int *scaledy)
{
XImage *image = *pImage;
if (image == NULL)
{
return 0;
......
......@@ -59,7 +59,6 @@ SRCS = \
Composite.c \
Pixels.c \
stubs.c \
xpstubs.c \
miinitext.c \
$(NULL)
......@@ -116,7 +115,6 @@ OBJS = \
Composite.o \
Pixels.o \
stubs.o \
xpstubs.o \
miinitext.o \
$(NULL)
......@@ -264,7 +262,6 @@ DEFINES = \
all:: $(OBJS)
LinkSourceFile(stubs.c,$(SERVERSRC)/Xi)
LinkSourceFile(xpstubs.c,$(SERVERSRC)/dix)
LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
SpecialCObjectRule(miinitext,$(ICONFIGFILES), $(_NOOP_))
......
......@@ -45,7 +45,7 @@ extern int nxagentDoFullGeneration;
extern int nxagentBackingStore;
extern int nxagentSaveUnder;
extern int nxagentX2go;
extern int nxagentX2go;
void checkX2goAgent(void);
extern ServerGrabInfoRec nxagentGrabServerInfo;
......
......@@ -567,7 +567,7 @@ XkbError:
if (nxagentKeyboard[i] == '\0' || nxagentKeyboard[i + 1] == '\0' || i == 0)
{
ErrorF("Warning: Wrong keyboard type: %s.\n", nxagentKeyboard);
ErrorF("Warning: Wrong keyboard type: '%s'.\n", nxagentKeyboard);
goto XkbError;
}
......@@ -1466,7 +1466,7 @@ static void nxagentWriteKeyboardDir(void)
if (keyboard_file_path)
{
/*
* special case: if rules is NULL create a directory insteas of
* special case: if rules is NULL create a directory instead of
* a file. This is the defined method to disable x2gosetkeyboard.
*/
if (mkdir(keyboard_file_path, 0555) < 0)
......
......@@ -432,7 +432,7 @@ void nxagentDumpKeystrokes(void)
{
int maxlen = 0;
for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++)
maxlen = min(maxlen, strlen(nxagentSpecialKeystrokeNames[i]));
maxlen = max(maxlen, strlen(nxagentSpecialKeystrokeNames[i]));
fprintf(stderr, "Currently known keystrokes:\n");
......
......@@ -200,6 +200,12 @@ extern int nxagentMaxSelections;
extern int nxOpenFont(ClientPtr, XID, Mask, unsigned, char*);
/*
* This used to be a dix variable used only by XPRINT, so xorg dropped it.
*/
ClientPtr nxagentRequestingClient;
void
InitSelections(void)
{
......@@ -245,6 +251,7 @@ Dispatch(void)
InitSelections();
nClients = 0;
#ifdef NXAGENT_SERVER
/*
* The agent initialization was successfully
* completed. We can now handle our clients.
......@@ -269,10 +276,12 @@ Dispatch(void)
#endif
#endif /* NXAGENT_SERVER */
clientReady = (int *) malloc(sizeof(int) * MaxClients);
if (!clientReady)
return;
#ifdef NXAGENT_SERVER
#ifdef WATCH
fprintf(stderr, "Dispatch: Watchpoint 12.\n");
......@@ -303,6 +312,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
if (!(dispatchException & DE_TERMINATE))
dispatchException = 0;
#endif /* NXAGENT_SERVER */
while (!dispatchException)
{
......@@ -312,6 +322,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
FlushIfCriticalOutputPending();
}
#ifdef NXAGENT_SERVER
/*
* Ensure we remove the splash after the timeout.
* Initializing clientReady[0] to -1 will tell
......@@ -351,9 +362,11 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
#ifdef BLOCKS
fprintf(stderr, "[End dispatch]\n");
#endif
#endif /* NXAGENT_SERVER */
nready = WaitForSomething(clientReady);
#ifdef NXAGENT_SERVER
#ifdef BLOCKS
fprintf(stderr, "[Begin dispatch]\n");
#endif
......@@ -378,6 +391,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
nxagentClients = nClients;
#endif
#endif /* NXAGENT_SERVER */
if (nready)
{
......@@ -405,7 +419,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
}
isItTimeToYield = FALSE;
requestingClient = client;
#ifdef NXAGENT_SERVER
nxagentRequestingClient = client;
#endif
start_tick = SmartScheduleTime;
while (!isItTimeToYield)
{
......@@ -423,10 +439,15 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
}
/* now, finally, deal with client requests */
/* Update currentTime so request time checks, such as for input
* device grabs, are calculated correctly */
UpdateCurrentTimeIf();
#ifdef NXAGENT_SERVER
#ifdef TEST
fprintf(stderr, "******Dispatch: Reading request from client [%d].\n",
client->index);
#endif
#endif /* NXAGENT_SERVER */
result = ReadRequestFromClient(client);
if (result <= 0)
......@@ -435,8 +456,8 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
CloseDownClient(client);
break;
}
#ifdef NXAGENT_SERVER
#ifdef NXAGENT_SERVER
#ifdef TEST
else
......@@ -463,10 +484,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
if (result > (maxBigRequestSize << 2))
result = BadLength;
else
#ifdef NXAGENT_SERVER
{
result = (* client->requestVector[MAJOROP])(client);
#ifdef NXAGENT_SERVER
#ifdef TEST
if (MAJOROP > 127)
......@@ -492,11 +512,8 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
*/
nxagentDispatchHandler(client, client->req_len << 2, 0);
}
#else
result = (* client->requestVector[MAJOROP])(client);
#endif
}
if (!SmartScheduleSignalEnable)
SmartScheduleTime = GetTimeInMillis();
......@@ -519,13 +536,17 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
client = clients[clientReady[nready]];
if (client)
client->smart_stop_tick = SmartScheduleTime;
requestingClient = NULL;
#ifdef NXAGENT_SERVER
nxagentRequestingClient = NULL;
#endif
}
dispatchException &= ~DE_PRIORITYCHANGE;
}
#if defined(DDXBEFORERESET)
ddxBeforeReset ();
#endif
#ifdef NXAGENT_SERVER
/* FIXME: maybe move the code up to the KillAllClients() call to ddxBeforeReset? */
if ((dispatchException & DE_RESET) &&
(serverGeneration > nxagentMaxAllowedResets))
......@@ -559,6 +580,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
NXShadowDestroy();
}
saveAgentState("TERMINATED");
#endif /* NXAGENT_SERVER */
KillAllClients();
free(clientReady);
......@@ -580,7 +602,9 @@ ProcReparentWindow(register ClientPtr client)
if (!pWin)
return(BadWindow);
#ifdef NXAGENT_SERVER
nxagentRemoveSplashWindow();
#endif
pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client,
DixWriteAccess);
......@@ -807,7 +831,7 @@ ProcCloseFont(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
DixDestroyAccess);
if (pFont != (FontPtr)NULL)
if ( pFont != (FontPtr)NULL) /* id was valid */
{
#ifdef NXAGENT_SERVER
......@@ -1140,6 +1164,8 @@ CloseDownClient(register ClientPtr client)
xorg_CloseDownClient(client);
}
/* FIXME: Instead of having a own function use the provided Callback
mechanism */
int
InitClientPrivates(ClientPtr client)
{
......
......@@ -215,7 +215,9 @@ AllocatePicture (ScreenPtr pScreen)
ppriv->ptr = (void *)NULL;
}
#ifdef NXAGENT_SERVER
nxagentPicturePriv(pPicture) -> picture = 0;
#endif
return pPicture;
}
......@@ -245,13 +247,14 @@ CreatePicture (Picture pid,
pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24);
if (pDrawable->type == DRAWABLE_PIXMAP)
{
#ifdef NXAGENT_SERVER
/*
* Let picture always point to the virtual pixmap.
* For sure this is not the best way to deal with
* the virtual frame-buffer.
*/
pPicture->pDrawable = nxagentVirtualDrawable(pDrawable);
#endif
++((PixmapPtr)pDrawable)->refcnt;
pPicture->pNext = 0;
}
......
......@@ -215,16 +215,9 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, void * value,
Bool sendevent)
{
PropertyPtr pProp;
int sizeInBytes;
int totalSize;
void * data;
int copySize;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
copySize = nxagentOption(CopyBufferSize);
int sizeInBytes = format>>3;
int totalSize = len * sizeInBytes;
int copySize = nxagentOption(CopyBufferSize);
if (copySize != COPY_UNLIMITED && property == clientCutProperty)
{
......@@ -236,105 +229,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
}
}
/* first see if property already exists */
pProp = wUserProps (pWin);
while (pProp)
{
if (pProp->propertyName == property)
break;
pProp = pProp->next;
}
if (!pProp) /* just add to list */
{
if (!pWin->optional && !MakeWindowOptional (pWin))
return(BadAlloc);
pProp = (PropertyPtr)malloc(sizeof(PropertyRec));
if (!pProp)
return(BadAlloc);
data = (void *)malloc(totalSize);
if (!data && len)
{
free(pProp);
return(BadAlloc);
}
pProp->propertyName = property;
pProp->type = type;
pProp->format = format;
pProp->data = data;
if (len)
memmove((char *)data, (char *)value, totalSize);
pProp->size = len;
pProp->next = pWin->optional->userProps;
pWin->optional->userProps = pProp;
}
else
{
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
existing format and type are irrelevant when using the mode
"PropModeReplace" since they will be written over. */
if ((format != pProp->format) && (mode != PropModeReplace))
return(BadMatch);
if ((pProp->type != type) && (mode != PropModeReplace))
return(BadMatch);
if (mode == PropModeReplace)
{
if (totalSize != pProp->size * (pProp->format >> 3))
{
data = (void *)realloc(pProp->data, totalSize);
if (!data && len)
return(BadAlloc);
pProp->data = data;
}
if (len)
memmove((char *)pProp->data, (char *)value, totalSize);
pProp->size = len;
pProp->type = type;
pProp->format = format;
}
else if (len == 0)
{
/* do nothing */
}
else if (mode == PropModeAppend)
{
data = (void *)realloc(pProp->data,
sizeInBytes * (len + pProp->size));
if (!data)
return(BadAlloc);
pProp->data = data;
memmove(&((char *)data)[pProp->size * sizeInBytes],
(char *)value,
totalSize);
pProp->size += len;
}
else if (mode == PropModePrepend)
{
data = (void *)malloc(sizeInBytes * (len + pProp->size));
if (!data)
return(BadAlloc);
memmove(&((char *)data)[totalSize], (char *)pProp->data,
(int)(pProp->size * sizeInBytes));
memmove((char *)data, (char *)value, totalSize);
free(pProp->data);
pProp->data = data;
pProp->size += len;
}
}
if (sendevent)
{
xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyNewValue;
event.u.property.atom = pProp->propertyName;
event.u.property.time = currentTime.milliseconds;
DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
}
return(Success);
return Xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent);
}
/*****************
......
......@@ -107,16 +107,8 @@ void nxagentInitOptions(void)
nxagentOptions.ViewportXSpan = 0;
nxagentOptions.ViewportYSpan = 0;
#ifndef __CYGWIN32__
nxagentOptions.DesktopResize = 1;
#else
nxagentOptions.DesktopResize = 0;
#endif
nxagentOptions.Ratio = DONT_SCALE;
nxagentOptions.XRatio = DONT_SCALE;
nxagentOptions.YRatio = DONT_SCALE;
......
......@@ -87,7 +87,7 @@ void nxagentChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
if (nxagentOption(DeviceControl) == True)
{
#ifdef TEST
fprintf(stderr, "nxagentChangePointerControl: WARNING! Propagating changes to pointer settings.\n");
fprintf(stderr, "%s: WARNING! Propagating changes to pointer settings.\n", __func__);
#endif
XChangePointerControl(nxagentDisplay, True, True,
......@@ -97,7 +97,7 @@ void nxagentChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
}
#ifdef TEST
fprintf(stderr, "nxagentChangePointerControl: WARNING! Not propagating changes to pointer settings.\n");
fprintf(stderr, "%s: WARNING! Not propagating changes to pointer settings.\n", __func__);
#endif
}
......@@ -108,7 +108,7 @@ int nxagentPointerProc(DeviceIntPtr pDev, int onoff)
case DEVICE_INIT:
#ifdef TEST
fprintf(stderr, "nxagentPointerProc: Called for [DEVICE_INIT].\n");
fprintf(stderr, "%s: Called for [DEVICE_INIT].\n", __func__);
#endif
if (NXDisplayError(nxagentDisplay) == 1)
......@@ -129,7 +129,7 @@ int nxagentPointerProc(DeviceIntPtr pDev, int onoff)
case DEVICE_ON:
#ifdef TEST
fprintf(stderr, "nxagentPointerProc: Called for [DEVICE_ON].\n");
fprintf(stderr, "%s: Called for [DEVICE_ON].\n", __func__);
#endif
if (NXDisplayError(nxagentDisplay) == 1)
......@@ -146,7 +146,7 @@ int nxagentPointerProc(DeviceIntPtr pDev, int onoff)
case DEVICE_OFF:
#ifdef TEST
fprintf(stderr, "nxagentPointerProc: Called for [DEVICE_OFF].\n");
fprintf(stderr, "%s: Called for [DEVICE_OFF].\n", __func__);
#endif
if (NXDisplayError(nxagentDisplay) == 1)
......@@ -160,7 +160,7 @@ int nxagentPointerProc(DeviceIntPtr pDev, int onoff)
case DEVICE_CLOSE:
#ifdef TEST
fprintf(stderr, "nxagentPointerProc: Called for [DEVICE_CLOSE].\n");
fprintf(stderr, "%s: Called for [DEVICE_CLOSE].\n", __func__);
#endif
break;
......@@ -174,14 +174,14 @@ void nxagentInitPointerMap(void)
unsigned char pointerMap[MAXBUTTONS];
#ifdef DEBUG
fprintf(stderr, "nxagentInitPointerMap: Going to retrieve the "
"pointer map from remote display.\n");
fprintf(stderr, "%s: Going to retrieve the "
"pointer map from remote display.\n", __func__);
#endif
int numButtons = XGetPointerMapping(nxagentDisplay, pointerMap, MAXBUTTONS);
/*
* Computing revers pointer map.
* Computing reverse pointer map.
*/
for (int i = 1; i <= numButtons; i++)
......
......@@ -666,7 +666,7 @@ Bool nxagentReconnectSession(void)
}
/* Re-read keystrokes definitions in case the keystrokes file has
changed while being supended */
changed while being suspended */
nxagentInitKeystrokes(True);
#ifdef NX_DEBUG_INPUT
......
......@@ -285,7 +285,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
if (!toplevel)
{
/* FIXME: Is this too much and we and simply return here? */
/* FIXME: Is this too much and we should simply return here? */
FatalError("nxagentRootlessRestack: malloc() failed.");
}
......
......@@ -407,7 +407,7 @@ Bool nxagentCreateWindow(WindowPtr pWin)
if (nxagentReportPrivateWindowIds)
{
fprintf (stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x]\n", nxagentWindowPriv(pWin)->window);
fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id);
}
#ifdef TEST
fprintf(stderr, "nxagentCreateWindow: Created new window with id [0x%x].\n",
......@@ -1228,8 +1228,8 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift)
/*
* This will update the window on the real X server by calling
* XConfigureWindow()/XMapWindow()/XLowerWindow()/XRaiseWindow()
* mask definesthe values that need to be updated, see e.g
* XConfigureWindow()/XMapWindow()/XLowerWindow()/XRaiseWindow().
* mask defines the values that need to be updated, see e.g.
* man XConfigureWindow.
*
* In addition to the bit flags known to Xorg it uses these
......@@ -1281,35 +1281,30 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
if (mask & CWX)
{
valuemask |= CWX;
values.x = nxagentWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
}
if (mask & CWY)
{
valuemask |= CWY;
values.y = nxagentWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
}
if (mask & CWWidth)
{
valuemask |= CWWidth;
values.width = nxagentWindowPriv(pWin)->width = pWin->drawable.width;
}
if (mask & CWHeight)
{
valuemask |= CWHeight;
values.height = nxagentWindowPriv(pWin)->height = pWin->drawable.height;
}
if (mask & CWBorderWidth)
{
valuemask |= CWBorderWidth;
values.border_width = nxagentWindowPriv(pWin)->borderWidth =
pWin->borderWidth;
}
......@@ -3037,7 +3032,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
if (nxagentReportPrivateWindowIds)
{
fprintf (stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x]\n", nxagentWindowPriv(pWin)->window);
fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id);
}
#ifdef TEST
fprintf(stderr, "nxagentReconnectWindow: Created new window with id [0x%x].\n",
......@@ -3447,10 +3442,7 @@ void nxagentSetTopLevelEventMask(WindowPtr pWin)
*/
void nxagentFlushConfigureWindow(void)
{
ConfiguredWindowStruct *index;
XWindowChanges changes;
index = nxagentConfiguredWindowList;
ConfiguredWindowStruct *index = nxagentConfiguredWindowList;
while (index)
{
......@@ -3493,8 +3485,10 @@ void nxagentFlushConfigureWindow(void)
if (nxagentExposeQueue.exposures[i].synchronize == 1)
{
changes.x = nxagentExposeQueue.exposures[i].serial;
changes.y = -2;
XWindowChanges changes = {
.x = nxagentExposeQueue.exposures[i].serial,
.y = -2
};
#ifdef DEBUG
fprintf(stderr, "nxagentFlushConfigureWindow: Sending synch ConfigureWindow for "
......
......@@ -265,7 +265,6 @@ typedef struct _Client *ClientPtr; /* also in misc.h */
typedef struct _WorkQueue *WorkQueuePtr;
extern ClientPtr requestingClient;
extern ClientPtr *clients;
extern ClientPtr serverClient;
extern int currentMaxClients;
......
......@@ -743,7 +743,7 @@ typedef struct _ScreenInfo {
int arraySize;
int numScreens;
ScreenPtr screens[MAXSCREENS];
int numVideoScreens;
int unused;
} ScreenInfo;
extern ScreenInfo screenInfo;
......
......@@ -56,11 +56,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkbstr.h"
#include "inputstr.h"
#ifdef NXAGENT_SERVER
extern char *_NXGetXkbBasePath(const char *path);
extern char *_NXGetXkbCompPath(const char *path);
#endif
typedef struct _XkbInterest {
DeviceIntPtr dev;
ClientPtr client;
......@@ -253,6 +248,7 @@ typedef struct
/***====================================================================***/
extern void XkbFreePrivates(DeviceIntPtr);
/***====================================================================***/
......
......@@ -57,7 +57,6 @@ implied warranty.
#include "pixmapstr.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "dixstruct.h" /* For requestingClient */
#include "mi.h"
#include "mibstorest.h"
......
......@@ -1127,7 +1127,7 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
{
int xorgi = 0, yorgi = 0;
int lw;
PolyEdgeRec lefts[2], rights[2];
PolyEdgeRec lefts[4], rights[4];
int lefty, righty, topy, bottomy;
PolyEdgePtr left, right;
PolyEdgePtr top, bottom;
......@@ -1311,7 +1311,7 @@ miWideSegment (
PolyEdgePtr top, bottom;
int lefty, righty, topy, bottomy;
int signdx;
PolyEdgeRec lefts[2], rights[2];
PolyEdgeRec lefts[4], rights[4];
LineFacePtr tface;
int lw = pGC->lineWidth;
......@@ -1713,7 +1713,7 @@ miWideDashSegment (
PolyVertexRec vertices[4];
PolyVertexRec saveRight, saveBottom;
PolySlopeRec slopes[4];
PolyEdgeRec left[2], right[2];
PolyEdgeRec left[4], right[4];
LineFaceRec lcapFace, rcapFace;
int nleft, nright;
int h;
......
......@@ -82,9 +82,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <nx-X11/Xos.h> /* for strings, fcntl, time */
#include <errno.h>
#include <stdio.h>
......@@ -105,22 +102,9 @@ static unsigned long startTimeInMillis;
#endif
#ifdef WIN32
/* Error codes from windows sockets differ from fileio error codes */
#undef EINTR
#define EINTR WSAEINTR
#undef EINVAL
#define EINVAL WSAEINVAL
#undef EBADF
#define EBADF WSAENOTSOCK
/* Windows select does not set errno. Use GetErrno as wrapper for
WSAGetLastError */
#define GetErrno WSAGetLastError
#else
/* This is just a fallback to errno to hide the differences between unix and
Windows in the code */
#define GetErrno() errno
#endif
/* modifications by raphael */
int
......@@ -484,30 +468,12 @@ WaitForSomething(int *pClientsReady)
if (XFD_ANYSET (&clientsReadable))
break;
#ifdef WIN32
/* Windows keyboard and mouse events are added to the input queue
in Block- and WakupHandlers. There is no device to check if
data is ready. So check here if new input is available */
#if defined(NX_TRANS_SOCKET)
if (*checkForInput[0] != *checkForInput[1])
{
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
fprintf(stderr, "WaitForSomething: Returning 0 because of (*checkForInput[0] != *checkForInput[1]).\n");
#endif
return 0;
}
#else
if (*checkForInput[0] != *checkForInput[1])
return 0;
#endif
#endif
}
}
nready = 0;
if (XFD_ANYSET (&clientsReadable))
{
#ifndef WIN32
for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
{
while (clientsReadable.fds_bits[i])
......@@ -517,23 +483,9 @@ WaitForSomething(int *pClientsReady)
curclient = ffs (clientsReadable.fds_bits[i]) - 1;
client_index = /* raphael: modified */
ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
#else
fd_set savedClientsReadable;
XFD_COPYSET(&clientsReadable, &savedClientsReadable);
for (i = 0; i < XFD_SETCOUNT(&savedClientsReadable); i++)
{
int client_priority, client_index;
curclient = XFD_FD(&savedClientsReadable, i);
client_index = GetConnectionTranslation(curclient);
#endif
pClientsReady[nready++] = client_index;
#ifndef WIN32
clientsReadable.fds_bits[i] &= ~(((fd_mask)1L) << curclient);
}
#else
FD_CLR(curclient, &clientsReadable);
#endif
}
}
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
......
......@@ -58,9 +58,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <stdio.h>
#include <stdlib.h>
......@@ -75,14 +72,13 @@ SOFTWARE.
#include "site.h"
#include <errno.h>
#include <sys/types.h>
#ifndef WIN32
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <ctype.h>
#if defined(TCPCONN) || defined(ISC) || defined(__SCO__)
#if defined(TCPCONN)
#include <netinet/in.h>
#endif /* TCPCONN || ISC || __SCO__ */
#endif /* TCPCONN */
#ifdef HAS_GETPEERUCRED
# include <ucred.h>
......@@ -91,15 +87,11 @@ SOFTWARE.
# endif
#endif
#if defined(SVR4) || (defined(SYSV) && defined(i386)) || defined(__GNU__)
#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__)
# include <sys/utsname.h>
#endif
#if defined(SYSV) && defined(i386)
#if defined(SYSV) && defined(__i386__)
# include <sys/stream.h>
# ifdef ISC
# include <sys/stropts.h>
# include <sys/sioctl.h>
# endif /* ISC */
#endif
#ifdef __GNU__
#undef SIOCGIFCONF
......@@ -145,7 +137,6 @@ SOFTWARE.
/* #endif */
#endif
#endif /* WIN32 */
#ifndef PATH_MAX
#include <sys/param.h>
......@@ -158,10 +149,6 @@ SOFTWARE.
#endif
#endif
#ifdef __SCO__
/* The system defined value is wrong. MAXPATHLEN is set in sco5.cf. */
#undef PATH_MAX
#endif
#define X_INCLUDE_NETDB_H
#include <nx-X11/Xos_r.h>
......@@ -282,7 +269,7 @@ AccessUsingXdmcp (void)
}
#if ((defined(SVR4) && !defined(SCO325) && !defined(sun) && !defined(NCR)) || defined(ISC)) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF)
#if ((defined(SVR4) && !defined(SCO325) && !defined(sun) && !defined(NCR))) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF)
/* Deal with different SIOCGIFCONF ioctl semantics on these OSs */
......@@ -299,17 +286,6 @@ ifioctl (int fd, int cmd, char *arg)
{
ioc.ic_len = ((struct ifconf *) arg)->ifc_len;
ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf;
#ifdef ISC
/* SIOCGIFCONF is somewhat brain damaged on ISC. The argument
* buffer must contain the ifconf structure as header. Ifc_req
* is also not a pointer but a one element array of ifreq
* structures. On return this array is extended by enough
* ifreq fields to hold all interfaces. The return buffer length
* is placed in the buffer header.
*/
((struct ifconf *) ioc.ic_dp)->ifc_len =
ioc.ic_len - sizeof(struct ifconf);
#endif
}
else
{
......@@ -321,19 +297,11 @@ ifioctl (int fd, int cmd, char *arg)
#ifdef SVR4
((struct ifconf *) arg)->ifc_len = ioc.ic_len;
#endif
#ifdef ISC
{
((struct ifconf *) arg)->ifc_len =
((struct ifconf *)ioc.ic_dp)->ifc_len;
((struct ifconf *) arg)->ifc_buf =
(caddr_t)((struct ifconf *)ioc.ic_dp)->ifc_req;
}
#endif
return(ret);
}
#else /* Case sun, SCO325 NCR and others */
#define ifioctl ioctl
#endif /* ((SVR4 && !sun !SCO325 !NCR) || ISC) && SIOCGIFCONF */
#endif /* ((SVR4 && !sun !SCO325 !NCR)) && SIOCGIFCONF */
/*
* DefineSelf (fd):
......@@ -501,13 +469,7 @@ DefineSelf (int fd)
int family;
register HOST *host;
#ifndef WIN32
struct utsname name;
#else
struct {
char nodename[512];
} name;
#endif
register struct hostent *hp;
......@@ -531,11 +493,7 @@ DefineSelf (int fd)
* uname() lets me access to the whole string (it smashes release, you
* see), whereas gethostname() kindly truncates it for me.
*/
#ifndef WIN32
uname(&name);
#else
gethostname(name.nodename, sizeof(name.nodename));
#endif
hp = _XGethostbyname(name.nodename, hparams);
if (hp != NULL)
......@@ -723,11 +681,7 @@ DefineSelf (int fd)
ifc.ifc_buf = bufptr;
#define IFC_IOCTL_REQ SIOCGIFCONF
#ifdef ISC
#define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf
#else
#define IFC_IFC_REQ ifc.ifc_req
#endif /* ISC */
#define IFC_IFC_LEN ifc.ifc_len
#define IFR_IFR_ADDR ifr->ifr_addr
#define IFR_IFR_NAME ifr->ifr_name
......@@ -1723,10 +1677,6 @@ ConvertAddr (
return FamilyLocal;
#if defined(TCPCONN)
case AF_INET:
#ifdef WIN32
if (16777343 == *(long*)&((struct sockaddr_in *) saddr)->sin_addr)
return FamilyLocal;
#endif
*len = sizeof (struct in_addr);
*addr = (void *) &(((struct sockaddr_in *) saddr)->sin_addr);
return FamilyInternet;
......
......@@ -71,9 +71,6 @@ from The Open Group.
#define _SECURITY_SERVER
# include <nx-X11/extensions/security.h>
#endif
#ifdef WIN32
#include <nx-X11/Xw32defs.h>
#endif
struct protocol {
unsigned short name_length;
......
......@@ -65,9 +65,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#define XSERV_t
......@@ -81,7 +78,6 @@ SOFTWARE.
#include <stdlib.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/socket.h>
#if defined(TCPCONN)
......@@ -104,7 +100,6 @@ SOFTWARE.
#endif
#include <sys/uio.h>
#endif /* WIN32 */
#include "misc.h"
#include "osdep.h"
#include <nx-X11/Xpoll.h>
......@@ -155,98 +150,7 @@ int GrabInProgress = 0;
static void
QueueNewConnections(int curconn, int ready, void *data);
#if !defined(WIN32)
int *ConnectionTranslation = NULL;
#else
/*
* On NT fds are not between 0 and MAXSOCKS, they are unrelated, and there is
* not even a known maximum value, so use something quite arbitrary for now.
* Do storage is a hash table of size 256. Collisions are handled in a linked
* list.
*/
#undef MAXSOCKS
#define MAXSOCKS 500
#undef MAXSELECT
#define MAXSELECT 500
#define MAXFD 500
struct _ct_node {
struct _ct_node *next;
int key;
int value;
};
struct _ct_node *ct_head[256];
void InitConnectionTranslation(void)
{
bzero(ct_head, sizeof(ct_head));
}
int GetConnectionTranslation(int conn)
{
struct _ct_node *node = ct_head[conn & 0xff];
while (node != NULL)
{
if (node->key == conn)
return node->value;
node = node->next;
}
return 0;
}
void SetConnectionTranslation(int conn, int client)
{
struct _ct_node **node = ct_head + (conn & 0xff);
if (client == 0) /* remove entry */
{
while (*node != NULL)
{
if ((*node)->key == conn)
{
struct _ct_node *temp = *node;
*node = (*node)->next;
free(temp);
return;
}
node = &((*node)->next);
}
return;
} else
{
while (*node != NULL)
{
if ((*node)->key == conn)
{
(*node)->value = client;
return;
}
node = &((*node)->next);
}
*node = (struct _ct_node*)malloc(sizeof(struct _ct_node));
(*node)->next = NULL;
(*node)->key = conn;
(*node)->value = client;
return;
}
}
void ClearConnectionTranslation(void)
{
unsigned i;
for (i = 0; i < 256; i++)
{
struct _ct_node *node = ct_head[i];
while (node != NULL)
{
struct _ct_node *temp = node;
node = node->next;
free(temp);
}
}
}
#endif
XtransConnInfo *ListenTransConns = NULL;
int *ListenTransFds = NULL;
......@@ -318,11 +222,7 @@ InitConnectionLimits(void)
ErrorF("InitConnectionLimits: MaxClients = %d\n", MaxClients);
#endif
#if !defined(WIN32)
ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
#else
InitConnectionTranslation();
#endif
}
/*
......@@ -341,7 +241,6 @@ InitConnectionLimits(void)
static void
InitParentProcess(void)
{
#if !defined(WIN32)
OsSigHandlerPtr handler;
handler = OsSignal (SIGUSR1, SIG_IGN);
if ( handler == SIG_IGN)
......@@ -357,13 +256,11 @@ InitParentProcess(void)
*/
ParentProcess = GetPPID (ParentProcess);
#endif /* __UNIXOS2__ */
#endif
}
void
NotifyParentProcess(void)
{
#if !defined(WIN32)
if (displayfd >= 0) {
#ifdef NXAGENT_SERVER
if (displayfd == STDERR_FILENO)
......@@ -385,7 +282,6 @@ NotifyParentProcess(void)
kill (ParentProcess, SIGUSR1);
}
}
#endif
}
static Bool
......@@ -416,11 +312,7 @@ CreateWellKnownSockets(void)
FD_ZERO(&LastSelectMask);
FD_ZERO(&ClientsWithInput);
#if !defined(WIN32)
for (i=0; i<MaxClients; i++) ConnectionTranslation[i] = 0;
#else
ClearConnectionTranslation();
#endif
/* display is initialized to "0" by main(). It is then set to the display
* number if specified on the command line. */
......@@ -473,10 +365,8 @@ CreateWellKnownSockets(void)
if (ListenTransCount == 0 && !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);
#endif
OsSignal (SIGINT, GiveUp);
OsSignal (SIGTERM, GiveUp);
ResetHosts(display);
......@@ -802,11 +692,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
ClientPtr client;
if (
#ifndef WIN32
fd >= lastfdesc
#else
XFD_SETCOUNT(&AllClients) >= MaxClients
#endif
)
return NullClient;
oc = (OsCommPtr)malloc(sizeof(OsCommRec));
......@@ -825,11 +711,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
}
client->local = ComputeLocalClient(client);
{
#if !defined(WIN32)
ConnectionTranslation[fd] = client->index;
#else
SetConnectionTranslation(fd, client->index);
#endif
if (GrabInProgress)
{
FD_SET(fd, &SavedAllClients);
......@@ -893,11 +775,7 @@ EstablishNewConnections(ClientPtr clientUnused, void * closure)
if (newconn < lastfdesc) {
int clientid;
#if !defined(WIN32)
clientid = ConnectionTranslation[newconn];
#else
clientid = GetConnectionTranslation(newconn);
#endif
if (clientid && (client = clients[clientid]))
CloseDownClient(client);
}
......@@ -990,11 +868,7 @@ CloseDownFileDescriptor(OsCommPtr oc)
}
FreeOsBuffers(oc);
free(oc);
#ifndef WIN32
ConnectionTranslation[connection] = 0;
#else
SetConnectionTranslation(connection, 0);
#endif
FD_CLR(connection, &AllSockets);
FD_CLR(connection, &AllClients);
FD_CLR(connection, &ClientsWithInput);
......@@ -1023,22 +897,16 @@ CloseDownFileDescriptor(OsCommPtr oc)
void
CheckConnections(void)
{
#ifndef WIN32
fd_mask mask;
#endif
fd_set tmask;
int curclient, curoff;
int i;
struct timeval notime;
int r;
#ifdef WIN32
fd_set savedAllClients;
#endif
notime.tv_sec = 0;
notime.tv_usec = 0;
#ifndef WIN32
for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
{
mask = AllClients.fds_bits[i];
......@@ -1054,18 +922,6 @@ CheckConnections(void)
mask &= ~((fd_mask)1 << curoff);
}
}
#else
XFD_COPYSET(&AllClients, &savedAllClients);
for (i = 0; i < XFD_SETCOUNT(&savedAllClients); i++)
{
curclient = XFD_FD(&savedAllClients, i);
FD_ZERO(&tmask);
FD_SET(curclient, &tmask);
r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
if (r < 0)
CloseDownClient(clients[GetConnectionTranslation(curclient)]);
}
#endif
}
......
......@@ -60,9 +60,6 @@ SOFTWARE.
#if 0
#define DEBUG_COMMUNICATION
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#endif
#include <stdio.h>
#define XSERV_t
#define TRANS_SERVER
......@@ -70,9 +67,7 @@ SOFTWARE.
#include <nx-X11/Xtrans/Xtrans.h>
#include <nx-X11/Xmd.h>
#include <errno.h>
#if !defined(WIN32)
#include <sys/uio.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "os.h"
......@@ -88,7 +83,6 @@ CallbackListPtr FlushCallback;
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
*/
#ifndef WIN32
#if defined(EAGAIN) && defined(EWOULDBLOCK)
#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
#else
......@@ -98,9 +92,6 @@ CallbackListPtr FlushCallback;
#define ETEST(err) (err == EWOULDBLOCK)
#endif
#endif
#else /* WIN32 The socket errorcodes differ from the normal errors*/
#define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK)
#endif
Bool CriticalOutputPending;
int timesThisConnection = 0;
......@@ -358,7 +349,7 @@ ReadRequestFromClient(ClientPtr client)
{
if ((result < 0) && ETEST(errno))
{
#if defined(SVR4) && defined(i386) && !defined(sun)
#if defined(SVR4) && defined(__i386__) && !defined(sun)
if (0)
#endif
{
......@@ -777,9 +768,6 @@ FlushAllOutput(void)
OsCommPtr oc;
register ClientPtr client;
Bool newoutput = NewOutputPending;
#if defined(WIN32)
fd_set newOutputPending;
#endif
if (!newoutput)
return;
......@@ -792,7 +780,6 @@ FlushAllOutput(void)
CriticalOutputPending = FALSE;
NewOutputPending = FALSE;
#ifndef WIN32
for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
{
mask = OutputPending.fds_bits[ base ];
......@@ -817,28 +804,6 @@ FlushAllOutput(void)
(void)FlushClient(client, oc, (char *)NULL, 0);
}
}
#else /* WIN32 */
FD_ZERO(&newOutputPending);
for (base = 0; base < XFD_SETCOUNT(&OutputPending); base++)
{
index = XFD_FD(&OutputPending, base);
if ((index = GetConnectionTranslation(index)) == 0)
continue;
client = clients[index];
if (client->clientGone)
continue;
oc = (OsCommPtr)client->osPrivate;
if (
FD_ISSET(oc->fd, &ClientsWithInput))
{
FD_SET(oc->fd, &newOutputPending); /* set the bit again */
NewOutputPending = TRUE;
}
else
(void)FlushClient(client, oc, (char *)NULL, 0);
}
XFD_COPYSET(&newOutputPending, &OutputPending);
#endif /* WIN32 */
}
void
......
......@@ -117,10 +117,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include "site.h"
#include "opaque.h"
#ifdef WIN32
#include <process.h>
#define getpid(x) _getpid(x)
#endif
#ifdef NX_TRANS_SOCKET
......@@ -268,9 +264,7 @@ LogInit(const char *fname, const char *backup)
if (saveBuffer && bufferSize > 0) {
fwrite(saveBuffer, bufferPos, 1, logFile);
fflush(logFile);
#ifndef WIN32
fsync(fileno(logFile));
#endif
}
}
......@@ -398,10 +392,8 @@ LogVWrite(int verb, const char *f, va_list args)
fwrite(tmpBuffer, len, 1, logFile);
if (logFlush) {
fflush(logFile);
#ifndef WIN32
if (logSync)
fsync(fileno(logFile));
#endif
}
} else if (needBuffer) {
/*
......@@ -730,11 +722,9 @@ ErrorF(const char * f, ...)
#ifndef NEED_STRERROR
#ifdef SYSV
#if !defined(ISC) || defined(ISC202) || defined(ISC22)
#define NEED_STRERROR
#endif
#endif
#endif
#if defined(NEED_STRERROR) && !defined(strerror)
extern char *sys_errlist[];
......
......@@ -69,11 +69,6 @@ SOFTWARE.
#undef _POSIX_SOURCE
#endif
#else /* X_NOT_POSIX */
#ifdef WIN32
#define _POSIX_
#include <limits.h>
#undef _POSIX_
#endif
#endif /* X_NOT_POSIX */
#ifndef OPEN_MAX
......@@ -85,11 +80,7 @@ SOFTWARE.
#if defined(NOFILE) && !defined(NOFILES_MAX)
#define OPEN_MAX NOFILE
#else
#if !defined(WIN32)
#define OPEN_MAX NOFILES_MAX
#else
#define OPEN_MAX 256
#endif
#endif
#endif
#endif
......@@ -213,13 +204,7 @@ extern fd_set ClientsWriteBlocked;
extern fd_set OutputPending;
extern fd_set IgnoredClientsWithInput;
#ifndef WIN32
extern int *ConnectionTranslation;
#else
extern int GetConnectionTranslation(int conn);
extern void SetConnectionTranslation(int conn, int client);
extern void ClearConnectionTranslation();
#endif
extern Bool NewOutputPending;
extern Bool AnyWritesPending;
......@@ -234,9 +219,6 @@ extern OsCommPtr AvailableInput;
extern WorkQueuePtr workQueue;
/* added by raphael */
#ifdef WIN32
typedef long int fd_mask;
#endif
#define ffs mffs
extern int mffs(fd_mask);
......
......@@ -65,11 +65,8 @@ SOFTWARE.
#endif
#endif
#if defined(__SCO__)
#include <sys/wait.h>
#endif
#if !defined(SYSV) && !defined(WIN32)
#if !defined(SYSV)
#include <sys/resource.h>
#endif
......@@ -104,7 +101,7 @@ OsInit(void)
InitNotifyFds();
#if !defined(__SCO__) && !defined(__CYGWIN__) && !defined(__UNIXWARE__)
#if !defined(__CYGWIN__)
fclose(stdin);
fclose(stdout);
#endif
......@@ -134,7 +131,7 @@ OsInit(void)
dup2 (fileno (err), 2);
fclose (err);
}
#if defined(SYSV) || defined(SVR4) || defined(WIN32) || defined(__CYGWIN__)
#if defined(SYSV) || defined(SVR4) || defined(__CYGWIN__)
{
static char buf[BUFSIZ];
setvbuf (stderr, buf, _IOLBF, BUFSIZ);
......@@ -148,7 +145,7 @@ OsInit(void)
if (getpgrp () == 0)
setpgid (0, 0);
#else
#if !defined(SYSV) && !defined(WIN32)
#if !defined(SYSV)
if (getpgrp (0) == 0)
setpgrp (0, getpid ());
#endif
......
......@@ -83,9 +83,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <signal.h>
#endif
#if defined(WIN32) && !defined(__CYGWIN__)
#include <nx-X11/Xwinsock.h>
#endif
#include <nx-X11/Xos.h>
#include <stdio.h>
#include "misc.h"
......@@ -115,10 +112,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#undef _POSIX_SOURCE
#endif
#endif
#ifndef WIN32
#include <sys/wait.h>
#endif
#if !defined(SYSV) && !defined(WIN32)
#if !defined(SYSV)
#include <sys/resource.h>
#endif
#include <time.h>
......@@ -132,9 +127,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <stdlib.h> /* for malloc() */
#if defined(TCPCONN)
# ifndef WIN32
# include <netdb.h>
# endif
#endif
#include "opaque.h"
......@@ -910,7 +903,7 @@ ProcessCommandLine(int argc, char *argv[])
#ifdef SERVER_LOCK
else if ( strcmp ( argv[i], "-nolock") == 0)
{
#if !defined(WIN32) && !defined(__CYGWIN__)
#if !defined(__CYGWIN__)
if (getuid() != 0)
ErrorF("Warning: the -nolock option can only be used by root\n");
else
......@@ -1230,7 +1223,7 @@ ExpandCommandLine(int *pargc, char ***pargv)
{
int i;
#if !defined(WIN32) && !defined(__CYGWIN__)
#if !defined(__CYGWIN__)
if (getuid() != geteuid())
return;
#endif
......@@ -1566,7 +1559,6 @@ OsReleaseSignals (void)
#endif
}
#if !defined(WIN32)
/*
* "safer" versions of system(3), popen(3) and pclose(3) which give up
* all privs before running a command.
......@@ -1948,7 +1940,6 @@ Fclose(void * iop)
#endif
}
#endif /* !WIN32 */
/*
......@@ -1981,11 +1972,7 @@ Fclose(void * iop)
/* Check args and env only if running setuid (euid == 0 && euid != uid) ? */
#ifndef CHECK_EUID
#ifndef WIN32
#define CHECK_EUID 1
#else
#define CHECK_EUID 0
#endif
#endif
/*
......@@ -2232,52 +2219,3 @@ CheckUserAuthorization(void)
#endif
}
#ifdef __SCO__
#include <fcntl.h>
static void
lockit (int fd, short what)
{
struct flock lck;
lck.l_whence = 0;
lck.l_start = 0;
lck.l_len = 1;
lck.l_type = what;
(void)fcntl (fd, F_SETLKW, &lck);
}
/* SCO OpenServer 5 lacks pread/pwrite. Emulate them. */
ssize_t
pread (int fd, void *buf, size_t nbytes, off_t offset)
{
off_t saved;
ssize_t ret;
lockit (fd, F_RDLCK);
saved = lseek (fd, 0, SEEK_CUR);
lseek (fd, offset, SEEK_SET);
ret = read (fd, buf, nbytes);
lseek (fd, saved, SEEK_SET);
lockit (fd, F_UNLCK);
return ret;
}
ssize_t
pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
{
off_t saved;
ssize_t ret;
lockit (fd, F_WRLCK);
saved = lseek (fd, 0, SEEK_CUR);
lseek (fd, offset, SEEK_SET);
ret = write (fd, buf, nbytes);
lseek (fd, saved, SEEK_SET);
lockit (fd, F_UNLCK);
return ret;
}
#endif /* __SCO__ */
......@@ -17,22 +17,13 @@
#include <dix-config.h>
#endif
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
#define XSERV_t
#define TRANS_SERVER
#define TRANS_REOPEN
#include <nx-X11/Xtrans/Xtrans.h>
#endif
#include <nx-X11/Xos.h>
#if !defined(WIN32)
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#endif
#include <stdio.h>
#include <stdlib.h>
......@@ -1507,9 +1498,6 @@ get_addr_by_name(
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
#endif
#if defined(WIN32) && defined(TCPCONN)
_XSERVTransWSAStartup();
#endif
if (!(hep = _XGethostbyname(namestr, hparams)))
{
FatalError("Xserver: %s unknown host: %s\n", argtype, namestr);
......
......@@ -84,7 +84,7 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
void
XkbFreePrivates(DeviceIntPtr device)
{
if (device &&
if (device &&
device->devPrivates &&
device->nPrivates > 0 &&
xkbDevicePrivateIndex != -1 &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment