diff options
Diffstat (limited to 'nx-X11/programs/Xserver')
66 files changed, 2743 insertions, 3379 deletions
diff --git a/nx-X11/programs/Xserver/Xext/Imakefile b/nx-X11/programs/Xserver/Xext/Imakefile index 8198e302c..540ac80fa 100644 --- a/nx-X11/programs/Xserver/Xext/Imakefile +++ b/nx-X11/programs/Xserver/Xext/Imakefile @@ -65,8 +65,8 @@ XF86BIGFOBJS = xf86bigfont.o PNRXINCLUDES = -I../mi -I../render #endif #if BuildDPMS - DPMSSRCS = dpms.c - DPMSOBJS = dpms.o + DPMSSRCS = dpms.c dpmsstubs.c + DPMSOBJS = dpms.o dpmsstubs.o #endif SRCS = shape.c $(SHMSRCS) xcmisc.c\ diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c index 65c43f6b4..671e31e20 100644 --- a/nx-X11/programs/Xserver/Xext/saver.c +++ b/nx-X11/programs/Xserver/Xext/saver.c @@ -148,7 +148,7 @@ static int ScreenSaverFreeSuspend( * entry from the per-screen queue. */ -static RESTYPE EventType; /* resource type for event masks */ +static RESTYPE SaverEventType; /* resource type for event masks */ typedef struct _ScreenSaverEvent *ScreenSaverEventPtr; @@ -256,7 +256,7 @@ ScreenSaverExtensionInit(void) ScreenPtr pScreen; AttrType = CreateNewResourceType(ScreenSaverFreeAttr); - EventType = CreateNewResourceType(ScreenSaverFreeEvents); + SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents); SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend); ScreenPrivateIndex = AllocateScreenPrivateIndex (); @@ -265,7 +265,7 @@ ScreenSaverExtensionInit(void) pScreen = screenInfo.screens[i]; SetScreenPrivate (pScreen, NULL); } - if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 && + if (AttrType && SaverEventType && SuspendType && ScreenPrivateIndex != -1 && (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, ProcScreenSaverDispatch, SProcScreenSaverDispatch, ScreenSaverResetProc, StandardMinorOpcode))) @@ -360,7 +360,7 @@ setEventMask (pScreen, client, mask) break; if (mask == 0) { - FreeResource (pEv->resource, EventType); + FreeResource (pEv->resource, SaverEventType); *pPrev = pEv->next; free (pEv); CheckScreenPrivate (pScreen); @@ -380,7 +380,7 @@ setEventMask (pScreen, client, mask) pEv->client = client; pEv->screen = pScreen; pEv->resource = FakeClientID (client->index); - if (!AddResource (pEv->resource, EventType, (void *) pEv)) + if (!AddResource (pEv->resource, SaverEventType, (void *) pEv)) return FALSE; } pEv->mask = mask; @@ -642,10 +642,10 @@ CreateSaverWindow (pScreen) FreeResource (pWin->drawable.id, RT_NONE); return FALSE; } + pAttr->pCursor->refcnt++; if (pWin->optional->cursor) FreeCursor (pWin->optional->cursor, (Cursor)0); pWin->optional->cursor = pAttr->pCursor; - pAttr->pCursor->refcnt++; pWin->cursorIsNone = FALSE; CheckWindowOptionalNeed (pWin); mask |= CWCursor; diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile index d153805df..f141719f7 100644 --- a/nx-X11/programs/Xserver/dix/Imakefile +++ b/nx-X11/programs/Xserver/dix/Imakefile @@ -36,6 +36,7 @@ SRCS = \ devices.c \ dixutils.c \ extension.c \ + ffs.c \ gc.c \ globals.c \ grabs.c \ @@ -58,6 +59,7 @@ OBJS = \ devices.o \ dixutils.o \ extension.o \ + ffs.o \ gc.o \ globals.o \ grabs.o \ diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index 6d0d61a15..ac5d07281 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -209,7 +209,7 @@ UpdateCurrentTimeIf() systime.milliseconds = GetTimeInMillis(); if (systime.milliseconds < currentTime.milliseconds) systime.months++; - if (*checkForInput[0] == *checkForInput[1]) + if (CompareTimeStamps(systime, currentTime) == LATER) currentTime = systime; } @@ -3642,11 +3642,7 @@ void InitClient(ClientPtr client, int i, void * ospriv) } int -#ifdef NXAGENT_SERVER -xorg_InitClientPrivates(ClientPtr client) -#else InitClientPrivates(ClientPtr client) -#endif { register char *ptr; DevUnion *ppriv; @@ -3960,7 +3956,12 @@ DeleteClientFromAnySelections(ClientPtr client) SelectionInfoRec info; info.selection = &CurrentSelections[i]; +#ifdef NXAGENT_SERVER + /* bugfix missing in upstream before introduction of selection.c */ + info.kind = SelectionClientClose; +#else info.kind = SelectionWindowDestroy; +#endif CallCallbacks(&SelectionCallback, &info); } CurrentSelections[i].pWin = (WindowPtr)NULL; diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c index f1fa53f69..e3e90b163 100644 --- a/nx-X11/programs/Xserver/dix/dixfonts.c +++ b/nx-X11/programs/Xserver/dix/dixfonts.c @@ -1958,9 +1958,12 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths) return err; } -#ifndef NXAGENT_SERVER int +#ifdef NXAGENT_SERVER +xorg_SetDefaultFontPath(char *path) +#else SetDefaultFontPath(char *path) +#endif { char *temp_path, *start, @@ -2027,7 +2030,6 @@ SetDefaultFontPath(char *path) return err; } -#endif /* NXAGENT_SERVER */ unsigned char * GetFontPath(int *count, int *length) diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c index f46b53f7c..f0bfe1e65 100644 --- a/nx-X11/programs/Xserver/dix/property.c +++ b/nx-X11/programs/Xserver/dix/property.c @@ -257,7 +257,7 @@ ProcChangeProperty(ClientPtr client) int #ifdef NXAGENT_SERVER -Xorg_ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, +xorg_ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long len, void * value, Bool sendevent) #else diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index af6260d15..358d46519 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -63,7 +63,7 @@ Bool nxagentWMIsRunning; static void startWMDetection(void); -static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet); +static void nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet); #ifdef DEBUG static void nxagentPrintAtomMapInfo(char *message); @@ -73,6 +73,10 @@ static void nxagentPrintAtomMapInfo(char *message); Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; +/* + * Careful! Do not change indices here! Some of those are referenced + * at other places via nxagentAtoms[index]. + */ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = { "NX_IDENTITY", /* 0 */ @@ -95,9 +99,8 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = 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 */ - + because nomachine's nxclient and nxwin are using this + Atom/selection for communication with the nxagent Atom. */ "TARGETS", /* 6 */ /* used to request a list of supported data formats from the selection owner. Standard ICCCM Atom */ @@ -365,7 +368,7 @@ int nxagentQueryAtoms(ScreenPtr pScreen) typedef struct { Atom local; XlibAtom remote; - const char *string; + char *string; int length; } AtomMap; @@ -374,7 +377,7 @@ static unsigned int privAtomMapSize = 0; static unsigned int privLastAtom = 0; static void nxagentExpandCache(void); -static void nxagentWriteAtom(Atom, XlibAtom, const char*, Bool); +static void nxagentWriteAtom(Atom, XlibAtom, const char*); static AtomMap* nxagentFindAtomByRemoteValue(XlibAtom); static AtomMap* nxagentFindAtomByLocalValue(Atom); static AtomMap* nxagentFindAtomByName(char*, unsigned); @@ -396,31 +399,16 @@ static void nxagentExpandCache(void) * consequent allocation, then cache the atom-couple. */ -static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bool duplicate) +static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string) { - const char *s; - - /* - * We could remove this string duplication if we knew for sure that - * the server will not reset, since only at reset the dix layer - * frees all the atom names. - */ + char *s = strdup(string); - if (duplicate) - { - s = strdup(string); - - #ifdef WARNING - if (s == NULL) - { - fprintf(stderr, "nxagentWriteAtom: Malloc failed.\n"); - } - #endif - } - else + #ifdef WARNING + if (s == NULL) { - s = string; + fprintf(stderr, "nxagentWriteAtom: Malloc failed.\n"); } + #endif if (privLastAtom == privAtomMapSize) { @@ -436,11 +424,10 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bo } /* - * FIXME: We should clean up the atom map at nxagent reset, in order - * to cancel all the local atoms but still maintaining the Xserver - * values and the atom names. + * Clean up the atom map at nxagent reset, in order to cancel all the + * local atoms but still maintaining the Xserver values and the atom + * names. This is called from Dispatch() */ - void nxagentResetAtomMap(void) { nxagentPrintAtomMapInfo("nxagentResetAtomMap: Entering"); @@ -453,14 +440,24 @@ void nxagentResetAtomMap(void) nxagentPrintAtomMapInfo("nxagentResetAtomMap: Exiting"); } +void nxagentFreeAtomMap(void) +{ + for (unsigned int i = 0; i < privLastAtom; i++) + { + SAFE_free(privAtomMap[i].string); + } + + SAFE_free(privAtomMap); + privLastAtom = privAtomMapSize = 0; +} + /* * Init map. * Initializing the atomNameList all in one. */ -static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) +static void nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) { - unsigned int i; int list_size = count + privLastAtom; nxagentPrintAtomMapInfo("nxagentInitAtomMap: Entering"); @@ -470,16 +467,18 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) if ((atom_list == NULL) || (name_list == NULL)) { + SAFE_free(atom_list); + SAFE_free(name_list); FatalError("nxagentInitAtomMap: malloc failed\n"); } - for (i = 0; i < count; i++) + for (unsigned int i = 0; i < count; i++) { name_list[i] = atomNameList[i]; atom_list[i] = None; } - for (i = 0; i < privLastAtom; i++) + for (unsigned int i = 0; i < privLastAtom; i++) { name_list[count + i] = (char *)privAtomMap[i].string; atom_list[count + i] = None; @@ -501,10 +500,10 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) SAFE_free(atom_list); SAFE_free(name_list); - return 0; + return; } - for (i = 0; i < list_size; i++) + for (unsigned int i = 0; i < list_size; i++) { AtomMap *aMap = nxagentFindAtomByName(name_list[i], strlen(name_list[i])); @@ -514,7 +513,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) if (ValidAtom(local)) { - nxagentWriteAtom(local, atom_list[i], name_list[i], False); + nxagentWriteAtom(local, atom_list[i], name_list[i]); } else { @@ -544,7 +543,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) nxagentPrintAtomMapInfo("nxagentInitAtomMap: Exiting"); - return 1; + return; } /* @@ -609,17 +608,14 @@ static AtomMap* nxagentFindAtomByName(char *string, unsigned int length) * really asking to X-server and caching them. * FIXME: I don't really know if is better to allocate * an automatic variable like ret_value and write it, instead of make all - * these return!, perhaps this way the code is a little bit easyer to read. + * these return!, perhaps this way the code is a little bit easier to read. * I think this and the 2 .*Find.* are the only functions to look for performances. */ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) { - AtomMap *current; - /* - * Surely MakeAtom is faster than - * our nxagentFindAtomByName. + * Surely MakeAtom is faster than our nxagentFindAtomByName. */ Atom local = MakeAtom(string, length, Makeit); @@ -634,6 +630,8 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) return local; } + AtomMap *current; + if ((current = nxagentFindAtomByLocalValue(local))) { /* @@ -642,8 +640,7 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) return current->remote; } - - if ((current = nxagentFindAtomByName(string, length))) + else if ((current = nxagentFindAtomByName(string, length))) { /* * Found cached by name. @@ -655,26 +652,29 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) return current->remote; } - - /* - * We really have to ask the Xserver for it. - */ - + else { + /* + * We really have to ask the Xserver for it. + */ + + /* FIXME: why is Makeit inverted here? */ XlibAtom remote = XInternAtom(nxagentDisplay, string, !Makeit); if (remote == None) { #ifdef WARNING - fprintf(stderr, "nxagentMakeAtom: WARNING XInternAtom failed.\n"); + fprintf(stderr, "nxagentMakeAtom: WARNING XInternAtom(.., %s, ..) failed.\n", string); #endif return None; } + else + { + nxagentWriteAtom(local, remote, string); - nxagentWriteAtom(local, remote, string, True); - - return remote; + return remote; + } } } @@ -692,6 +692,7 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) return None; } + /* no mapping required for built-in atoms */ if (local <= XA_LAST_PREDEFINED) { #ifdef DEBUG @@ -704,32 +705,39 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) if (current) { - #ifdef TEST - fprintf(stderr, "%s: local [%d] -> remote [%d]\n", __func__, local, current->remote); + #ifdef DEBUG + if (current->string) + fprintf(stderr, "%s: local [%d] -> remote [%d (%s)]\n", __func__, local, current->remote, current->string); + else + fprintf(stderr, "%s: local [%d] -> remote [%d]\n", __func__, local, current->remote); #endif + return current->remote; } + else + { + const char *string = NameForAtom(local); - const char *string = NameForAtom(local); - - XlibAtom remote = XInternAtom(nxagentDisplay, string, False); + /* FIXME: why False? */ + XlibAtom remote = XInternAtom(nxagentDisplay, string, False); - if (remote == None) - { - #ifdef WARNING - fprintf(stderr, "nxagentLocalToRemoteAtom: WARNING XInternAtom failed.\n"); - #endif + if (remote == None) + { + #ifdef WARNING + fprintf(stderr, "nxagentLocalToRemoteAtom: WARNING XInternAtom failed.\n"); + #endif - return None; - } + return None; + } - nxagentWriteAtom(local, remote, string, True); + nxagentWriteAtom(local, remote, string); - #ifdef TEST - fprintf(stderr, "%s: local [%d] -> remote [%d (%s)]\n", __func__, local, remote, string); - #endif + #ifdef TEST + fprintf(stderr, "%s: local [%d (%s)] -> remote [%d]\n", __func__, local, string, remote); + #endif - return remote; + return remote; + } } Atom nxagentRemoteToLocalAtom(XlibAtom remote) @@ -742,6 +750,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) return None; } + /* no mapping required for built-in atoms */ if (remote <= XA_LAST_PREDEFINED) { #ifdef DEBUG @@ -773,41 +782,47 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) } #ifdef DEBUG - fprintf(stderr, "%s: remote [%d] -> local [%d]\n", __func__, remote, current->local); + if (current->string) + fprintf(stderr, "%s: remote [%d] -> local [%d (%s)]\n", __func__, remote, current->local, current->string); + else + fprintf(stderr, "%s: remote [%d] -> local [%d]\n", __func__, remote, current->local); #endif + return current->local; } - - char *string = XGetAtomName(nxagentDisplay, remote); - - if (string) + else { - Atom local = MakeAtom(string, strlen(string), True); + char *string = XGetAtomName(nxagentDisplay, remote); - if (!ValidAtom(local)) + if (string) { - #ifdef WARNING - fprintf(stderr, "%s: WARNING MakeAtom failed.\n", __func__); + Atom local = MakeAtom(string, strlen(string), True); + + if (!ValidAtom(local)) + { + #ifdef WARNING + fprintf(stderr, "%s: WARNING MakeAtom failed.\n", __func__); + #endif + + local = None; + } + + nxagentWriteAtom(local, remote, string); + + #ifdef TEST + fprintf(stderr, "%s: remote [%d (%s)] -> local [%d]\n", __func__, remote, string, local); #endif + SAFE_XFree(string); - local = None; + return local; } - nxagentWriteAtom(local, remote, string, True); - - #ifdef TEST - fprintf(stderr, "%s: remote [%d (%s)] -> local [%d]\n", __func__, remote, string, local); + #ifdef WARNING + fprintf(stderr, "%s: WARNING failed to get name from remote atom.\n", __func__); #endif - SAFE_XFree(string); - return local; + return None; } - - #ifdef WARNING - fprintf(stderr, "%s: WARNING failed to get name from remote atom.\n", __func__); - #endif - - return None; } #ifdef DEBUG diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index d04874f25..a39c53c07 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h @@ -37,22 +37,22 @@ extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; extern Bool nxagentWMIsRunning; /* - * Create the required atoms internally - * to the agent server. + * Create the required atoms internally to the agent server. */ void nxagentInitAtoms(); /* - * Query and create all the required atoms - * on the remote X server using a single - * round trip. + * Query and create all the required atoms on the remote X server + * using a single round trip. */ int nxagentQueryAtoms(ScreenPtr pScreen); void nxagentResetAtomMap(void); +void nxagentFreeAtomMap(void); + void nxagentWMDetect(void); #ifdef XlibAtom @@ -71,8 +71,7 @@ void nxagentWMDetect(void); XlibAtom nxagentMakeAtom(char *, unsigned, Bool); /* - * Converts local atoms in remote atoms and - * viceversa. + * Converts local atoms in remote atoms and viceversa. */ Atom nxagentRemoteToLocalAtom(XlibAtom); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 0b8331b79..83554e573 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -52,6 +52,7 @@ #include "Events.h" #include "Drawable.h" #include "Utils.h" +#include "Clipboard.h" /* * Need to include this after the stub definition of GC in Agent.h. @@ -68,6 +69,11 @@ #undef TEST #undef DEBUG +void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args); +static void initClientPrivates(ClientPtr client); +static void freeClientPrivates(ClientPtr client); +static void checkIfShadowAgent(ClientPtr client); + /* * Returns the last signal delivered to the process. */ @@ -106,13 +112,139 @@ int nxagentClientPrivateIndex; int nxagentShadowCounter = 0; -void nxagentInitClientPrivates(ClientPtr client) +/* + * For the serverclient the ClientStateCallback will not be called on + * shutdown resulting in memory allocated during initClientPrivates can + * not be freed automatically. So instead of allocating some memory we + * create a static string for the serverclient. + */ +static char *serverclientInfoString = "[0] (serverclient)"; + +/* + * called whenever the client state changes. See dixstruct.h for a + * list of known states. + */ + +#ifdef DEBUG +const char * getClientStateString(int state) +{ + switch (state) + { + case ClientStateInitial: { return "Initial"; break; }; + case ClientStateAuthenticating: { return "Authenticating"; break; }; + case ClientStateRunning: { return "Running"; break; }; + case ClientStateRetained: { return "Retained"; break; }; + case ClientStateGone: { return "Gone"; break; }; + case ClientStateCheckingSecurity: { return "CheckingSecurity"; break; }; + case ClientStateCheckedSecurity: { return "CheckedSecurity"; break; }; + default: { return "UNKNOWN"; break; }; + } +} +#endif + +void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args) +{ + ClientPtr client = ((NewClientInfoRec *)args)->client; + + #ifdef DEBUG + fprintf(stderr, "%s: client [%d] clientState [%s]\n", __func__, client->index, + getClientStateString(client->clientState)); + #endif + + switch(client->clientState) + { + case ClientStateInitial: + { + initClientPrivates(client); + break; + } + case ClientStateGone: + { + nxagentClearClipboard(client, NULL); + + /* + * Check if the client is a shadow nxagent. + */ + checkIfShadowAgent(client); + + freeClientPrivates(client); + break; + } + default: + { + break; + } + } +} + +static void initClientPrivates(ClientPtr client) +{ + #ifdef DEBUG + fprintf(stderr, "%s: called\n", __func__); + #endif + + if (nxagentClientPriv(client)) + { + nxagentClientPriv(client) -> clientState = 0; +#ifdef COUNT_CLIENT_BYTES + nxagentClientPriv(client) -> clientBytes = 0; +#endif + nxagentClientPriv(client) -> clientHint = UNKNOWN; + nxagentClientPriv(client) -> clientInfoString = NULL; + + char *s = NULL; + int size = 0; + + if (client->index == 0) + { + s = serverclientInfoString; + } + else + { +#ifdef CLIENTIDS + size = asprintf(&s, "[%d] (addr [%p] PID [%d] Cmd [%s])", + client->index, (void *)client, + GetClientPid(client), + GetClientCmdName(client)); +#else + size = asprintf(&s, "[%d] (addr [%p])", + client->index, (void *)client); +#endif + } + + if (size != -1) + { + #ifdef DEBUG + fprintf(stderr, "%s: clientInfoString: \"%s\"\n", __func__, s); + #endif + + nxagentClientPriv(client) -> clientInfoString = s; + } + else + { + #ifdef DEBUG + fprintf(stderr, "%s: could not alloc clientInfoString\n", __func__); + #endif + } + } +} + +static void freeClientPrivates(ClientPtr client) { + #ifdef DEBUG + fprintf(stderr, "%s: called\n", __func__); + #endif + if (nxagentClientPriv(client)) { nxagentClientPriv(client) -> clientState = 0; +#ifdef COUNT_CLIENT_BYTES nxagentClientPriv(client) -> clientBytes = 0; +#endif nxagentClientPriv(client) -> clientHint = UNKNOWN; + + if (client->index != 0) + SAFE_free(nxagentClientPriv(client) -> clientInfoString); } } @@ -128,7 +260,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) client -> index, validateString(NameForAtom(property)), validateString(data)); #endif - if (nxagentClientPriv(client) -> clientHint == UNKNOWN) + if (nxagentClientHint(client) == UNKNOWN) { if (property == XA_WM_CLASS) { @@ -151,7 +283,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) } } - if (nxagentClientPriv(client) -> clientHint == NXCLIENT_WINDOW) + if (nxagentClientHint(client) == NXCLIENT_WINDOW) { if (property == MakeAtom("WM_WINDOW_ROLE", 14, True) && strncmp(data, "msgBox", 6) == 0) @@ -173,7 +305,7 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) validateString(NameForAtom(property))); #endif - if (nxagentClientPriv(client) -> clientHint == UNKNOWN) + if (nxagentClientHint(client) == UNKNOWN) { if (strcmp(validateString(NameForAtom(property)), "_NX_SHADOW") == 0) { @@ -205,9 +337,9 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) } } -void nxagentCheckIfShadowAgent(ClientPtr client) +static void checkIfShadowAgent(ClientPtr client) { - if (nxagentClientPriv(client) -> clientHint == NXAGENT_SHADOW) + if (nxagentClientHint(client) == NXAGENT_SHADOW) { #ifdef TEST fprintf(stderr, "nxagentCheckIfShadowAgent: nxagentShadowCounter [%d].\n", @@ -284,6 +416,7 @@ void nxagentWakeupByReset(ClientPtr client) } } +#ifdef COUNT_CLIENT_BYTES if (client -> index < MAX_CONNECTIONS) { #ifdef TEST @@ -293,6 +426,7 @@ void nxagentWakeupByReset(ClientPtr client) nxagentClientBytes(client) = 0; } +#endif } /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.h b/nx-X11/programs/Xserver/hw/nxagent/Client.h index 8f4f503ba..a3e6e3cf3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.h @@ -49,7 +49,7 @@ typedef struct _PrivClientRec int clientState; long clientBytes; enum ClientHint clientHint; - + char *clientInfoString; } PrivClientRec; extern int nxagentClientPrivateIndex; @@ -57,13 +57,17 @@ extern int nxagentClientPrivateIndex; #define nxagentClientPriv(pClient) \ ((PrivClientRec *)((pClient)->devPrivates[nxagentClientPrivateIndex].ptr)) -void nxagentInitClientPrivates(ClientPtr); +extern void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args); + +#undef COUNT_CLIENT_BYTES +#ifdef COUNT_CLIENT_BYTES #define nxagentClientAddBytes(pClient, size) \ (nxagentClientPriv(pClient) -> clientBytes += (size)) #define nxagentClientBytes(pClient) \ (nxagentClientPriv(pClient) -> clientBytes) +#endif #define nxagentClientHint(pClient) \ (nxagentClientPriv(pClient) -> clientHint) @@ -71,9 +75,11 @@ void nxagentInitClientPrivates(ClientPtr); #define nxagentClientIsDialog(pClient) \ (nxagentClientHint(pClient) == NXCLIENT_DIALOG) +#define nxagentClientInfoString(pClient) \ + (nxagentClientPriv(pClient) -> clientInfoString) + /* - * The actual reason why the client - * is sleeping. + * The actual reason why the client is sleeping. */ #define SleepingBySplit 1 @@ -90,19 +96,15 @@ void nxagentGuessClientHint(ClientPtr, Atom, char*); void nxagentGuessShadowHint(ClientPtr, Atom); -void nxagentCheckIfShadowAgent(ClientPtr); - /* - * Suspend or restart the agent's - * client. + * Suspend or restart the agent's client. */ int nxagentSuspendBySplit(ClientPtr client); int nxagentWakeupBySplit(ClientPtr client); /* - * Wait until the given client is - * restarted. + * Wait until the given client is restarted. */ void nxagentWaitWakeupBySplit(ClientPtr client); @@ -119,8 +121,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable); void nxagentWakeupByReconnect(void); /* - * Reset the client state before - * closing it down. + * Reset the client state before closing it down. */ void nxagentWakeupByReset(ClientPtr client); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 1d5054fbb..d51f066a9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -96,7 +96,7 @@ typedef struct _SelectionOwner * external atom of the selection */ static SelectionOwner *lastSelectionOwner; -static XlibAtom nxagentLastRequestedSelection; +static XlibAtom serverLastRequestedSelection; #define IS_INTERNAL_OWNER(lsoindex) (lastSelectionOwner[lsoindex].client != NULL) @@ -169,7 +169,7 @@ static char szAgentCLIPBOARD[] = "CLIPBOARD"; */ #ifdef DEBUG -const char * GetClientSelectionStageString(int stage) +static const char * getClientSelectionStageString(int stage) { switch(stage) { @@ -181,21 +181,23 @@ const char * GetClientSelectionStageString(int stage) default: return("UNKNOWN!"); break;; } } -#define SetClientSelectionStage(stage) do {fprintf(stderr, "%s: Changing selection stage from [%s] to [%s]\n", __func__, GetClientSelectionStageString(lastClientStage), GetClientSelectionStageString(SelectionStage##stage)); lastClientStage = SelectionStage##stage;} while (0) -#define PrintClientSelectionStage() do {fprintf(stderr, "%s: Current selection stage [%s]\n", __func__, GetClientSelectionStageString(lastClientStage));} while (0) +#define setClientSelectionStage(stage) do {fprintf(stderr, "%s: Changing selection stage from [%s] to [%s]\n", __func__, getClientSelectionStageString(lastClientStage), getClientSelectionStageString(SelectionStage##stage)); lastClientStage = SelectionStage##stage;} while (0) +#define printClientSelectionStage() do {fprintf(stderr, "%s: Current selection stage [%s]\n", __func__, getClientSelectionStageString(lastClientStage));} while (0) #define WINDOWID(ptr) (ptr) ? (ptr->drawable.id) : 0 #define CLINDEX(clientptr) (clientptr) ? (clientptr->index) : -1 #else -#define SetClientSelectionStage(stage) do {lastClientStage = SelectionStage##stage;} while (0) -#define PrintClientSelectionStage() +#define setClientSelectionStage(stage) do {lastClientStage = SelectionStage##stage;} while (0) +#define printClientSelectionStage() +#endif +#ifdef DEBUG /* * see also nx-X11/lib/src/ErrDes.c * * We use our own version to avoid Xlib doing expensive calls. * FIXME: Must check if XGetErrorText() is really causing traffic over the wire. */ -const char * GetXErrorString(int code) +const char * getXErrorString(int code) { switch(code) { @@ -230,17 +232,34 @@ XFixesAgentInfoRec nxagentXFixesInfo = { -1, -1, -1, 0 }; extern Display *nxagentDisplay; -Bool nxagentValidServerTargets(XlibAtom target); +static Bool validServerTargets(XlibAtom target); static void endTransfer(Bool success); #define SELECTION_SUCCESS True #define SELECTION_FAULT False -void nxagentTransferSelection(int resource); -void nxagentCollectPropertyEvent(int resource); -void nxagentResetSelectionOwner(void); -WindowPtr nxagentGetClipboardWindow(Atom property); -void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, +static void transferSelection(int resource); +#if 0 +static void resetSelectionOwner(void); +#endif +static void initSelectionOwner(int index, Atom selection); +static void clearSelectionOwner(int index); +static void storeSelectionOwner(int index, Selection *sel); +static Bool matchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow); + +static void notifyConvertFailure(ClientPtr client, Window requestor, Atom selection, Atom target, Time time); -int nxagentSendNotify(xEvent *event); +static void setSelectionOwner(Selection *pSelection); +static int sendEventToClient(ClientPtr client, xEvent *pEvents); +static int sendSelectionNotifyEventToClient(ClientPtr client, + Time time, + Window requestor, + Atom selection, + Atom target, + Atom property); +static Status sendSelectionNotifyEventToServer(XSelectionEvent *event_to_send); +#ifdef DEBUG +static void printSelectionStat(int sel); +#endif +static void replyRequestSelection(XEvent *X, Bool success); void nxagentPrintClipboardStat(char *); @@ -249,12 +268,13 @@ extern unsigned long startTime; #endif #ifdef DEBUG -void nxagentPrintSelectionStat(int sel) +static void printSelectionStat(int sel) { SelectionOwner lOwner = lastSelectionOwner[sel]; Selection curSel = CurrentSelections[sel]; char *s = NULL; + fprintf(stderr, " owner is inside nxagent? %s\n", IS_INTERNAL_OWNER(sel) ? "yes" : "no"); #ifdef CLIENTIDS fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d] PID [%d] Cmd [%s]\n", (void *)lOwner.client, @@ -274,18 +294,11 @@ void nxagentPrintSelectionStat(int sel) fprintf(stderr, " lastSelectionOwner[].lastTimeChanged [%u]\n", lOwner.lastTimeChanged); /* - print the selection name. + print the selection name. selection is _always_ a a remote Atom! */ - if (lOwner.client) - { - fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (local)\n", lOwner.selection, NameForAtom(lOwner.selection)); - } - else - { - SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lOwner.selection); - fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (remote)\n", lOwner.selection, validateString(s)); - SAFE_XFree(s); - } + SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lOwner.selection); + fprintf(stderr, " lastSelectionOwner[].selection [% 4ld][%s] (%s)\n", lOwner.selection, validateString(s), lOwner.client ? "inside nxagent" : "remote X server"); + SAFE_XFree(s); #ifdef CLIENTIDS fprintf(stderr, " CurrentSelections[].client [%p] index [%d] PID [%d] Cmd [%s]\n", (void *)curSel.client, @@ -331,9 +344,9 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, "lastServer\n"); fprintf(stderr, " lastServerRequestor (Window) [0x%x]\n", lastServerRequestor); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerProperty); - fprintf(stderr, " lastServerProperty (Atom) [% 4d][%s]\n", lastServerProperty, s); + fprintf(stderr, " lastServerProperty (Atom) [% 4ld][%s]\n", lastServerProperty, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerTarget); - fprintf(stderr, " lastServerTarget (Atom) [% 4d][%s]\n", lastServerTarget, s); + fprintf(stderr, " lastServerTarget (Atom) [% 4ld][%s]\n", lastServerTarget, validateString(s)); fprintf(stderr, " lastServerTime (Time) [%u]\n", lastServerTime); fprintf(stderr, "lastClient\n"); @@ -349,29 +362,30 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, " lastClientTime (Time) [%u]\n", lastClientTime); fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastClientReqTime); fprintf(stderr, " lastClientPropertySize (unsigned long) [%lu]\n", lastClientPropertySize); - fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, GetClientSelectionStageString(lastClientStage)); + fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, getClientSelectionStageString(lastClientStage)); fprintf(stderr, "PRIMARY\n"); - nxagentPrintSelectionStat(nxagentPrimarySelection); + printSelectionStat(nxagentPrimarySelection); fprintf(stderr, "CLIPBOARD\n"); - nxagentPrintSelectionStat(nxagentClipboardSelection); + printSelectionStat(nxagentClipboardSelection); - fprintf(stderr, "Atoms (server side)\n"); + fprintf(stderr, "Atoms (remote X server)\n"); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS); - fprintf(stderr, " serverTARGETS [% 4d][%s]\n", serverTARGETS, validateString(s)); + fprintf(stderr, " serverTARGETS [% 4ld][%s]\n", serverTARGETS, validateString(s)); + SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); + fprintf(stderr, " serverTIMESTAMP [% 4ld][%s]\n", serverTIMESTAMP, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTEXT); - fprintf(stderr, " serverTEXT [% d][%s]\n", serverTEXT, s); + fprintf(stderr, " serverTEXT [% 4ld][%s]\n", serverTEXT, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverCOMPOUND_TEXT); - fprintf(stderr, " serverCOMPOUND_TEXT [% d][%s]\n", serverCOMPOUND_TEXT, s); + fprintf(stderr, " serverCOMPOUND_TEXT [% 4ld][%s]\n", serverCOMPOUND_TEXT, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverUTF8_STRING); - fprintf(stderr, " serverUTF8_STRING [% 4d][%s]\n", serverUTF8_STRING, s); + fprintf(stderr, " serverUTF8_STRING [% 4ld][%s]\n", serverUTF8_STRING, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransToAgentProperty); - fprintf(stderr, " serverTransToAgentProperty [% 4d][%s]\n", serverTransFromAgentProperty, s); + fprintf(stderr, " serverTransToAgentProperty [% 4ld][%s]\n", serverTransFromAgentProperty, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty); - fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, s); - - SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); - fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s); + fprintf(stderr, " serverTransFromAgentProperty [% 4ld][%s]\n", serverTransToAgentProperty, validateString(s)); + SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverLastRequestedSelection); + fprintf(stderr, " serverLastRequestedSelection [% 4ld][%s]\n", serverLastRequestedSelection, validateString(s)); fprintf(stderr, "Atoms (inside nxagent)\n"); fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS)); @@ -381,7 +395,6 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, " clientUTF8_STRING [% 4d][%s]\n", clientUTF8_STRING, NameForAtom(clientUTF8_STRING)); fprintf(stderr, " clientCLIPBOARD [% 4d][%s]\n", clientCLIPBOARD, NameForAtom(clientCLIPBOARD)); fprintf(stderr, " clientCutProperty [% 4d][%s]\n", clientCutProperty, NameForAtom(clientCutProperty)); - fprintf(stderr, " nxagentLastRequestedSelection [% 4d][%s]\n", nxagentLastRequestedSelection, NameForAtom(nxagentLastRequestedSelection)); fprintf(stderr, "\\------------------------------------------------------------------------------\n"); @@ -402,7 +415,7 @@ int GetWindowProperty(WindowPtr pWin, Atom property, long longOffset, long longL * Send a SelectionNotify event to the real X server and do some error * handling (in DEBUG mode) */ -Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) +static Status sendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) { Window w = event_to_send->requestor; @@ -426,7 +439,7 @@ Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) { if (result == BadValue || result == BadWindow) { - fprintf(stderr, "%s: WARNING! XSendEvent to [0x%x] failed: %s\n", __func__, w, GetXErrorString(result)); + fprintf(stderr, "%s: WARNING! XSendEvent to [0x%x] failed: %s\n", __func__, w, getXErrorString(result)); } else { @@ -440,17 +453,17 @@ Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) return result; } -int SendEventToClient(ClientPtr client, xEvent *pEvents) +static int sendEventToClient(ClientPtr client, xEvent *pEvents) { - return TryClientEvents (client, pEvents, 1, NoEventMask, NoEventMask, NullGrab); + return TryClientEvents(client, pEvents, 1, NoEventMask, NoEventMask, NullGrab); } -int SendSelectionNotifyEventToClient(ClientPtr client, - Time time, - Window requestor, - Atom selection, - Atom target, - Atom property) +static int sendSelectionNotifyEventToClient(ClientPtr client, + Time time, + Window requestor, + Atom selection, + Atom target, + Atom property) { xEvent x = {0}; x.u.u.type = SelectionNotify; @@ -469,7 +482,7 @@ int SendSelectionNotifyEventToClient(ClientPtr client, CLINDEX(client)); #endif - return SendEventToClient(client, &x); + return sendEventToClient(client, &x); } /* @@ -477,7 +490,7 @@ int SendSelectionNotifyEventToClient(ClientPtr client, * server, like .e.g XA_STRING or UTF8_STRING. Other, non content type * targets like "TARGETS" or "TIMESTAMP" will return false. */ -Bool nxagentValidServerTargets(XlibAtom target) +static Bool validServerTargets(XlibAtom target) { if (target == XA_STRING) { @@ -524,12 +537,12 @@ Bool nxagentValidServerTargets(XlibAtom target) } #ifdef DEBUG - fprintf(stderr, "%s: invalid target [%u].\n", __func__, target); + fprintf(stderr, "%s: invalid target [%lu].\n", __func__, target); #endif return False; } -void nxagentInitSelectionOwner(int index, Atom selection) +static void initSelectionOwner(int index, Atom selection) { lastSelectionOwner[index].selection = selection; lastSelectionOwner[index].client = NullClient; @@ -539,15 +552,15 @@ void nxagentInitSelectionOwner(int index, Atom selection) } /* there's no owner on nxagent side anymore */ -void nxagentClearSelectionOwner(int index) +static void clearSelectionOwner(int index) { lastSelectionOwner[index].client = NULL; lastSelectionOwner[index].window = None; + lastSelectionOwner[index].windowPtr = NULL; lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); - /* FIXME: why is windowPtr not cleared in the function? */ } -void nxagentStoreSelectionOwner(int index, Selection *sel) +static void storeSelectionOwner(int index, Selection *sel) { lastSelectionOwner[index].client = sel->client; lastSelectionOwner[index].window = sel->window; @@ -555,7 +568,7 @@ void nxagentStoreSelectionOwner(int index, Selection *sel) lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); } -Bool nxagentMatchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow) +static Bool matchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow) { return ((pClient && lastSelectionOwner[index].client == pClient) || (pWindow && lastSelectionOwner[index].windowPtr == pWindow)); @@ -576,19 +589,17 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) for (int i = 0; i < nxagentMaxSelections; i++) { - if (nxagentMatchSelectionOwner(i, pClient, pWindow)) + if (matchSelectionOwner(i, pClient, pWindow)) { #ifdef TEST fprintf(stderr, "%s: Resetting state with client [%p] window [%p].\n", __func__, (void *) pClient, (void *) pWindow); #endif - /* FIXME: why is windowPtr not cleared in the function? */ - nxagentClearSelectionOwner(i); - lastSelectionOwner[i].windowPtr = NULL; + clearSelectionOwner(i); lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); lastServerRequestor = None; } @@ -597,7 +608,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) if (pWindow && pWindow == lastClientWindowPtr) { lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); } nxagentPrintClipboardStat("after nxagentClearClipboard"); @@ -638,13 +649,13 @@ int nxagentFindCurrentSelectionIndex(Atom sel) * SelectionClear event. We receive this event if someone on the real * X server claims the selection ownership. */ -void nxagentClearSelection(XEvent *X) +void nxagentHandleSelectionClearFromXServer(XEvent *X) { #ifdef DEBUG fprintf(stderr, "%s: SelectionClear event for selection [%lu].\n", __func__, X->xselectionclear.selection); #endif - nxagentPrintClipboardStat("before nxagentClearSelection"); + nxagentPrintClipboardStat("before nxagentHandleSelectionClearFromXServer"); if (!agentClipboardInitialized) { @@ -674,7 +685,7 @@ void nxagentClearSelection(XEvent *X) x.u.selectionClear.window = lastSelectionOwner[i].window; x.u.selectionClear.atom = CurrentSelections[i].selection; - SendEventToClient(lastSelectionOwner[i].client, &x); + sendEventToClient(lastSelectionOwner[i].client, &x); } /* @@ -685,12 +696,12 @@ void nxagentClearSelection(XEvent *X) CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[i].client = NullClient; - nxagentClearSelectionOwner(i); + clearSelectionOwner(i); } lastClientWindowPtr = NULL; - SetClientSelectionStage(None); - nxagentPrintClipboardStat("after nxagentClearSelection"); + setClientSelectionStage(None); + nxagentPrintClipboardStat("after nxagentHandleSelectionClearFromXServer"); } /* @@ -698,7 +709,7 @@ void nxagentClearSelection(XEvent *X) * event X. If success is True take the property from the event, else * take None (which reports "failed/denied" to the requestor). */ -void nxagentReplyRequestSelection(XEvent *X, Bool success) +static void replyRequestSelection(XEvent *X, Bool success) { XSelectionEvent eventSelection = { .requestor = X->xselectionrequest.requestor, @@ -716,7 +727,7 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success) eventSelection.property = None; } - SendSelectionNotifyEventToServer(&eventSelection); + sendSelectionNotifyEventToServer(&eventSelection); } /* @@ -726,7 +737,7 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success) * as selection owner. But in reality one of our windows is the owner, * so we must pass the request on to the real owner. */ -void nxagentRequestSelection(XEvent *X) +void nxagentHandleSelectionRequestFromXServer(XEvent *X) { #ifdef DEBUG { @@ -749,7 +760,7 @@ void nxagentRequestSelection(XEvent *X) } #endif - nxagentPrintClipboardStat("before nxagentRequestSelection"); + nxagentPrintClipboardStat("before nxagentHandleSelectionRequestFromXServer"); if (!agentClipboardInitialized) { @@ -766,7 +777,7 @@ void nxagentRequestSelection(XEvent *X) fprintf(stderr, "%s: denying additional request during transfer phase.\n", __func__); #endif - nxagentReplyRequestSelection(X, False); + replyRequestSelection(X, False); return; } @@ -779,13 +790,13 @@ void nxagentRequestSelection(XEvent *X) fprintf(stderr, "%s: not owning selection [%ld] - denying request.\n", __func__, X->xselectionrequest.selection); #endif - nxagentReplyRequestSelection(X, False); + replyRequestSelection(X, False); return; } } /* this is a special request like TARGETS or TIMESTAMP */ - if (!nxagentValidServerTargets(X->xselectionrequest.target)) + if (!validServerTargets(X->xselectionrequest.target)) { if (X->xselectionrequest.target == serverTARGETS) { @@ -800,7 +811,7 @@ void nxagentRequestSelection(XEvent *X) * * FIXME: the perfect solution should not just answer with * XA_STRING but ask the real owner what format it supports. The - * should then be sent to the original requestor. + * result should then be sent to the original requestor. */ long targets[] = {XA_STRING, serverUTF8_STRING, serverTEXT, serverCOMPOUND_TEXT, serverTARGETS, serverTIMESTAMP}; @@ -832,7 +843,7 @@ void nxagentRequestSelection(XEvent *X) (unsigned char*)&targets, numTargets); - nxagentReplyRequestSelection(X, True); + replyRequestSelection(X, True); } else if (X->xselectionrequest.target == serverTIMESTAMP) { @@ -861,19 +872,19 @@ void nxagentRequestSelection(XEvent *X) PropModeReplace, (unsigned char *) &lastSelectionOwner[i].lastTimeChanged, 1); - nxagentReplyRequestSelection(X, True); + replyRequestSelection(X, True); } } else { /* * unknown special request - probably bug! Check if this code handles all cases - * that are handled in nxagentValidServerTargets! + * that are handled in validServerTargets! */ #ifdef DEBUG fprintf(stderr, "%s: unknown special target [%ld] - denying request.\n", __func__, X->xselectionrequest.target); #endif - nxagentReplyRequestSelection(X, False); + replyRequestSelection(X, False); } return; } @@ -886,7 +897,7 @@ void nxagentRequestSelection(XEvent *X) /* * This is required for nxagentGetClipboardWindow. */ - nxagentLastRequestedSelection = X->xselectionrequest.selection; + serverLastRequestedSelection = X->xselectionrequest.selection; /* find the index of the requested selection */ int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection); @@ -955,7 +966,7 @@ void nxagentRequestSelection(XEvent *X) else x.u.selectionRequest.target = XA_STRING; - SendEventToClient(lastSelectionOwner[i].client, &x); + sendEventToClient(lastSelectionOwner[i].client, &x); #ifdef DEBUG fprintf(stderr, "%s: sent SelectionRequest event to client [%d] property [%d][%s]" \ @@ -969,11 +980,11 @@ void nxagentRequestSelection(XEvent *X) else { /* deny the request */ - nxagentReplyRequestSelection(X, False); + replyRequestSelection(X, False); } } } - nxagentPrintClipboardStat("after nxagentRequestSelection"); + nxagentPrintClipboardStat("after nxagentHandleSelectionRequestFromXServer"); } /* @@ -1002,7 +1013,7 @@ static void endTransfer(Bool success) CLINDEX(lastClientClientPtr)); #endif - SendSelectionNotifyEventToClient(lastClientClientPtr, + sendSelectionNotifyEventToClient(lastClientClientPtr, lastClientTime, lastClientRequestor, lastClientSelection, @@ -1013,10 +1024,10 @@ static void endTransfer(Bool success) * Enable further requests from clients. */ lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); } -void nxagentTransferSelection(int resource) +static void transferSelection(int resource) { if (lastClientClientPtr -> index != resource) { @@ -1036,7 +1047,7 @@ void nxagentTransferSelection(int resource) { int result; - PrintClientSelectionStage(); + printClientSelectionStage(); /* * Don't get data yet, just get size. We skip this stage in @@ -1077,7 +1088,7 @@ void nxagentTransferSelection(int resource) return; } - SetClientSelectionStage(WaitSize); + setClientSelectionStage(WaitSize); NXFlushDisplay(nxagentDisplay, NXFlushLink); @@ -1087,7 +1098,7 @@ void nxagentTransferSelection(int resource) { int result; - PrintClientSelectionStage(); + printClientSelectionStage(); /* * Request the selection data now. @@ -1131,7 +1142,7 @@ void nxagentTransferSelection(int resource) return; } - SetClientSelectionStage(WaitData); + setClientSelectionStage(WaitData); /* we've seen situations where you had to move the mouse or press a key to let the transfer complete. Flushing here fixed it */ @@ -1143,7 +1154,7 @@ void nxagentTransferSelection(int resource) { #ifdef DEBUG fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__, - GetClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); + getClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); #endif break; @@ -1204,7 +1215,7 @@ void nxagentCollectPropertyEvent(int resource) { case SelectionStageWaitSize: { - PrintClientSelectionStage(); + printClientSelectionStage(); #ifdef DEBUG fprintf (stderr, "%s: Got size notify event for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); @@ -1228,15 +1239,15 @@ void nxagentCollectPropertyEvent(int resource) * Request the selection data now. */ lastClientPropertySize = ulReturnBytesLeft; - SetClientSelectionStage(QueryData); + setClientSelectionStage(QueryData); - nxagentTransferSelection(resource); + transferSelection(resource); } break; } case SelectionStageWaitData: { - PrintClientSelectionStage(); + printClientSelectionStage(); #ifdef DEBUG fprintf (stderr, "%s: Got data notify event for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); @@ -1278,7 +1289,7 @@ void nxagentCollectPropertyEvent(int resource) { #ifdef DEBUG fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__, - GetClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); + getClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); #endif break; } @@ -1316,7 +1327,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) } #endif - PrintClientSelectionStage(); + printClientSelectionStage(); if (lastClientWindowPtr != NULL) { @@ -1347,10 +1358,10 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) * tions. */ - SetClientSelectionStage(QueryData); + setClientSelectionStage(QueryData); lastClientPropertySize = 262144; - nxagentTransferSelection(lastClientClientPtr -> index); + transferSelection(lastClientClientPtr -> index); } else { @@ -1388,7 +1399,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__, - lastSelectionOwner[i].window, clientCutProperty, GetXErrorString(result)); + lastSelectionOwner[i].window, clientCutProperty, getXErrorString(result)); #endif if (result == BadAlloc || result == BadAtom || result == BadWindow || result == BadValue) @@ -1404,7 +1415,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) &pszReturnData); #ifdef DEBUG fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__, - lastSelectionOwner[i].window, clientCutProperty, GetXErrorString(result)); + lastSelectionOwner[i].window, clientCutProperty, getXErrorString(result)); #endif if (result == BadAlloc || result == BadAtom || @@ -1430,7 +1441,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) #ifdef DEBUG { char *s = XGetAtomName(nxagentDisplay, lastServerProperty); - fprintf(stderr, "%s: XChangeProperty sent to window [0x%x] for property [%d][%s] value [\"%*.*s\"...]\n", + fprintf(stderr, "%s: XChangeProperty sent to window [0x%x] for property [%ld][%s] value [\"%*.*s\"...]\n", __func__, lastServerRequestor, lastServerProperty, @@ -1471,7 +1482,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) (void *)eventSelection.requestor); #endif - SendSelectionNotifyEventToServer(&eventSelection); + sendSelectionNotifyEventToServer(&eventSelection); lastServerRequestor = None; /* allow further request */ } @@ -1479,12 +1490,14 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) } } +#if 0 +/* FIXME: currently unused */ /* * Let nxagent's serverWindow acquire the selection. All requests from * the real X server (or its clients) will be sent to this window. The * real X server never communicates with our windows directly. */ -void nxagentResetSelectionOwner(void) +static void resetSelectionOwner(void) { if (lastServerRequestor != None) { @@ -1513,16 +1526,16 @@ void nxagentResetSelectionOwner(void) fprintf(stderr, "%s: Reset selection state for selection [%d].\n", __func__, i); #endif - nxagentClearSelectionOwner(i); - lastSelectionOwner[i].windowPtr = NULL; + clearSelectionOwner(i); } lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); /* Hmm, this is already None when reaching this */ lastServerRequestor = None; } +#endif #ifdef NXAGENT_CLIPBOARD @@ -1558,7 +1571,7 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, Selection * pCurSel = (Selection *)info->selection; #ifdef DEBUG - fprintf(stderr, "%s: pCurSel->lastTimeChanged [%d]\n", __func__, pCurSel->lastTimeChanged.milliseconds); + fprintf(stderr, "%s: pCurSel->lastTimeChanged [%u]\n", __func__, pCurSel->lastTimeChanged.milliseconds); #endif if (info->kind == SelectionSetOwner) @@ -1575,9 +1588,9 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, pCurSel->selection == clientCLIPBOARD)) { #ifdef DEBUG - fprintf(stderr, "%s: calling nxagentSetSelectionOwner\n", __func__); + fprintf(stderr, "%s: calling setSelectionOwner\n", __func__); #endif - nxagentSetSelectionOwner(pCurSel); + setSelectionOwner(pCurSel); } } else if (info->kind == SelectionWindowDestroy) @@ -1605,7 +1618,7 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, * This is called from the nxagentSetSelectionCallback, so it is using * internal Atoms */ -void nxagentSetSelectionOwner(Selection *pSelection) +static void setSelectionOwner(Selection *pSelection) { if (!agentClipboardInitialized) { @@ -1660,11 +1673,11 @@ void nxagentSetSelectionOwner(Selection *pSelection) * points to the struct that contains all information about the * owner window. */ - nxagentStoreSelectionOwner(i, pSelection); + storeSelectionOwner(i, pSelection); } lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); lastServerRequestor = None; @@ -1681,7 +1694,7 @@ FIXME lastSelectionOwnerWindowPtr = pSelection->pWin; lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); lastServerRequestor = None; } @@ -1689,8 +1702,8 @@ FIXME */ } -void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, - Atom selection, Atom target, Time time) +static void notifyConvertFailure(ClientPtr client, Window requestor, + Atom selection, Atom target, Time time) { /* * Check if the client is still valid. @@ -1704,7 +1717,7 @@ void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, return; } - SendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); + sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); } /* @@ -1763,11 +1776,11 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, "notifying failure to client\n", __func__); #endif - nxagentNotifyConvertFailure(lastClientClientPtr, lastClientRequestor, - lastClientSelection, lastClientTarget, lastClientTime); + notifyConvertFailure(lastClientClientPtr, lastClientRequestor, + lastClientSelection, lastClientTarget, lastClientTime); lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); } else { @@ -1781,7 +1794,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, "before timeout expired on last request, notifying failure to client\n", __func__); #endif - nxagentNotifyConvertFailure(client, requestor, selection, target, time); + notifyConvertFailure(client, requestor, selection, target, time); return 1; } @@ -1809,7 +1822,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, * The selection request target is TARGETS. The requestor is asking * for a list of supported data formats. * - * The list is aligned with the one in nxagentRequestSelection. + * The list is aligned with the one in nxagentHandleSelectionRequestFromXServer. */ if (target == clientTARGETS) { @@ -1832,7 +1845,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, &targets, 1); - SendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); + sendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); return 1; } @@ -1868,7 +1881,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, (unsigned char *) &lastSelectionOwner[i].lastTimeChanged, 1); - SendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); + sendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); return 1; } @@ -1906,7 +1919,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, target == clientUTF8_STRING) { lastClientWindowPtr = pWin; - SetClientSelectionStage(None); + setClientSelectionStage(None); /* * store the original requestor, we need that later after * serverTransToAgentProperty contains the desired selection content @@ -1934,7 +1947,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, if (target == clientUTF8_STRING) { #ifdef DEBUG - fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__, + fprintf(stderr, "%s: Sending XConvertSelection with target [%ld][%s], property [%ld][%s]\n", __func__, serverUTF8_STRING, szAgentUTF8_STRING, serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER"); #endif XConvertSelection(nxagentDisplay, selection, serverUTF8_STRING, serverTransToAgentProperty, @@ -1943,7 +1956,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, else { #ifdef DEBUG - fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__, + fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%ld][%s]\n", __func__, XA_STRING, validateString(NameForAtom(XA_STRING)), serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER"); #endif @@ -1967,7 +1980,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, fprintf(stderr, "%s: Unsupported target [%d][%s] - denying request\n", __func__, target, validateString(NameForAtom(target))); #endif - SendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); + sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); return 1; } @@ -2098,7 +2111,7 @@ int nxagentSendNotify(xEvent *event) NameForAtom(event->u.selectionNotify.property)); #endif - SendSelectionNotifyEventToServer(&eventSelection); + sendSelectionNotifyEventToServer(&eventSelection); return 1; } @@ -2111,13 +2124,13 @@ int nxagentSendNotify(xEvent *event) */ WindowPtr nxagentGetClipboardWindow(Atom property) { - int i = nxagentFindLastSelectionOwnerIndex(nxagentLastRequestedSelection); + int i = nxagentFindLastSelectionOwnerIndex(serverLastRequestedSelection); if (i < nxagentMaxSelections && property == clientCutProperty && lastSelectionOwner[i].windowPtr != NULL) { #ifdef DEBUG - fprintf(stderr, "%s: Returning last [%d] selection owner window [%p] (0x%x).\n", __func__, + fprintf(stderr, "%s: Returning last [%ld] selection owner window [%p] (0x%x).\n", __func__, lastSelectionOwner[i].selection, (void *)lastSelectionOwner[i].windowPtr, WINDOWID(lastSelectionOwner[i].windowPtr)); #endif @@ -2160,8 +2173,8 @@ Bool nxagentInitClipboard(WindowPtr pWin) { FatalError("nxagentInitClipboard: Failed to allocate memory for the clipboard selections.\n"); } - nxagentInitSelectionOwner(nxagentPrimarySelection, XA_PRIMARY); - nxagentInitSelectionOwner(nxagentClipboardSelection, nxagentAtoms[10]); /* CLIPBOARD */ + initSelectionOwner(nxagentPrimarySelection, XA_PRIMARY); + initSelectionOwner(nxagentClipboardSelection, nxagentAtoms[10]); /* CLIPBOARD */ } else { @@ -2271,13 +2284,13 @@ Bool nxagentInitClipboard(WindowPtr pWin) { for (int i = 0; i < nxagentMaxSelections; i++) { - nxagentClearSelectionOwner(i); + clearSelectionOwner(i); } lastServerRequestor = None; lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); lastClientReqTime = GetTimeInMillis(); clientTARGETS = MakeAtom(szAgentTARGETS, strlen(szAgentTARGETS), True); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h index a7d22ab97..b741ef286 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h @@ -41,29 +41,41 @@ typedef struct _XFixesAgentInfo extern XFixesAgentInfoRec nxagentXFixesInfo; /* - * Create the NX_SELTRANS_FROM_AGENT atom and - * initialize the required property to exchange - * data with the X server. + * Create the NX_SELTRANS_FROM_AGENT atom and initialize the required + * property to exchange data with the X server. */ extern Bool nxagentInitClipboard(WindowPtr pWindow); /* - * Called whenever a client or a window is - * destroyed to let the clipboard code to - * release any pointer to the referenced - * structures. + * Called whenever a client or a window is destroyed to let the + * clipboard code to release any pointer to the referenced structures. */ extern void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow); -extern void nxagentSetSelectionOwner(Selection *pSelection); extern int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, Window requestor, Atom property, Atom target, Time time); -void nxagentClearSelection(); -void nxagentRequestSelection(); -void nxagentHandleSelectionNotifyFromXServer(); +#ifdef XEvent +extern void nxagentHandleSelectionClearFromXServer(XEvent *X); +extern void nxagentHandleSelectionRequestFromXServer(XEvent *X); +extern void nxagentHandleSelectionNotifyFromXServer(XEvent *X); +#else +extern void nxagentHandleSelectionClearFromXServer(); +extern void nxagentHandleSelectionRequestFromXServer(); +extern void nxagentHandleSelectionNotifyFromXServer(); +#endif + +extern int nxagentFindCurrentSelectionIndex(Atom sel); +/* + * Handle the selection property received in the event loop in + * Events.c. + */ +extern void nxagentCollectPropertyEvent(int resource); + +extern WindowPtr nxagentGetClipboardWindow(Atom property); + +extern int nxagentSendNotify(xEvent *event); -int nxagentFindCurrentSelectionIndex(Atom sel); #endif /* __Clipboard_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c index bafb30cea..05c78e0ad 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c @@ -77,6 +77,8 @@ is" without express or implied warranty. #undef TEST #undef DEBUG +CursorBitsPtr nxagentAnimCursorBits; + /* * Defined in Display.c. There are huge problems mixing the GC * definition in Xlib with the server code. This must be reworked. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Cursor.h b/nx-X11/programs/Xserver/hw/nxagent/Cursor.h index e857834df..8237e5e15 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Cursor.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Cursor.h @@ -65,7 +65,7 @@ typedef struct _AnimCur { AnimCurElt *elts; } AnimCurRec, *AnimCurPtr; -CursorBitsPtr nxagentAnimCursorBits; +extern CursorBitsPtr nxagentAnimCursorBits; #define nxagentIsAnimCursor(c) ((c)->bits == nxagentAnimCursorBits) #define nxagentGetAnimCursor(c) ((AnimCurPtr) ((c) + 1)) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c index 2d4eb6229..808e1501f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c @@ -41,6 +41,7 @@ #include "Display.h" #include "Dialog.h" #include "Utils.h" +#include "Keystroke.h" #include <nx/NX.h> #include "compext/Compext.h" @@ -187,6 +188,7 @@ void nxagentLaunchDialog(DialogType dialogType) int *pid; char *type; char *message; + char *strings[2] = {NULL}; /* don't forget to add free() calls if you change the number */ int local; const char *window = NULL; @@ -247,6 +249,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE; local = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL; pid = &nxagentEnableRandRModeDialogPid; + strings[0] = nxagentFindFirstKeystroke("resize"); break; } case DIALOG_DISABLE_DESKTOP_RESIZE_MODE: @@ -255,6 +258,8 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE; local = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL; pid = &nxagentDisableRandRModeDialogPid; + strings[0] = nxagentFindFirstKeystroke("resize"); + strings[1] = nxagentFindMatchingKeystrokes("viewport_"); break; } case DIALOG_ENABLE_DEFER_MODE: @@ -263,6 +268,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_ENABLE_DEFER_MODE_TYPE; local = DIALOG_ENABLE_DEFER_MODE_LOCAL; pid = &nxagentEnableDeferModePid; + strings[0] = nxagentFindFirstKeystroke("defer"); break; } case DIALOG_DISABLE_DEFER_MODE: @@ -271,6 +277,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_DISABLE_DEFER_MODE_TYPE; local = DIALOG_DISABLE_DEFER_MODE_LOCAL; pid = &nxagentDisableDeferModePid; + strings[0] = nxagentFindFirstKeystroke("defer"); break; } case DIALOG_ENABLE_AUTOGRAB_MODE: @@ -279,6 +286,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE; local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL; pid = &nxagentEnableAutograbModePid; + strings[0] = nxagentFindFirstKeystroke("autograb"); break; } case DIALOG_DISABLE_AUTOGRAB_MODE: @@ -287,6 +295,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE; local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL; pid = &nxagentDisableAutograbModePid; + strings[0] = nxagentFindFirstKeystroke("autograb"); break; } default: @@ -321,6 +330,17 @@ void nxagentLaunchDialog(DialogType dialogType) return; } + char *msg = NULL; + if (-1 == asprintf(&msg, message, strings[0], strings[1])) + { + #ifdef DEBUG + fprintf(stderr, "%s: could not allocate message string.\n", __func__); + #endif + SAFE_free(strings[0]); + SAFE_free(strings[1]); + return; + } + /* * We don't want to receive SIGCHLD before we store the child pid. */ @@ -331,9 +351,13 @@ void nxagentLaunchDialog(DialogType dialogType) sigprocmask(SIG_BLOCK, &set, &oldSet); - *pid = NXTransDialog(nxagentDialogName, message, window, + *pid = NXTransDialog(nxagentDialogName, msg, window, type, local, dialogDisplay); + SAFE_free(strings[0]); + SAFE_free(strings[1]); + SAFE_free(msg); + #ifdef TEST fprintf(stderr, "nxagentLaunchDialog: Launched dialog %s with pid [%d] on display %s.\n", DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h index 42bba290d..b11df5045 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h @@ -78,7 +78,9 @@ extern void nxagentTerminateDialogs(void); nxagentEnableRandRModeDialogPid == 0 && \ nxagentDisableRandRModeDialogPid == 0 && \ nxagentEnableDeferModePid == 0 && \ - nxagentDisableDeferModePid == 0) + nxagentDisableDeferModePid == 0 && \ + nxagentEnableAutograbModePid == 0 && \ + nxagentDisableAutograbModePid == 0) #define DECODE_DIALOG_TYPE(type) \ ((type) == DIALOG_KILL_SESSION ? "DIALOG_KILL_SESSION" : \ @@ -96,10 +98,9 @@ extern void nxagentTerminateDialogs(void); "UNKNOWN_DIALOG") /* - * Message to be showed to users when the close - * button is pressed. The right message is chosen - * according if session does or does not run in - * persistent mode. + * Message to be shown to users when the close button is pressed. The + * right message is chosen according if session does or does not run + * in persistent mode. */ #define DIALOG_KILL_SESSION_MESSAGE \ @@ -174,7 +175,7 @@ nxagentFailedReconnectionMessage "\ The session is now running in desktop resize mode.\n\ You can resize the desktop by simply dragging the\n\ -desktop window's border. You can press Ctrl+Alt+R\n\ +desktop window's border. You can press %s\n\ again to disable this option.\ " @@ -187,9 +188,12 @@ again to disable this option.\ "\ The session is now running in viewport mode. You can\n\ navigate across different areas of the desktop window\n\ -by dragging the desktop with the mouse or by using the\n\ -arrows keys while pressing Ctrl+Alt. Press Ctrl+Alt+R\n\ -again to return to the desktop resize mode.\ +by dragging the desktop with the mouse while pressing\n\ +Ctrl+Alt or use the keystrokes listed below. Press\n\ +%s again to return to the desktop resize mode.\n\ +\n\ +Use these keystrokes to navigate:\n\ +%s\ " #define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE "ok" @@ -201,7 +205,7 @@ again to return to the desktop resize mode.\ \ "\ Deferred screen updates are now enabled. You can press\n\ -Ctrl+Alt+E again to disable this option.\ +%s again to disable this option.\ " #define DIALOG_ENABLE_DEFER_MODE_TYPE "ok" @@ -213,7 +217,7 @@ Ctrl+Alt+E again to disable this option.\ \ "\ Deferred screen updates are now disabled. You can press\n\ -Ctrl+Alt+E to enable it again.\ +%s to enable it again.\ " #define DIALOG_DISABLE_DEFER_MODE_TYPE "ok" @@ -225,7 +229,7 @@ Ctrl+Alt+E to enable it again.\ \ "\ Keyboard auto-grabbing mode is now enabled. You can press\n\ -Ctrl+Alt+G again to disable auto-grabbing.\ +%s again to disable auto-grabbing.\ " #define DIALOG_ENABLE_AUTOGRAB_MODE_TYPE "ok" @@ -237,7 +241,7 @@ Ctrl+Alt+G again to disable auto-grabbing.\ \ "\ Keyboard auto-grabbing mode is now disabled. You can press\n\ -Ctrl+Alt+G again to re-enable auto-grabbing.\ +%s again to re-enable auto-grabbing.\ " #define DIALOG_DISABLE_AUTOGRAB_MODE_TYPE "ok" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index c8ad891be..55e40b461 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -86,6 +86,7 @@ is" without express or implied warranty. #include "Splash.h" #include "Screen.h" #include "Handlers.h" +#include "Split.h" #include <nx/NX.h> #include "compext/Compext.h" @@ -1494,8 +1495,13 @@ void nxagentInitVisuals(void) if (nxagentVisuals != NULL) { - nxagentVisuals = (XVisualInfo *) realloc(nxagentVisuals, - nxagentNumVisuals * sizeof(XVisualInfo)); + XVisualInfo *new = (XVisualInfo *) realloc(nxagentVisuals, + nxagentNumVisuals * sizeof(XVisualInfo)); + /* nxagentVisuals being NULL is covered below */ + if (new) + nxagentVisuals = new; + else + SAFE_free(nxagentVisuals); } SAFE_XFree(viList); @@ -1547,6 +1553,7 @@ void nxagentInitPixmapFormats(void) */ nxagentNumPixmapFormats = 0; + nxagentRemoteNumPixmapFormats = 0; /* XXX: Some X server doesn't list 1 among available depths... @@ -1596,28 +1603,97 @@ XXX: Some X server doesn't list 1 among available depths... } } - nxagentRemotePixmapFormats = XListPixmapFormats(nxagentDisplay, &nxagentRemoteNumPixmapFormats); + /* + * we need to filter the list of remote pixmap formats by our + * supported depths, just like above. If we do not perform this step + * nxagentCheckForPixmapFormatsCompatibility will fail when + * tolerance is "strict" (the default). This becomes evident when + * Xephyr or Xnest are used as the real X server. They normally show + * only two supported depths but 7 supported pixmap formats (which + * could be a bug there). + */ - if (nxagentRemotePixmapFormats == NULL) + int tmpnum = 0; + XPixmapFormatValues *tmp = XListPixmapFormats(nxagentDisplay, &tmpnum); + + if (tmp == NULL) { #ifdef WARNING fprintf(stderr, "nxagentInitPixmapFormats: WARNING! Failed to get available remote pixmap formats.\n"); #endif + + nxagentRemotePixmapFormats = NULL; } - #ifdef TEST else { + #ifdef TEST fprintf(stderr, "nxagentInitPixmapFormats: Got [%d] available remote pixmap formats:\n", - nxagentRemoteNumPixmapFormats); + tmpnum); + + for (int i = 0; i < tmpnum; i++) + { + fprintf(stderr, "nxagentInitPixmapFormats: Found remote pixmap format [%d]: depth [%d] " + "bits_per_pixel [%d] scanline_pad [%d].\n", i, tmp[i].depth, + tmp[i].bits_per_pixel, tmp[i].scanline_pad); + + } + #endif + + SAFE_XFree(tmp); + + nxagentRemotePixmapFormats = malloc((nxagentNumDepths + 1) * sizeof(XPixmapFormatValues)); + + for (int i = 1; i <= MAXDEPTH; i++) + { + int depth = 0; + + if (i == 1) + { + depth = 1; + } + else + { + for (int j = 0; j < nxagentNumDepths; j++) + { + if (nxagentDepths[j] == i) + { + depth = i; + break; + } + } + } + + if (depth != 0) + { + if (nxagentRemoteNumPixmapFormats >= MAXFORMATS) + { + FatalError("nxagentInitPixmapFormats: MAXFORMATS is too small for this remote server.\n"); + } + + nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].depth = depth; + nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].bits_per_pixel = nxagentBitsPerPixel(depth); + nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].scanline_pad = BITMAP_SCANLINE_PAD; + #ifdef TEST + fprintf(stderr, "nxagentInitPixmapFormats: Suitable remote format [%d] to depth [%d] " + "bits per pixel [%d] scanline pad [%d].\n", nxagentRemoteNumPixmapFormats, + depth, nxagentRemotePixmapFormats[nxagentRemoteNumPixmapFormats].bits_per_pixel, + BITMAP_SCANLINE_PAD); + #endif + + nxagentRemoteNumPixmapFormats++; + } + } + + #ifdef TEST for (int i = 0; i < nxagentRemoteNumPixmapFormats; i++) { fprintf(stderr, "nxagentInitPixmapFormats: Remote pixmap format [%d]: depth [%d] " "bits_per_pixel [%d] scanline_pad [%d].\n", i, nxagentRemotePixmapFormats[i].depth, nxagentRemotePixmapFormats[i].bits_per_pixel, nxagentRemotePixmapFormats[i].scanline_pad); } + #endif } - #endif } void nxagentSetDefaultDrawables(void) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 7f1d2dec5..bdbf4fcf8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -91,6 +91,11 @@ RESTYPE RT_NX_CORR_WINDOW; RESTYPE RT_NX_CORR_PIXMAP; int nxagentCorruptedPixmaps = 0; + +/* + * Number of windows which need synchronization. + */ + int nxagentCorruptedWindows = 0; int nxagentCorruptedBackgrounds = 0; @@ -160,15 +165,15 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre * so that the image will be transferred in a single operation. */ - nxagentFBTrap = 1; + nxagentFBTrap = True; - nxagentSplitTrap = 1; + nxagentSplitTrap = True; int result = nxagentSynchronizeDrawableData(pDrawable, breakMask, owner); - nxagentSplitTrap = 0; + nxagentSplitTrap = False; - nxagentFBTrap = 0; + nxagentFBTrap = False; if (wait == DO_WAIT && nxagentSplitResource(pDrawable) != NULL) { @@ -191,45 +196,62 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre return result; } -int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner) +static int reallySynchronizeDrawableData(DrawablePtr pDrawable) { - char *data = NULL; - int success; + GCPtr pGC = nxagentGetGraphicContext(pDrawable); - if (pDrawable -> type == DRAWABLE_PIXMAP) + if (pGC == NULL) { - GCPtr pGC; + #ifdef WARNING + fprintf(stderr, "%s: WARNING! Failed to get the temporary GC.\n", __func__); + #endif - unsigned int leftPad = 0; + return 0; + } - int width = pDrawable -> width; - int height = pDrawable -> height; - int depth = pDrawable -> depth; + DrawablePtr pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ? + ((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) : + pDrawable); - #ifdef TEST - fprintf(stderr, "nxagentSynchronizeDrawableData: Synchronizing drawable (%s) with geometry [%d][%d][%d].\n", - nxagentDrawableType(pDrawable), width, height, depth); + int width = pDrawable -> width; + int height = pDrawable -> height; + int depth = pDrawable -> depth; + + #ifdef TEST + fprintf(stderr, "%s: Synchronizing drawable (%s) with geometry [%d][%d][%d].\n", + __func__, nxagentDrawableType(pDrawable), width, height, depth); + #endif + + unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; + + int length = nxagentImageLength(width, height, format, 0, depth); + + char *data = malloc(length); + if (data == NULL) + { + #ifdef WARNING + fprintf(stderr, "%s: WARNING! Failed to allocate memory for the operation.\n", __func__); #endif - unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; + return 0; + } - int length = nxagentImageLength(width, height, format, leftPad, depth); + ValidateGC(pDrawable, pGC); - if ((data = malloc(length)) == NULL) - { - #ifdef WARNING - fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to allocate memory for the operation.\n"); - #endif + fbGetImage(pSrcDrawable, 0, 0, width, height, format, AllPlanes, data); - success = 0; + nxagentPutImage(pDrawable, pGC, depth, 0, 0, + width, height, 0, format, data); - goto nxagentSynchronizeDrawableDataEnd; - } + SAFE_free(data); - DrawablePtr pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ? - ((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) : - pDrawable); + return 1; +} +int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner) +{ + if (pDrawable -> type == DRAWABLE_PIXMAP) + { /* * Synchronize the whole pixmap if we need to download a fresh * copy with lossless compression turned off. @@ -237,35 +259,12 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask if (nxagentLosslessTrap == 1) { - pGC = nxagentGetGraphicContext(pDrawable); - - if (pGC == NULL) - { - #ifdef WARNING - fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to get the temporary GC.\n"); - #endif - - success = 0; - - goto nxagentSynchronizeDrawableDataEnd; - } - - ValidateGC(pDrawable, pGC); - - fbGetImage(pSrcDrawable, 0, 0, - width, height, format, AllPlanes, data); - #ifdef TEST - fprintf(stderr, "nxagentSynchronizeDrawableData: Forcing synchronization of " - "pixmap at [%p] with lossless compression.\n", (void *) pDrawable); + fprintf(stderr, "%s: Forcing synchronization of pixmap at [%p] with lossless compression.\n", + __func__, (void *) pDrawable); #endif - nxagentPutImage(pDrawable, pGC, depth, 0, 0, - width, height, leftPad, format, data); - - success = 1; - - goto nxagentSynchronizeDrawableDataEnd; + return reallySynchronizeDrawableData(pDrawable); } else if (nxagentReconnectTrap == 1) { @@ -278,7 +277,6 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask if (pDrawable -> depth == 1) { #ifdef TEST - if (nxagentReconnectTrap == 1) { static int totalLength; @@ -287,51 +285,25 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask totalLength += length; totalReconnectedPixmaps++; - fprintf(stderr, "nxagentSynchronizeDrawableData: Reconnecting pixmap at [%p] [%dx%d] " + fprintf(stderr, "%s: Reconnecting pixmap at [%p] [%dx%d] " "Depth [%d] Size [%d]. Total size [%d]. Total reconnected pixmaps [%d].\n", - (void *) pDrawable, width, height, depth, length, + __func__, (void *) pDrawable, width, height, depth, length, totalLength, totalReconnectedPixmaps); } - #endif - pGC = nxagentGetGraphicContext(pDrawable); - - if (pGC == NULL) - { - #ifdef WARNING - fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to create the temporary GC.\n"); - #endif - - success = 0; - - goto nxagentSynchronizeDrawableDataEnd; - } - - ValidateGC(pDrawable, pGC); - - fbGetImage(pSrcDrawable, 0, 0, - width, height, format, AllPlanes, data); - - nxagentPutImage(pDrawable, pGC, depth, 0, 0, - width, height, leftPad, format, data); - - success = 1; - - goto nxagentSynchronizeDrawableDataEnd; + return reallySynchronizeDrawableData(pDrawable); } else { #ifdef TEST - fprintf(stderr, "nxagentSynchronizeDrawableData: Skipping synchronization of " - "pixmap at [%p][%p] during reconnection.\n", (void *) pDrawable, (void*) nxagentVirtualPixmap((PixmapPtr)pDrawable)); + fprintf(stderr, "%s: Skipping synchronization of pixmap at [%p][%p] during reconnection.\n", + __func__, (void *) pDrawable, (void*) nxagentVirtualPixmap((PixmapPtr)pDrawable)); #endif nxagentMarkCorruptedRegion(pDrawable, NullRegion); - success = 1; - - goto nxagentSynchronizeDrawableDataEnd; + return 1; } } } @@ -342,12 +314,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask * the drawable. */ - success = nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); - -nxagentSynchronizeDrawableDataEnd: - SAFE_free(data); - - return success; + return nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); } /* @@ -533,11 +500,11 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned int saveTrap = nxagentGCTrap; - nxagentGCTrap = 0; + nxagentGCTrap = False; - nxagentFBTrap = 1; + nxagentFBTrap = True; - nxagentSplitTrap = 1; + nxagentSplitTrap = True; pGC = nxagentGetGraphicContext(pDrawable); @@ -877,9 +844,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned nxagentSynchronizeRegionStop: - nxagentSplitTrap = 0; + nxagentSplitTrap = False; - nxagentFBTrap = 0; + nxagentFBTrap = False; nxagentGCTrap = saveTrap; @@ -979,7 +946,7 @@ nxagentSynchronizeRegionFree: if (clipRegion != NullRegion) { - nxagentFreeRegion(pDrawable, clipRegion); + nxagentFreeRegion(clipRegion); } SAFE_free(data); @@ -1034,7 +1001,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); #endif - nxagentFreeRegion(pDrawable, pRegion); + nxagentFreeRegion(pRegion); return; } @@ -1047,7 +1014,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea nxagentSynchronizeRegion(pDrawable, pRegion, breakMask, NULL); - nxagentFreeRegion(pDrawable, pRegion); + nxagentFreeRegion(pRegion); } } @@ -1558,7 +1525,7 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) RegionUnion(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); - nxagentFreeRegion(pDrawable, pRegion); + nxagentFreeRegion(pRegion); } else { @@ -2359,7 +2326,7 @@ void nxagentCorruptedRegionOnWindow(void *p0, XID x, void *p2) RegionIntersect(&visRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); - nxagentFreeRegion(pWin -> drawable.pScreen, clipRegion); + nxagentFreeRegion(clipRegion); if (RegionNil(&visRegion) == 1) { @@ -2450,7 +2417,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) int saveTrap = nxagentGCTrap; - nxagentGCTrap = 1; + nxagentGCTrap = True; if (nxagentDrawableStatus(pDrawable) == Synchronized) { @@ -2566,7 +2533,7 @@ nxagentCreateDrawableBitmapEnd: if (pClipRegion != NullRegion) { - nxagentFreeRegion(pDrawable, pClipRegion); + nxagentFreeRegion(pClipRegion); } if (pGC != NULL) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.h b/nx-X11/programs/Xserver/hw/nxagent/Drawable.h index 6388d5c12..1101f989f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.h @@ -162,8 +162,7 @@ extern int nxagentForceSynchronization; extern RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height); -#define nxagentFreeRegion(pDrawable, pRegion) \ - RegionDestroy(pRegion); +#define nxagentFreeRegion(pRegion) RegionDestroy(pRegion); extern void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index b19dda3ac..83091eff4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -545,19 +545,15 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) void nxagentInternalWindowsTree(WindowPtr pWin, int indent) { - while (pWin) + for (; pWin; pWin = pWin -> nextSib) { - WindowPtr pChild = pWin -> firstChild; - fprintf(stderr, "%*s", indent, ""); nxagentInternalWindowInfo(pWin, indent, TRUE); fprintf(stderr, "\n"); - nxagentInternalWindowsTree(pChild, indent + 4); - - pWin = pWin -> nextSib; + nxagentInternalWindowsTree(pWin -> firstChild, indent + 4); } } @@ -897,7 +893,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) fprintf(stderr, "%s: Going to handle new SelectionClear event.\n", __func__); #endif - nxagentClearSelection(&X); + nxagentHandleSelectionClearFromXServer(&X); break; } @@ -907,7 +903,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) fprintf(stderr, "%s: Going to handle new SelectionRequest event.\n", __func__); #endif - nxagentRequestSelection(&X); + nxagentHandleSelectionRequestFromXServer(&X); break; } @@ -1146,17 +1142,17 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already { if (X.xkey.keycode == nxagentCapsLockKeycode) { - nxagentXkbCapsTrap = 1; + nxagentXkbCapsTrap = True; } else if (X.xkey.keycode == nxagentNumLockKeycode) { - nxagentXkbNumTrap = 1; + nxagentXkbNumTrap = True; } nxagentInitXkbKeyboardState(); - nxagentXkbCapsTrap = 0; - nxagentXkbNumTrap = 0; + nxagentXkbCapsTrap = False; + nxagentXkbNumTrap = False; } /* Calculate the time elapsed between this and the last event @@ -1716,11 +1712,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already Mask mask = CWX | CWY; - nxagentScreenTrap = 1; + nxagentScreenTrap = True; ConfigureWindow(pWin, mask, (XID *) values, wClient(pWin)); - nxagentScreenTrap = 0; + nxagentScreenTrap = False; } if (nxagentOption(Fullscreen) == 1 && @@ -2010,11 +2006,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL && nxagentWindowTopLevel(pWin) == 1)) { - nxagentScreenTrap = 1; + nxagentScreenTrap = True; UnmapWindow(pWin, False); - nxagentScreenTrap = 0; + nxagentScreenTrap = False; } } @@ -2041,11 +2037,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ((pWin = nxagentWindowPtr(X.xmap.window)) != NULL && nxagentWindowTopLevel(pWin) == 1)) { - nxagentScreenTrap = 1; + nxagentScreenTrap = True; MapWindow(pWin, wClient(pWin)); - nxagentScreenTrap = 0; + nxagentScreenTrap = False; } if (pWin != NULL) @@ -2266,17 +2262,17 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) { if (X -> xkey.keycode == nxagentCapsLockKeycode) { - nxagentXkbCapsTrap = 1; + nxagentXkbCapsTrap = True; } else if (X -> xkey.keycode == nxagentNumLockKeycode) { - nxagentXkbNumTrap = 1; + nxagentXkbNumTrap = True; } nxagentInitXkbKeyboardState(); - nxagentXkbCapsTrap = 0; - nxagentXkbNumTrap = 0; + nxagentXkbCapsTrap = False; + nxagentXkbNumTrap = False; } if (nxagentCheckSpecialKeystroke(&X -> xkey, result)) @@ -2633,7 +2629,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) #ifdef WARNING 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); + fprintf(stderr, "WARNING: Invalid window in ClientMessage xclient.window [0x%lx].\n", X->xclient.window); } #endif @@ -2872,7 +2868,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #endif #ifdef DEBUG - fprintf(stderr, "%s: CurrentSelections[i].lastTimeChanged [%d]\n", __func__, CurrentSelections[i].lastTimeChanged.milliseconds); + fprintf(stderr, "%s: CurrentSelections[%d].lastTimeChanged [%u]\n", __func__, i, CurrentSelections[i].lastTimeChanged.milliseconds); fprintf(stderr, "%s: Event timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.timestamp); fprintf(stderr, "%s: Event selection timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.selection_timestamp); fprintf(stderr, "%s: Event selection window [0x%lx]\n", __func__, xfixesEvent->xfixesselection.window); @@ -2904,9 +2900,9 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) * identify that situation during Callback processing we could * get rid of the Trap... */ - nxagentExternalClipboardEventTrap = 1; + nxagentExternalClipboardEventTrap = True; CallCallbacks(&SelectionCallback, &info); - nxagentExternalClipboardEventTrap = 0; + nxagentExternalClipboardEventTrap = False; } } return 1; @@ -3203,11 +3199,11 @@ int nxagentHandleConfigureNotify(XEvent* X) * nxagentWindowPriv(pWinWindow)->height = X -> xconfigure.height; */ - nxagentScreenTrap = 1; + nxagentScreenTrap = True; ConfigureWindow(pWinWindow, mask, (XID *) values, wClient(pWinWindow)); - nxagentScreenTrap = 0; + nxagentScreenTrap = False; nxagentCheckWindowConfiguration((XConfigureEvent*)X); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h index 6df5725d4..a33a1abb1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h @@ -73,8 +73,7 @@ Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr); int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter); /* - * Enable and disable notification of - * remote X server events. + * Enable and disable notification of remote X server events. */ extern void nxagentEnableKeyboardEvents(void); @@ -93,33 +92,30 @@ extern void nxagentSetDefaultEventMask(Mask mask); extern Mask nxagentGetEventMask(WindowPtr pWin); /* - * Bring keyboard device in known state. It needs - * a round-trip so it only gets called if a pre- - * vious XKB event did not implicitly initialized - * the internal state. This is unlikely to happen. + * Bring keyboard device in known state. It needs a round-trip so it + * only gets called if a previous XKB event did not implicitly + * initialized the internal state. This is unlikely to happen. */ extern int nxagentInitXkbKeyboardState(void); /* - * Update the keyboard state according - * to focus and XKB events received - * from the remote X server. + * Update the keyboard state according to focus and XKB events + * received from the remote X server. */ extern int nxagentHandleXkbKeyboardStateEvent(XEvent *X); /* - * Handle sync and karma messages and - * other notification event coming + * Handle sync and karma messages and other notification event coming * from proxy. */ extern int nxagentHandleProxyEvent(XEvent *X); /* - * Other functions providing the ad-hoc - * handling of the remote X events. + * Other functions providing the ad-hoc handling of the remote X + * events. */ extern int nxagentHandleExposeEvent(XEvent *X); @@ -132,16 +128,14 @@ extern int nxagentHandleConfigureNotify(XEvent *X); extern int nxagentHandleXFixesSelectionNotify(XEvent *X); /* - * Send a fake keystroke to the remote - * X server. + * Send a fake keystroke to the remote X server. */ extern void nxagentSendFakeKey(int key); /* - * Called to manage grab of pointer and - * keyboard when running in fullscreen - * mode. + * Called to manage grab of pointer and keyboard when running in + * fullscreen mode. */ extern void nxagentGrabPointerAndKeyboard(XEvent *X); @@ -150,15 +144,7 @@ extern void nxagentUngrabPointerAndKeyboard(XEvent *X); extern void nxagentDeactivatePointerGrab(void); /* - * Handle the selection property received - * in the event loop. - */ - -void nxagentCollectPropertyEvent(int resource); - -/* - * Synchronize expose events between agent and - * the real X server. + * Synchronize expose events between agent and the real X server. */ typedef struct _ExposuresRec @@ -205,8 +191,8 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr); extern int nxagentUserInput(void *p); /* -* We have to check these before launching the terminate - * dialog in rootless mode. + * We have to check these before launching the terminate dialog in + * rootless mode. */ extern Bool nxagentLastWindowDestroyed; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index ddae19cf0..dcbd6949a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -102,7 +102,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP static XFontStruct *nxagentLoadQueryFont(register Display *dpy , char *fontName , FontPtr pFont); int nxagentFreeFont(XFontStruct *fs); static Bool nxagentGetFontServerPath(char * fontServerPath, int size); - static char * nxagentMakeScalableFontName(const char *fontName, int scalableResolution); RESTYPE RT_NX_FONT; @@ -113,15 +112,15 @@ static void printFontCacheDump(char*); typedef struct _nxagentFontRec { - char *name; - int status; + char *name; + int status; } nxagentFontRec, *nxagentFontRecPtr; typedef struct _nxagentFontList { - nxagentFontRecPtr *list; - int length; - int listSize; + nxagentFontRecPtr *list; + int length; + int listSize; } nxagentFontList, *nxagentFontListPtr; nxagentFontList nxagentRemoteFontList = {NULL, (int)0, (int)0}; @@ -130,16 +129,16 @@ int nxagentFontPrivateIndex; typedef struct _nxCacheFontEntry { - Atom atom; - XFontStruct *font_struct; - char *name; + Atom atom; + XFontStruct *font_struct; + char *name; } nxCacheFontEntryRec, *nxCacheFontEntryRecPtr; static struct _nxagentFontCache { - nxCacheFontEntryRecPtr *entry; - int index; - int size; + nxCacheFontEntryRecPtr *entry; + int index; + int size; } nxagentFontCache = { NULL, (int) 0, (int) 0 }; #define CACHE_ENTRY_PTR (nxagentFontCache.entry) @@ -152,531 +151,547 @@ static struct _nxagentFontCache static struct _nxagentFailedToReconnectFonts { - FontPtr *font; - XID *id; - int size; - int index; + FontPtr *font; + XID *id; + int size; + int index; } nxagentFailedToReconnectFonts = {NULL, NULL, 0, 0}; +static void nxagentFreeRemoteFontList(nxagentFontList *listRec); + +void nxagentFreeFontData(void) +{ + nxagentFreeFontCache(); + nxagentFreeRemoteFontList(&nxagentRemoteFontList); +} + /* * This is used if nxagentFullGeneration is true in CloseDisplay(). */ void nxagentFreeFontCache(void) { - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: Freeing nxagent font cache\n"); - #endif + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: Freeing nxagent font cache\n"); + #endif - if (CACHE_INDEX == 0) - return; + if (CACHE_INDEX == 0) + return; - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: Freeing nxagent font cache, there are [%d] entries.\n", CACHE_INDEX); - #endif - - for (int i = 0; i < CACHE_INDEX; i++) - { #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: Freeing nxagent font cache entry [%d] entry pointer is [%p], name [%s]\n", - i, CACHE_ENTRY(i), CACHE_NAME(i)); + fprintf(stderr, "Font: Freeing nxagent font cache, there are [%d] entries.\n", CACHE_INDEX); #endif - if (CACHE_FSTRUCT(i)) + for (int i = 0; i < CACHE_INDEX; i++) { - nxagentFreeFont(CACHE_FSTRUCT(i)); - } + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: Freeing nxagent font cache entry [%d] entry pointer is [%p], name [%s]\n", + i, CACHE_ENTRY(i), CACHE_NAME(i)); + #endif - SAFE_free(CACHE_NAME(i)); - SAFE_free(CACHE_ENTRY(i)); - } + if (CACHE_FSTRUCT(i)) + { + nxagentFreeFont(CACHE_FSTRUCT(i)); + } + + SAFE_free(CACHE_NAME(i)); + SAFE_free(CACHE_ENTRY(i)); + } - SAFE_free(CACHE_ENTRY_PTR); - CACHE_ENTRY_PTR = NULL; - CACHE_INDEX = 0; - CACHE_SIZE = 0; + SAFE_free(CACHE_ENTRY_PTR); + CACHE_INDEX = 0; + CACHE_SIZE = 0; - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: nxagent font cache fully freed\n"); - #endif + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: nxagent font cache fully freed\n"); + #endif - return; + return; } void nxagentListRemoteFonts(const char *searchPattern, const int maxNames) { - char **xList; - int xLen = 0; + if (NXDisplayError(nxagentDisplay) == 1) + { + return; + } - const char *patterns[] = {"*", "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"}; - int patternsQt = 2; + /* + * Avoid querying again the remote fonts. + */ - if (NXDisplayError(nxagentDisplay) == 1) - { - return; - } + if (nxagentRemoteFontList.length > 0) + { + return; + } - /* - * Avoid querying again the remote fonts. - */ + /* + * We can't retrieve the full remote font list with a single query, + * because the number of dashes in the pattern acts as a rule to + * select how to search for the font names, so the pattern '*' is + * useful to retrieve the font aliases, while the other one will + * select the 'real' fonts. + */ - if (nxagentRemoteFontList.length > 0) - { - return; - } + const char *patterns[] = {"*", "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"}; + const int numPatterns = 2; - /* - * We can't retrieve the full remote font list with a single query, - * because the number of dashes in the pattern acts as a rule to - * select how to search for the font names, so the pattern '*' is - * useful to retrieve the font aliases, while the other one will - * select the 'real' fonts. - */ + for (int p = 0; p < numPatterns; p++) + { + int xLen = 0; + char **xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen); - for (int p = 0; p < patternsQt; p++) - { - xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen); + #ifdef NXAGENT_FONTMATCH_DEBUG + fprintf(stderr, "nxagentListRemoteFonts: NXagent remote list [%s] has %d elements.\n", patterns[p], xLen); + #endif - #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "nxagentListRemoteFonts: NXagent remote list [%s] has %d elements.\n", patterns[p], xLen); - #endif + /* + * Add the ListFont request pattern to the list with the last + * requested maxnames. + */ - /* - * Add the ListFont request pattern to the list with the last - * requested maxnames. - */ + nxagentListRemoteAddName(searchPattern, maxNames); - nxagentListRemoteAddName(searchPattern, maxNames); + for (int i = 0; i < xLen; i++) + { + nxagentListRemoteAddName(xList[i], 1); + } - for (int i = 0; i < xLen; i++) - { - nxagentListRemoteAddName(xList[i], 1); + XFreeFontNames(xList); } - XFreeFontNames(xList); - } - - #ifdef NXAGENT_FONTMATCH_DEBUG + #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "nxagentListRemoteFonts: Printing remote font list.\n"); + fprintf(stderr, "nxagentListRemoteFonts: Printing remote font list.\n"); - for (int i = 0; i < nxagentRemoteFontList.length; i++) - { - fprintf(stderr, "Font# %d, \"%s\"\n", i, nxagentRemoteFontList.list[i]->name); - } + for (int i = 0; i < nxagentRemoteFontList.length; i++) + { + fprintf(stderr, "Font# %d, \"%s\"\n", i, nxagentRemoteFontList.list[i]->name); + } - fprintf(stderr, "nxagentListRemoteFonts: End of list\n"); + fprintf(stderr, "nxagentListRemoteFonts: End of list\n"); - #endif + #endif } void nxagentListRemoteAddName(const char *name, int status) { - int pos; + int pos; - if (nxagentFontFind(name, &pos)) - { - if (nxagentRemoteFontList.list[pos]->status < status) - { - nxagentRemoteFontList.list[pos]->status = status; - - #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Font: Font# %d, [%s] change status to %s\n", - pos, nxagentRemoteFontList.list[pos]->name,nxagentRemoteFontList.list[pos]->status?"OK":"deleted"); - #endif - } - return; - } + if (nxagentFontFind(name, &pos)) + { + if (nxagentRemoteFontList.list[pos]->status < status) + { + nxagentRemoteFontList.list[pos]->status = status; - if (nxagentRemoteFontList.length == nxagentRemoteFontList.listSize) - { - nxagentRemoteFontList.list = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) - * (nxagentRemoteFontList.listSize + 1000)); + #ifdef NXAGENT_FONTMATCH_DEBUG + fprintf(stderr, "Font: Font# %d, [%s] change status to %s\n", + pos, nxagentRemoteFontList.list[pos]->name, + nxagentRemoteFontList.list[pos]->status ? "OK" : "deleted"); + #endif + } + return; + } - if (nxagentRemoteFontList.list == NULL) - { - FatalError("Font: remote list memory re-allocation failed!.\n"); - } + if (nxagentRemoteFontList.length == nxagentRemoteFontList.listSize) + { + int num = nxagentRemoteFontList.listSize + 1000; + nxagentFontRecPtr *tmp1 = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) * num); - nxagentRemoteFontList.listSize += 1000; - } + if (tmp1 == NULL) + { + FatalError("Font: remote list memory re-allocation failed!.\n"); + } - if (pos < nxagentRemoteFontList.length) - { - #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Font: Going to move list from %p to %p len = %d!.\n", - &nxagentRemoteFontList.list[pos], &nxagentRemoteFontList.list[pos+1], - (nxagentRemoteFontList.length - pos) * sizeof(nxagentFontRecPtr)); - #endif + nxagentRemoteFontList.list = tmp1; + nxagentRemoteFontList.listSize = num; + } - memmove(&nxagentRemoteFontList.list[pos+1], - &nxagentRemoteFontList.list[pos], - (nxagentRemoteFontList.length - pos) * sizeof(nxagentFontRecPtr)); - } + if (pos < nxagentRemoteFontList.length) + { + #ifdef NXAGENT_FONTMATCH_DEBUG + fprintf(stderr, "Font: Going to move list from %p to %p len = %d!.\n", + &nxagentRemoteFontList.list[pos], &nxagentRemoteFontList.list[pos+1], + (nxagentRemoteFontList.length - pos) * sizeof(nxagentFontRecPtr)); + #endif - if ((nxagentRemoteFontList.list[pos] = malloc(sizeof(nxagentFontRec)))) - { - nxagentRemoteFontList.list[pos]->name = strdup(name); - if (nxagentRemoteFontList.list[pos]->name == NULL) + memmove(&nxagentRemoteFontList.list[pos+1], + &nxagentRemoteFontList.list[pos], + (nxagentRemoteFontList.length - pos) * sizeof(nxagentFontRecPtr)); + } + + if ((nxagentRemoteFontList.list[pos] = malloc(sizeof(nxagentFontRec)))) { - fprintf(stderr, "Font: remote list name memory allocation failed!.\n"); - SAFE_free(nxagentRemoteFontList.list[pos]); - return; + nxagentRemoteFontList.list[pos]->name = strdup(name); + if (nxagentRemoteFontList.list[pos]->name == NULL) + { + fprintf(stderr, "Font: remote list name memory allocation failed!.\n"); + SAFE_free(nxagentRemoteFontList.list[pos]); + return; + } } - } - else - { - fprintf(stderr, "Font: remote list record memory allocation failed!.\n"); - return; - } - nxagentRemoteFontList.list[pos]->status = status; - nxagentRemoteFontList.length++; - - #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Font: remote font list added [%s] in position [%d] as %s !.\n", - name, pos, status ? "OK" : "deleted"); - fprintf(stderr, "Font: remote font list total len is [%d] Size is [%d] !.\n", - nxagentRemoteFontList.length, nxagentRemoteFontList.listSize); - #endif + else + { + fprintf(stderr, "Font: remote list record memory allocation failed!.\n"); + return; + } + nxagentRemoteFontList.list[pos]->status = status; + nxagentRemoteFontList.length++; + + #ifdef NXAGENT_FONTMATCH_DEBUG + fprintf(stderr, "Font: remote font list added [%s] in position [%d] as %s !.\n", + name, pos, status ? "OK" : "deleted"); + fprintf(stderr, "Font: remote font list total len is [%d] Size is [%d] !.\n", + nxagentRemoteFontList.length, nxagentRemoteFontList.listSize); + #endif } static void nxagentFreeRemoteFontList(nxagentFontList *listRec) { - for (int l = 0; l < listRec -> length; l++) - { - if (listRec -> list[l]) + for (int l = 0; l < listRec -> length; l++) { - SAFE_free(listRec -> list[l] -> name); - SAFE_free(listRec -> list[l]); + if (listRec -> list[l]) + { + SAFE_free(listRec -> list[l] -> name); + SAFE_free(listRec -> list[l]); + } } - } - listRec -> length = listRec -> listSize = 0; + listRec -> length = listRec -> listSize = 0; - SAFE_free(listRec -> list); + SAFE_free(listRec -> list); - return; + return; } Bool nxagentFontFind(const char *name, int *pos) { - if (!nxagentRemoteFontList.length) - { - *pos=0; - return False; - } - int low = 0; - int high = nxagentRemoteFontList.length - 1; - int iter = 0; - int res = 1; - int lpos = nxagentRemoteFontList.length; - while (low <= high) - { - *pos = (high + low)/2; - iter ++; - res = strcasecmp(nxagentRemoteFontList.list[*pos]->name,name); - if (res > 0) - { - high = *pos - 1; - lpos = *pos; - continue; - } - else if (res < 0) - { - low = *pos + 1; - lpos = low; - continue; - } - break; - } - *pos = (res == 0)?*pos:lpos; - - #ifdef NXAGENT_FONTMATCH_DEBUG - if (res == 0) - fprintf(stderr, "Font: font found in %d iterations in pos = %d\n", iter, *pos); - else - fprintf(stderr, "Font: not font found in %d iterations insertion pos is = %d\n", iter, *pos); - #endif - - return (res == 0); + if (!nxagentRemoteFontList.length) + { + *pos=0; + return False; + } + + int low = 0; + int high = nxagentRemoteFontList.length - 1; + int iter = 0; + int res = 1; + int lpos = nxagentRemoteFontList.length; + while (low <= high) + { + *pos = (high + low)/2; + iter ++; + res = strcasecmp(nxagentRemoteFontList.list[*pos]->name,name); + if (res > 0) + { + high = *pos - 1; + lpos = *pos; + continue; + } + else if (res < 0) + { + low = *pos + 1; + lpos = low; + continue; + } + break; + } + *pos = (res == 0) ? *pos : lpos; + + #ifdef NXAGENT_FONTMATCH_DEBUG + if (res == 0) + fprintf(stderr, "Font: font found in %d iterations in pos = %d\n", iter, *pos); + else + fprintf(stderr, "Font: not font found in %d iterations insertion pos is = %d\n", iter, *pos); + #endif + return (res == 0); } Bool nxagentFontLookUp(const char *name) { - int i; + int i; - if (name != NULL && strlen(name) == 0) - { - return 0; - } + if (name && strlen(name) == 0) + { + return 0; + } - int result = nxagentFontFind(name, &i); + int result = nxagentFontFind(name, &i); - char *scalable = NULL; + char *scalable = NULL; - /* - * Let's try with the scalable font description. - */ + /* + * Let's try with the scalable font description. + */ - if (result == 0) - { - if ((scalable = nxagentMakeScalableFontName(name, 0)) != NULL) + if (result == 0) { - result = nxagentFontFind(scalable, &i); + if ((scalable = nxagentMakeScalableFontName(name, 0)) != NULL) + { + result = nxagentFontFind(scalable, &i); - SAFE_free(scalable); + SAFE_free(scalable); + } } - } - /* - * Let's try again after replacing zero to xdpi and ydpi in the pattern. - */ + /* + * Let's try again after replacing zero to xdpi and ydpi in the pattern. + */ - if (result == 0) - { - if ((scalable = nxagentMakeScalableFontName(name, 1)) != NULL) + if (result == 0) { - result = nxagentFontFind(scalable, &i); + if ((scalable = nxagentMakeScalableFontName(name, 1)) != NULL) + { + result = nxagentFontFind(scalable, &i); - SAFE_free(scalable); + SAFE_free(scalable); + } } - } - if (result == 0) - { - return 0; - } - else - { - return (nxagentRemoteFontList.list[i]->status > 0); - } + if (result == 0) + { + return 0; + } + else + { + return (nxagentRemoteFontList.list[i]->status > 0); + } } +/* + * NXAGENT uses useless screen pointer to pass the original font name + * to realizeFont, could be a source of problems in the future. + */ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) { - void * priv; - Atom name_atom, value_atom; - int nprops; - FontPropPtr props; - int i; - const char *name; - char *origName = (char*) pScreen; - #ifdef HAS_XFONT2 - xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL); + xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL); #else - FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); + FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); #endif /* HAS_XFONT2 */ - name_atom = MakeAtom("FONT", 4, True); - value_atom = 0L; + Atom name_atom = MakeAtom("FONT", 4, True); + Atom value_atom = 0L; - nprops = pFont->info.nprops; - props = pFont->info.props; + int nprops = pFont->info.nprops; + FontPropPtr props = pFont->info.props; - for (i = 0; i < nprops; i++) - if ((Atom)props[i].name == name_atom) { - value_atom = props[i].value; - break; + for (int i = 0; i < nprops; i++) + { + if ((Atom)props[i].name == name_atom) + { + value_atom = props[i].value; + break; + } } - if (!value_atom) return False; + if (!value_atom) + return False; - name = NameForAtom(value_atom); + const char *name = NameForAtom(value_atom); - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: nxagentRealizeFont, realizing font: %s\n", validateString(name)); - fprintf(stderr, " atom: %ld\n", value_atom); - fprintf(stderr, "Font: Cache dump:\n"); - for (i = 0; i < CACHE_INDEX; i++) - { - fprintf(stderr, "nxagentFontCache.entry[%d]->name: %s font_struct at %p\n", - i, CACHE_NAME(i), CACHE_FSTRUCT(i)); - } - #endif + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: nxagentRealizeFont, realizing font: %s\n", validateString(name)); + fprintf(stderr, " atom: %ld\n", value_atom); + fprintf(stderr, "Font: Cache dump:\n"); + for (int i = 0; i < CACHE_INDEX; i++) + { + fprintf(stderr, "nxagentFontCache.entry[%d]->name: %s font_struct at %p\n", + i, CACHE_NAME(i), CACHE_FSTRUCT(i)); + } + #endif - if (!name) return False; + if (!name) + return False; - if ((strcasecmp(origName, name) != 0) && !strchr(origName,'*')) - { - #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Font: Changing font name to realize from [%s] to [%s]\n", - validateString(name), origName); - #endif + char *origName = (char*) pScreen; + if ((strcasecmp(origName, name) != 0) && !strchr(origName,'*')) + { + #ifdef NXAGENT_FONTMATCH_DEBUG + fprintf(stderr, "Font: Changing font name to realize from [%s] to [%s]\n", + validateString(name), origName); + #endif - name = origName; - } + name = origName; + } - priv = (void *)malloc(sizeof(nxagentPrivFont)); + void *priv = (void *)malloc(sizeof(nxagentPrivFont)); #ifdef HAS_XFONT2 - xfont2_font_set_private(pFont, nxagentFontPrivateIndex, priv); + xfont2_font_set_private(pFont, nxagentFontPrivateIndex, priv); #else - FontSetPrivate(pFont, nxagentFontPrivateIndex, priv); + FontSetPrivate(pFont, nxagentFontPrivateIndex, priv); #endif /* HAS_XFONT2 */ - nxagentFontPriv(pFont) -> mirrorID = 0; + nxagentFontPriv(pFont) -> mirrorID = 0; - for (i = 0; i < nxagentFontCache.index; i++) - { -/* if (value_atom == CACHE_ATOM(i))*/ - if (strcasecmp(CACHE_NAME(i), name) == 0) - { + int fci; + for (fci = 0; fci < nxagentFontCache.index; fci++) + { + /* if (value_atom == CACHE_ATOM(i))*/ + if (strcasecmp(CACHE_NAME(fci), name) == 0) + { + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: nxagentFontCache hit [%s] = [%s]!\n", CACHE_NAME(fci), validateString(name)); + #endif + + break; + } + } + + if (fci < CACHE_INDEX) + { + nxagentFontPriv(pFont)->font_struct = CACHE_FSTRUCT(fci); + strcpy(nxagentFontPriv(pFont)->fontName, name); + } + else + { #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: nxagentFontCache hit [%s] = [%s]!\n", CACHE_NAME(i), validateString(name)); + fprintf(stderr, "Font: nxagentFontCache fail.\n"); #endif - break; - } - } + if (CACHE_INDEX == CACHE_SIZE) + { + int num = CACHE_SIZE + 100; - if (i < CACHE_INDEX) - { - nxagentFontPriv(pFont)->font_struct = CACHE_FSTRUCT(i); - strcpy(nxagentFontPriv(pFont)->fontName, name); - } - else - { - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: nxagentFontCache fail.\n"); - #endif + nxCacheFontEntryRecPtr *tmp1 = realloc(CACHE_ENTRY_PTR, + sizeof(nxCacheFontEntryRecPtr) * num); - if (CACHE_INDEX == CACHE_SIZE) - { - CACHE_ENTRY_PTR = realloc(CACHE_ENTRY_PTR, sizeof(nxCacheFontEntryRecPtr) * (CACHE_SIZE + 100)); + if (tmp1 == NULL) + { + FatalError("Font: Cache list memory re-allocation failed.\n"); + } + + CACHE_ENTRY_PTR = tmp1; + CACHE_SIZE = num; + } - if (CACHE_ENTRY_PTR == NULL) + CACHE_ENTRY(CACHE_INDEX) = malloc(sizeof(nxCacheFontEntryRec)); + + if (CACHE_ENTRY(CACHE_INDEX) == NULL) { - FatalError("Font: Cache list memory re-allocation failed.\n"); + return False; } - CACHE_SIZE += 100; - } + CACHE_NAME(CACHE_INDEX) = malloc(strlen(name) + 1); - CACHE_ENTRY(CACHE_INDEX) = malloc(sizeof(nxCacheFontEntryRec)); + if (CACHE_NAME(CACHE_INDEX) == NULL) + { + return False; + } - if (CACHE_ENTRY(CACHE_INDEX) == NULL) - { - return False; - } + #ifdef NXAGENT_FONTMATCH_DEBUG + fprintf(stderr, "Font: Going to realize font [%s],[%s] on real X server.\n", validateString(name), origName); + #endif - CACHE_NAME(CACHE_INDEX) = malloc(strlen(name) + 1); + if (nxagentRemoteFontList.length == 0 && (NXDisplayError(nxagentDisplay) == 0)) + { + nxagentListRemoteFonts("*", nxagentMaxFontNames); + } - if (CACHE_NAME(CACHE_INDEX) == NULL) - { - return False; - } - - #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Font: Going to realize font [%s],[%s] on real X server.\n", validateString(name), origName); - #endif - - if (nxagentRemoteFontList.length == 0 && (NXDisplayError(nxagentDisplay) == 0)) - { - nxagentListRemoteFonts("*", nxagentMaxFontNames); - } - - nxagentFontPriv(pFont)->font_struct = nxagentLoadQueryFont(nxagentDisplay, (char *)name, pFont); - strcpy(nxagentFontPriv(pFont)->fontName, name); - if (nxagentFontPriv(pFont)->font_struct != NULL) - { - CACHE_ATOM(i) = value_atom; - strcpy(CACHE_NAME(i), name); - CACHE_FSTRUCT(i) = nxagentFontPriv(pFont)->font_struct; - CACHE_INDEX++; - - nxagentFontPriv(pFont) -> mirrorID = FakeClientID(serverClient -> index); - AddResource(nxagentFontPriv(pFont) -> mirrorID, RT_NX_FONT, pFont); - - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: nxagentFontCache adds font [%s] in pos. [%d].\n", - validateString(name), CACHE_INDEX - 1); - #endif - } - } + nxagentFontPriv(pFont)->font_struct = nxagentLoadQueryFont(nxagentDisplay, (char *)name, pFont); + strcpy(nxagentFontPriv(pFont)->fontName, name); + if (nxagentFontPriv(pFont)->font_struct != NULL) + { + CACHE_ATOM(fci) = value_atom; + strcpy(CACHE_NAME(fci), name); + CACHE_FSTRUCT(fci) = nxagentFontPriv(pFont)->font_struct; + CACHE_INDEX++; + + nxagentFontPriv(pFont) -> mirrorID = FakeClientID(serverClient -> index); + AddResource(nxagentFontPriv(pFont) -> mirrorID, RT_NX_FONT, pFont); + + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: nxagentFontCache adds font [%s] in pos. [%d].\n", + validateString(name), CACHE_INDEX - 1); + #endif + } + } - #ifdef NXAGENT_FONTMATCH_DEBUG + #ifdef NXAGENT_FONTMATCH_DEBUG - if (nxagentFontPriv(pFont)->font_struct == NULL) - { - if (nxagentFontLookUp(name) == False) + if (nxagentFontPriv(pFont)->font_struct == NULL) { - fprintf(stderr, "Font: nxagentRealizeFont failed with font Font=%s, not in our remote list\n", - validateString(name)); + if (nxagentFontLookUp(name) == False) + { + fprintf(stderr, "Font: nxagentRealizeFont failed with font Font=%s, not in our remote list\n", + validateString(name)); + } + else + { + fprintf(stderr, "Font: nxagentRealizeFont failed with font Font=%s but the font is in our remote list\n", + validateString(name)); + } } else { - fprintf(stderr, "Font: nxagentRealizeFont failed with font Font=%s but the font is in our remote list\n", - validateString(name)); + fprintf(stderr, "Font: nxagentRealizeFont OK realizing font Font=%s\n", + validateString(name)); } - } - else - fprintf(stderr, "Font: nxagentRealizeFont OK realizing font Font=%s\n", - validateString(name)); - #endif + #endif - return (nxagentFontPriv(pFont)->font_struct != NULL); + return (nxagentFontPriv(pFont)->font_struct != NULL); } Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) { - if (nxagentFontPriv(pFont)) - { - if (NXDisplayError(nxagentDisplay) == 0) + if (nxagentFontPriv(pFont)) { - if (nxagentFontStruct(pFont)) - { - int i; - - for (i = 0; i < CACHE_INDEX; i++) - { - if (CACHE_FSTRUCT(i) == nxagentFontStruct(pFont)) - { - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "nxagentUnrealizeFont: Not freeing the font in cache.\n"); - #endif - - break; - } - } - - if (i == CACHE_INDEX) - { - /* - * This font is not in the cache. - */ - - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "nxagentUnrealizeFont: Freeing font not found in cache '%d'\n", - CACHE_ATOM(i)); - #endif - - XFreeFont(nxagentDisplay, nxagentFontStruct(pFont)); - } - } - } + if (NXDisplayError(nxagentDisplay) == 0) + { + if (nxagentFontStruct(pFont)) + { + int fci; + + for (fci = 0; fci < CACHE_INDEX; fci++) + { + if (CACHE_FSTRUCT(fci) == nxagentFontStruct(pFont)) + { + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "nxagentUnrealizeFont: Not freeing the font in cache.\n"); + #endif + + break; + } + } + + if (fci == CACHE_INDEX) + { + /* + * This font is not in the cache. + */ + + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "nxagentUnrealizeFont: Freeing font not found in cache '%d'\n", + CACHE_ATOM(fci)); + #endif + + XFreeFont(nxagentDisplay, nxagentFontStruct(pFont)); + } + } + } - if (nxagentFontPriv(pFont) -> mirrorID) - FreeResource(nxagentFontPriv(pFont) -> mirrorID, RT_NONE); + if (nxagentFontPriv(pFont) -> mirrorID) + FreeResource(nxagentFontPriv(pFont) -> mirrorID, RT_NONE); - free(nxagentFontPriv(pFont)); + free(nxagentFontPriv(pFont)); #ifdef HAS_XFONT2 - xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL); + xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL); #else - FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); + FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); #endif /* HAS_XFONT2 */ - } + } - return True; + return True; } int nxagentDestroyNewFontResourceType(void * p, XID id) { - #ifdef TEST - fprintf(stderr, "%s: Destroying mirror id [%ld] for font at [%p].\n", __func__, - nxagentFontPriv((FontPtr) p) -> mirrorID, (void *) p); - #endif + #ifdef TEST + fprintf(stderr, "%s: Destroying mirror id [%ld] for font at [%p].\n", __func__, + nxagentFontPriv((FontPtr) p) -> mirrorID, (void *) p); + #endif /* FIXME: It happens that this resource had been already destroyed. We @@ -684,12 +699,12 @@ FIXME: It happens that this resource had been already destroyed. We client and another client. We had a crash when freeing server client resources. */ - if (nxagentFontPriv((FontPtr) p) != NULL) - { - nxagentFontPriv((FontPtr) p) -> mirrorID = None; - } + if (nxagentFontPriv((FontPtr) p) != NULL) + { + nxagentFontPriv((FontPtr) p) -> mirrorID = None; + } - return 1; + return 1; } static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontPtr pFont) @@ -722,7 +737,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP 5, /* Set-width */ 8, /* Point size */ 10 /* DPI_y */ - }; + }; #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentLoadBestQueryFont: Searching font '%s' .\n", fontName); @@ -734,71 +749,69 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP if (numFontFields <= FIELDS) { - #ifdef WARNING - if (nxagentVerbose == 1) - { - fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Font name in non standard format. \n"); - } - #endif + #ifdef WARNING + if (nxagentVerbose == 1) + { + fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Font name in non standard format.\n"); + } + #endif } else { - for (int i = 1 ; i < nxagentRemoteFontList.length ; i++) - { - numSearchFields = nxagentSplitString(nxagentRemoteFontList.list[i]->name, searchFields, FIELDS+1, "-"); - - - /* The following code attempts to find an accurate approximation - * of the missing font. The current candidate and the missing font are - * compared on the 14 fields of the X Logical Font Description Convention. - * The selection is performed by the analysis of the matching fields, - * shifting left the value of the Weight variable on the right matches - * and shifting right the value of the Weight on the wrong ones; - * due a probability of overmuch right shifting, the starting weight is set - * to a high value. At the end of matching the selected font is the one - * with the bigger final Weight. The shift operation has been used instead - * of other operation for a performance issue. - * In some check the shift is performed by more than one position, because - * of the relevance of the field; for example a correct slant or a matching - * charset is more relevant than the size. - */ - - if (numSearchFields > FIELDS) + for (int i = 1 ; i < nxagentRemoteFontList.length ; i++) { - - tempWeight = 0; - - for (int j = 0; j < FIELDS; j++) - { - if (strcasecmp(searchFields[fieldOrder[j]], fontNameFields[fieldOrder[j]]) == 0 || - strcmp(searchFields[fieldOrder[j]], "") == 0 || - strcmp(fontNameFields[fieldOrder[j]], "") != 0 || - strcmp(searchFields[fieldOrder[j]], "*") == 0 || - strcmp(fontNameFields[fieldOrder[j]], "*") == 0) + numSearchFields = nxagentSplitString(nxagentRemoteFontList.list[i]->name, searchFields, FIELDS+1, "-"); + + + /* The following code attempts to find an accurate approximation + * of the missing font. The current candidate and the missing font are + * compared on the 14 fields of the X Logical Font Description Convention. + * The selection is performed by the analysis of the matching fields, + * shifting left the value of the Weight variable on the right matches + * and shifting right the value of the Weight on the wrong ones; + * due a probability of overmuch right shifting, the starting weight is set + * to a high value. At the end of matching the selected font is the one + * with the bigger final Weight. The shift operation has been used instead + * of other operation for a performance issue. + * In some check the shift is performed by more than one position, because + * of the relevance of the field; for example a correct slant or a matching + * charset is more relevant than the size. + */ + + if (numSearchFields > FIELDS) { - tempWeight ++; - } - - tempWeight <<= 1; - } - + tempWeight = 0; + + for (int j = 0; j < FIELDS; j++) + { + if (strcasecmp(searchFields[fieldOrder[j]], fontNameFields[fieldOrder[j]]) == 0 || + strcmp(searchFields[fieldOrder[j]], "") == 0 || + strcmp(fontNameFields[fieldOrder[j]], "") != 0 || + strcmp(searchFields[fieldOrder[j]], "*") == 0 || + strcmp(fontNameFields[fieldOrder[j]], "*") == 0) + { + tempWeight ++; + } + + tempWeight <<= 1; + } } if (tempWeight > weight) { - /* Found more accurate font */ + /* Found more accurate font */ - weight = tempWeight; - snprintf(substFontBuf, sizeof(substFontBuf), "%s", nxagentRemoteFontList.list[i]->name); + weight = tempWeight; + snprintf(substFontBuf, sizeof(substFontBuf), "%s", nxagentRemoteFontList.list[i]->name); - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentLoadBestQueryFont: Weight '%d' of more accurate font '%s' .\n", weight, substFontBuf); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentLoadBestQueryFont: Weight '%d' of more accurate font '%s' .\n", weight, substFontBuf); + #endif } for (int j = 0; j < numSearchFields; j++) { - SAFE_free(searchFields[j]); + SAFE_free(searchFields[j]); } } } @@ -806,8 +819,8 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP #ifdef WARNING if (nxagentVerbose == 1) { - fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Failed to load font '%s'. Replacing with '%s'.\n", - fontName, substFontBuf); + fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Failed to load font '%s'. Replacing with '%s'.\n", + fontName, substFontBuf); } #endif @@ -815,7 +828,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP for (int j = 0; j < numFontFields; j++) { - SAFE_free(fontNameFields[j]); + SAFE_free(fontNameFields[j]); } return fontStruct; @@ -837,16 +850,16 @@ static void nxagentFontDisconnect(FontPtr pFont, XID param1, void * param2) for (int i = 0; i < CACHE_INDEX; i++) { - if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) - { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentFontDisconnect: font %s found in cache at position %d\n", - privFont -> fontName, i); - #endif + if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentFontDisconnect: font %s found in cache at position %d\n", + privFont -> fontName, i); + #endif - privFont -> font_struct = NULL; - return; - } + privFont -> font_struct = NULL; + return; + } } #ifdef NXAGENT_RECONNECT_FONT_DEBUG @@ -856,888 +869,884 @@ static void nxagentFontDisconnect(FontPtr pFont, XID param1, void * param2) if (privFont -> font_struct) { - XFreeFont(nxagentDisplay, privFont -> font_struct); - privFont -> font_struct = NULL; + XFreeFont(nxagentDisplay, privFont -> font_struct); + privFont -> font_struct = NULL; } } static void nxagentCollectFailedFont(FontPtr fpt, XID id) { - if (nxagentFailedToReconnectFonts.font == NULL) - { - nxagentFailedToReconnectFonts.size = 8; + if (nxagentFailedToReconnectFonts.font == NULL) + { + nxagentFailedToReconnectFonts.size = 8; - nxagentFailedToReconnectFonts.font = malloc(nxagentFailedToReconnectFonts.size * - sizeof(FontPtr)); + nxagentFailedToReconnectFonts.font = malloc(nxagentFailedToReconnectFonts.size * + sizeof(FontPtr)); - nxagentFailedToReconnectFonts.id = malloc(nxagentFailedToReconnectFonts.size * sizeof(XID)); + nxagentFailedToReconnectFonts.id = malloc(nxagentFailedToReconnectFonts.size * + sizeof(XID)); - if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) - { - SAFE_free(nxagentFailedToReconnectFonts.font); - SAFE_free(nxagentFailedToReconnectFonts.id); + if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) + { + SAFE_free(nxagentFailedToReconnectFonts.font); + SAFE_free(nxagentFailedToReconnectFonts.id); - FatalError("Font: font not reconnected memory allocation failed!.\n"); + FatalError("Font: font not reconnected memory allocation failed!.\n"); + } + + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentCollectFailedFont: allocated [%d] bytes.\n", + 8 * (sizeof(FontPtr)+ sizeof(XID))); + #endif } + else if (nxagentFailedToReconnectFonts.index == nxagentFailedToReconnectFonts.size - 1) + { + int num = 2 * nxagentFailedToReconnectFonts.size; - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentCollectFailedFont: allocated [%d] bytes.\n", - 8 * (sizeof(FontPtr)+ sizeof(XID))); - #endif - } - else if (nxagentFailedToReconnectFonts.index == nxagentFailedToReconnectFonts.size - 1) - { - nxagentFailedToReconnectFonts.size *= 2; + FontPtr *tmp1 = realloc(nxagentFailedToReconnectFonts.font, num * sizeof(FontPtr)); + XID *tmp2 = realloc(nxagentFailedToReconnectFonts.id, num * sizeof(XID)); - nxagentFailedToReconnectFonts.font = realloc(nxagentFailedToReconnectFonts.font, - nxagentFailedToReconnectFonts.size * - sizeof(FontPtr)); + if (tmp1 == NULL || tmp2 == NULL) + { + SAFE_free(tmp1); + SAFE_free(tmp2); - nxagentFailedToReconnectFonts.id = realloc(nxagentFailedToReconnectFonts.id, - nxagentFailedToReconnectFonts.size * - sizeof(XID)); + FatalError("Font: font not reconnected memory re-allocation failed!.\n"); + } - if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) - { - FatalError("Font: font not reconnected memory re-allocation failed!.\n"); - } + nxagentFailedToReconnectFonts.size = num; + nxagentFailedToReconnectFonts.font = tmp1; + nxagentFailedToReconnectFonts.id = tmp2; - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr,"nxagentCollectFailedFont: reallocated memory.\n "); - #endif - } + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr,"nxagentCollectFailedFont: reallocated memory.\n "); + #endif + } - nxagentFailedToReconnectFonts.font[nxagentFailedToReconnectFonts.index] = fpt; + nxagentFailedToReconnectFonts.font[nxagentFailedToReconnectFonts.index] = fpt; - nxagentFailedToReconnectFonts.id[nxagentFailedToReconnectFonts.index] = id; + nxagentFailedToReconnectFonts.id[nxagentFailedToReconnectFonts.index] = id; - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentCollectFailedFont: font not reconnected at [%p], " - "put in nxagentFailedToReconnectFonts.font[%d] = [%p], with XID = [%lu].\n", - (void*) fpt, nxagentFailedToReconnectFonts.index, - (void *)nxagentFailedToReconnectFonts.font[nxagentFailedToReconnectFonts.index], - nxagentFailedToReconnectFonts.id[nxagentFailedToReconnectFonts.index]); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentCollectFailedFont: font not reconnected at [%p], " + "put in nxagentFailedToReconnectFonts.font[%d] = [%p], with XID = [%lu].\n", + (void*) fpt, nxagentFailedToReconnectFonts.index, + (void *)nxagentFailedToReconnectFonts.font[nxagentFailedToReconnectFonts.index], + nxagentFailedToReconnectFonts.id[nxagentFailedToReconnectFonts.index]); + #endif - nxagentFailedToReconnectFonts.index++; + nxagentFailedToReconnectFonts.index++; } static void nxagentFontReconnect(FontPtr pFont, XID param1, void * param2) { - int i; - Bool *pBool = (Bool*)param2; + int i; + Bool *pBool = (Bool*)param2; - if (pFont == NULL) - return; + if (pFont == NULL) + return; - nxagentPrivFont *privFont = nxagentFontPriv(pFont); + nxagentPrivFont *privFont = nxagentFontPriv(pFont); - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentFontReconnect: pFont %p - XID %lx - name %s\n", - (void*) pFont, (privFont -> font_struct) ? nxagentFont(pFont) : 0, - privFont -> fontName); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentFontReconnect: pFont %p - XID %lx - name %s\n", + (void*) pFont, (privFont -> font_struct) ? nxagentFont(pFont) : 0, + privFont -> fontName); + #endif - for (i = 0; i < CACHE_INDEX; i++) - { - if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) + for (i = 0; i < CACHE_INDEX; i++) { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "\tfound in cache"); - #endif + if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "\tfound in cache"); + #endif - if (!CACHE_FSTRUCT(i)) - { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, " --- font struct not valid\n"); - #endif + if (!CACHE_FSTRUCT(i)) + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, " --- font struct not valid\n"); + #endif - break; - } + break; + } - nxagentFontStruct(pFont) = CACHE_FSTRUCT(i); + nxagentFontStruct(pFont) = CACHE_FSTRUCT(i); - return; + return; + } } - } - if (i == CACHE_INDEX) - { - FatalError("nxagentFontReconnect: font not found in cache."); - } + if (i == CACHE_INDEX) + { + FatalError("nxagentFontReconnect: font not found in cache."); + } - privFont -> font_struct = nxagentLoadQueryFont(nxagentDisplay, privFont -> fontName, pFont); + privFont -> font_struct = nxagentLoadQueryFont(nxagentDisplay, privFont -> fontName, pFont); - if ((privFont -> font_struct == NULL) && reconnectFlexibility) - { - privFont -> font_struct = nxagentLoadBestQueryFont(nxagentDisplay, privFont -> fontName, pFont); - } + if ((privFont -> font_struct == NULL) && reconnectFlexibility) + { + privFont -> font_struct = nxagentLoadBestQueryFont(nxagentDisplay, privFont -> fontName, pFont); + } - if (privFont->font_struct != NULL) - { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "\tXID %lx\n", privFont -> font_struct -> fid); - #endif + if (privFont->font_struct != NULL) + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "\tXID %lx\n", privFont -> font_struct -> fid); + #endif - CACHE_FSTRUCT(i) = privFont -> font_struct; - } - else - { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentFontReconnect: failed\n"); - #endif + CACHE_FSTRUCT(i) = privFont -> font_struct; + } + else + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentFontReconnect: failed\n"); + #endif - nxagentCollectFailedFont(pFont, param1); + nxagentCollectFailedFont(pFont, param1); - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentFontReconnect: reconnection of font [%s] failed.\n", - privFont -> fontName); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentFontReconnect: reconnection of font [%s] failed.\n", + privFont -> fontName); + #endif - nxagentSetReconnectError(FAILED_RESUME_FONTS_ALERT, - "Couldn't restore the font '%s'", privFont -> fontName); + nxagentSetReconnectError(FAILED_RESUME_FONTS_ALERT, + "Couldn't restore the font '%s'", privFont -> fontName); - *pBool = False; - } + *pBool = False; + } - return; + return; } static void nxagentFreeCacheBeforeReconnect(void) { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - printFontCacheDump("nxagentFreeCacheBeforeReconnect"); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + printFontCacheDump("nxagentFreeCacheBeforeReconnect"); + #endif - for (int i = 0; i < CACHE_INDEX; i++) - { - if (CACHE_FSTRUCT(i)) + for (int i = 0; i < CACHE_INDEX; i++) { - nxagentFreeFont(CACHE_FSTRUCT(i)); - CACHE_FSTRUCT(i) = NULL; + if (CACHE_FSTRUCT(i)) + { + nxagentFreeFont(CACHE_FSTRUCT(i)); + CACHE_FSTRUCT(i) = NULL; + } } - } } static void nxagentCleanCacheAfterReconnect(void) { - int real_size = CACHE_INDEX; + int real_size = CACHE_INDEX; - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - printFontCacheDump("nxagentCleanCacheAfterReconnect"); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + printFontCacheDump("nxagentCleanCacheAfterReconnect"); + #endif - for (int i = 0; i < CACHE_INDEX; i++) - { - if(CACHE_FSTRUCT(i) == NULL) + for (int i = 0; i < CACHE_INDEX; i++) { - SAFE_XFree(CACHE_NAME(i)); - real_size--; + if (CACHE_FSTRUCT(i) == NULL) + { + SAFE_XFree(CACHE_NAME(i)); + real_size--; + } } - } - for (int i = 0; i < real_size; i++) - { - int j; - nxCacheFontEntryRecPtr swapEntryPtr; + for (int i = 0; i < real_size; i++) + { + int j; + nxCacheFontEntryRecPtr swapEntryPtr; - /* Find - first bad occurrence if exist. */ - while ((i < real_size) && CACHE_FSTRUCT(i)) i++; + /* Find - first bad occurrence if exist. */ + while ((i < real_size) && CACHE_FSTRUCT(i)) + i++; - /* Really nothing more to do. */ - if (i == real_size) - break; + /* Really nothing more to do. */ + if (i == real_size) + break; - /* - * Find - first good occurrence (moving backward from right end) entry in - * order to replace the bad one. - */ - for (j = CACHE_INDEX - 1; CACHE_FSTRUCT(j) == NULL; j--); - - /* - * Now we can swap the two entry and reduce the Cache index - */ - swapEntryPtr = CACHE_ENTRY(i); - CACHE_ENTRY(i) = CACHE_ENTRY(j); - CACHE_ENTRY(j) = swapEntryPtr; - } + /* + * Find - first good occurrence (moving backward from right end) entry in + * order to replace the bad one. + */ + for (j = CACHE_INDEX - 1; CACHE_FSTRUCT(j) == NULL; j--); - CACHE_INDEX = real_size; + /* + * Now we can swap the two entry and reduce the Cache index + */ + swapEntryPtr = CACHE_ENTRY(i); + CACHE_ENTRY(i) = CACHE_ENTRY(j); + CACHE_ENTRY(j) = swapEntryPtr; + } + + CACHE_INDEX = real_size; } #ifdef NXAGENT_RECONNECT_FONT_DEBUG static void printFontCacheDump(char* msg) { - fprintf(stderr, "%s - begin -\n", msg); + fprintf(stderr, "%s - begin -\n", msg); - for (int i = 0; i < CACHE_INDEX; i++) - { - if (CACHE_FSTRUCT(i)) + for (int i = 0; i < CACHE_INDEX; i++) { - fprintf(stderr, "\tXID %lx - %s\n", CACHE_FSTRUCT(i) -> fid, CACHE_NAME(i)); - } - else - { - fprintf(stderr, "\tdestroyed - %s\n", CACHE_NAME(i)); + if (CACHE_FSTRUCT(i)) + { + fprintf(stderr, "\tXID %lx - %s\n", CACHE_FSTRUCT(i) -> fid, CACHE_NAME(i)); + } + else + { + fprintf(stderr, "\tdestroyed - %s\n", CACHE_NAME(i)); + } } - } - fprintf(stderr, "%s - end -\n", msg); + fprintf(stderr, "%s - end -\n", msg); } #endif Bool nxagentReconnectAllFonts(void *p0) { - Bool fontSuccess = True; + Bool fontSuccess = True; - reconnectFlexibility = *((int *) p0); + reconnectFlexibility = *((int *) p0); - #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG) - fprintf(stderr, "nxagentReconnectAllFonts\n"); - #endif + #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG) + fprintf(stderr, "nxagentReconnectAllFonts\n"); + #endif - /* - * The resource type RT_NX_FONT is created on the server client - * only, so we can avoid to loop through all the clients. - */ + /* + * The resource type RT_NX_FONT is created on the server client + * only, so we can avoid to loop through all the clients. + */ - FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, - (FindResType) nxagentFontReconnect, &fontSuccess); + FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, + (FindResType) nxagentFontReconnect, &fontSuccess); - for (int cid = 0; cid < MAXCLIENTS; cid++) - { - if (clients[cid]) + for (int cid = 0; cid < MAXCLIENTS; cid++) { - FindClientResourcesByType(clients[cid], RT_FONT, - (FindResType) nxagentFontReconnect, &fontSuccess); + if (clients[cid]) + { + FindClientResourcesByType(clients[cid], RT_FONT, + (FindResType) nxagentFontReconnect, &fontSuccess); + } } - } - if (fontSuccess) - { - nxagentCleanCacheAfterReconnect(); - } + if (fontSuccess) + { + nxagentCleanCacheAfterReconnect(); + } - return fontSuccess; + return fontSuccess; } static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2) { - int i; - nxagentPrivFont *privFont; - Bool *pBool = (Bool*)param2; + int i; + Bool *pBool = (Bool*)param2; - if (pFont == NULL) - return; + if (pFont == NULL) + return; - privFont = nxagentFontPriv(pFont); + nxagentPrivFont *privFont = nxagentFontPriv(pFont); - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentFailedFontReconnect: pFont %p - XID %lx - name %s\n", - (void*) pFont, (privFont -> font_struct) ? nxagentFont(pFont) : 0, - privFont -> fontName); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentFailedFontReconnect: pFont %p - XID %lx - name %s\n", + (void*) pFont, (privFont -> font_struct) ? nxagentFont(pFont) : 0, + privFont -> fontName); + #endif - for (i = 0; i < CACHE_INDEX; i++) - { - if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) + for (i = 0; i < CACHE_INDEX; i++) { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "\tfound in cache"); - #endif + if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "\tfound in cache"); + #endif - if (!CACHE_FSTRUCT(i)) - { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, " --- font struct not valid\n"); - #endif + if (!CACHE_FSTRUCT(i)) + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, " --- font struct not valid\n"); + #endif - break; - } + break; + } - nxagentFontStruct(pFont) = CACHE_FSTRUCT(i); + nxagentFontStruct(pFont) = CACHE_FSTRUCT(i); - return; + return; + } } - } - if (i == CACHE_INDEX) - { - FatalError("nxagentFailedFontReconnect: font not found in cache."); - } + if (i == CACHE_INDEX) + { + FatalError("nxagentFailedFontReconnect: font not found in cache."); + } - privFont -> font_struct = nxagentLoadQueryFont(nxagentDisplay, privFont -> fontName, pFont); + privFont -> font_struct = nxagentLoadQueryFont(nxagentDisplay, privFont -> fontName, pFont); - if (privFont -> font_struct == NULL) - { - privFont -> font_struct = nxagentLoadBestQueryFont(nxagentDisplay, privFont -> fontName, pFont); - } + if (privFont -> font_struct == NULL) + { + privFont -> font_struct = nxagentLoadBestQueryFont(nxagentDisplay, privFont -> fontName, pFont); + } - if (privFont->font_struct != NULL) - { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "\tXID %lx\n", privFont -> font_struct -> fid); - #endif + if (privFont->font_struct != NULL) + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "\tXID %lx\n", privFont -> font_struct -> fid); + #endif - CACHE_FSTRUCT(i) = privFont -> font_struct; - } - else - { - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentFailedFontReconnect: failed\n"); - #endif + CACHE_FSTRUCT(i) = privFont -> font_struct; + } + else + { + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentFailedFontReconnect: failed\n"); + #endif - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentFailedFontReconnect: reconnection of font [%s] failed.\n", - privFont -> fontName); - #endif + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentFailedFontReconnect: reconnection of font [%s] failed.\n", + privFont -> fontName); + #endif - nxagentSetReconnectError(FAILED_RESUME_FONTS_ALERT, - "Couldn't restore the font '%s'", privFont -> fontName); + nxagentSetReconnectError(FAILED_RESUME_FONTS_ALERT, + "Couldn't restore the font '%s'", privFont -> fontName); - *pBool = False; - } + *pBool = False; + } - return; + return; } static void nxagentFreeFailedToReconnectFonts(void) { - SAFE_free(nxagentFailedToReconnectFonts.font); - SAFE_free(nxagentFailedToReconnectFonts.id); + SAFE_free(nxagentFailedToReconnectFonts.font); + SAFE_free(nxagentFailedToReconnectFonts.id); - nxagentFailedToReconnectFonts.size = 0; - nxagentFailedToReconnectFonts.index = 0; + nxagentFailedToReconnectFonts.size = 0; + nxagentFailedToReconnectFonts.index = 0; } Bool nxagentReconnectFailedFonts(void *p0) { - int attempt = 1; - const int maxAttempt = 5; - - char **fontPaths, **localFontPaths, **newFontPaths; - char fontServerPath[256] = ""; - int nPaths = 0; - - Bool repeat = True; - Bool fontSuccess = True; + char fontServerPath[256] = ""; - reconnectFlexibility = *((int *) p0); + reconnectFlexibility = *((int *) p0); - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentReconnectFailedFonts: \n"); - #endif - - if (nxagentGetFontServerPath(fontServerPath, sizeof(fontServerPath)) == False) - { - #ifdef WARNING - fprintf(stderr, "nxagentReconnectFailedFonts: WARNING! " - "Font server tunneling not retrieved.\n"); + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentReconnectFailedFonts: \n"); #endif - } - - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentReconnectFailedFonts: font server path [%s]\n", fontServerPath); - #endif - - fontPaths = XGetFontPath(nxagentDisplay, &nPaths); - - if ((newFontPaths = malloc((nPaths + 1) * sizeof(char *))) == NULL) - { - FatalError("nxagentReconnectFailedFonts: malloc failed."); - } - - memcpy(newFontPaths, fontPaths, nPaths * sizeof(char*)); - localFontPaths = newFontPaths; - localFontPaths += nPaths; - *localFontPaths = fontServerPath; + if (nxagentGetFontServerPath(fontServerPath, sizeof(fontServerPath)) == False) + { + #ifdef WARNING + fprintf(stderr, "nxagentReconnectFailedFonts: WARNING! " + "Font server tunneling not retrieved.\n"); + #endif + } - while(repeat) - { #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentReconnectFailedFonts: attempt [%d].\n", attempt); + fprintf(stderr, "nxagentReconnectFailedFonts: font server path [%s]\n", fontServerPath); #endif - repeat = False; + int nPaths = 0; + char **fontPaths = XGetFontPath(nxagentDisplay, &nPaths); + char **newFontPaths = malloc((nPaths + 1) * sizeof(char *)); - XSetFontPath(nxagentDisplay, newFontPaths, nPaths + 1); - nxagentFreeRemoteFontList(&nxagentRemoteFontList); - nxagentListRemoteFonts("*", nxagentMaxFontNames); + if (newFontPaths == NULL) + { + FatalError("nxagentReconnectFailedFonts: malloc failed."); + } - for(int i = 0; i < nxagentFailedToReconnectFonts.index; i++) + memcpy(newFontPaths, fontPaths, nPaths * sizeof(char*)); + + char **localFontPaths = newFontPaths; + localFontPaths += nPaths; + *localFontPaths = fontServerPath; + + int attempt = 1; + const int maxAttempt = 5; + Bool repeat = True; + while (repeat) { - fontSuccess = True; + #ifdef NXAGENT_RECONNECT_FONT_DEBUG + fprintf(stderr, "nxagentReconnectFailedFonts: attempt [%d].\n", attempt); + #endif - if(nxagentFailedToReconnectFonts.font[i]) - { - nxagentFailedFontReconnect(nxagentFailedToReconnectFonts.font[i], - nxagentFailedToReconnectFonts.id[i], - &fontSuccess); + repeat = False; - if (fontSuccess) - { - nxagentFailedToReconnectFonts.font[i] = NULL; - } - else + XSetFontPath(nxagentDisplay, newFontPaths, nPaths + 1); + nxagentFreeRemoteFontList(&nxagentRemoteFontList); + nxagentListRemoteFonts("*", nxagentMaxFontNames); + + for (int i = 0; i < nxagentFailedToReconnectFonts.index; i++) { - repeat = True; + Bool fontSuccess = True; + + if (nxagentFailedToReconnectFonts.font[i]) + { + nxagentFailedFontReconnect(nxagentFailedToReconnectFonts.font[i], + nxagentFailedToReconnectFonts.id[i], + &fontSuccess); + + if (fontSuccess) + { + nxagentFailedToReconnectFonts.font[i] = NULL; + } + else + { + repeat = True; + } + } } - } - } + attempt++; - attempt++; - - if (attempt > maxAttempt) - { - nxagentFreeFailedToReconnectFonts(); + if (attempt > maxAttempt) + { + nxagentFreeFailedToReconnectFonts(); - XSetFontPath(nxagentDisplay, fontPaths, nPaths); - nxagentFreeRemoteFontList(&nxagentRemoteFontList); - nxagentListRemoteFonts("*", nxagentMaxFontNames); + XSetFontPath(nxagentDisplay, fontPaths, nPaths); + nxagentFreeRemoteFontList(&nxagentRemoteFontList); + nxagentListRemoteFonts("*", nxagentMaxFontNames); - XFreeFontPath(fontPaths); - SAFE_free(newFontPaths); + XFreeFontPath(fontPaths); + SAFE_free(newFontPaths); - return False; + return False; + } } - } - nxagentFreeFailedToReconnectFonts(); + nxagentFreeFailedToReconnectFonts(); - XSetFontPath(nxagentDisplay, fontPaths, nPaths); + XSetFontPath(nxagentDisplay, fontPaths, nPaths); - XFreeFontPath(fontPaths); - SAFE_free(newFontPaths); + XFreeFontPath(fontPaths); + SAFE_free(newFontPaths); - nxagentCleanCacheAfterReconnect(); + nxagentCleanCacheAfterReconnect(); - return True; + return True; } Bool nxagentDisconnectAllFonts(void) { - Bool fontSuccess = True; + Bool fontSuccess = True; - #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG) - fprintf(stderr, "nxagentDisconnectAllFonts\n"); - #endif + #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG) + fprintf(stderr, "nxagentDisconnectAllFonts\n"); + #endif - nxagentFreeRemoteFontList(&nxagentRemoteFontList); - nxagentFreeCacheBeforeReconnect(); + nxagentFreeRemoteFontList(&nxagentRemoteFontList); + nxagentFreeCacheBeforeReconnect(); - /* - * The resource type RT_NX_FONT is created on the server client - * only, so we can avoid to loop through all the clients. - */ + /* + * The resource type RT_NX_FONT is created on the server client + * only, so we can avoid to loop through all the clients. + */ - FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, - (FindResType) nxagentFontDisconnect, &fontSuccess); + FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, + (FindResType) nxagentFontDisconnect, &fontSuccess); - for(int cid = 0; cid < MAXCLIENTS; cid++) - { - if( clients[cid] && fontSuccess ) + for (int cid = 0; cid < MAXCLIENTS; cid++) { - FindClientResourcesByType(clients[cid], RT_FONT, - (FindResType) nxagentFontDisconnect, &fontSuccess); + if (clients[cid] && fontSuccess) + { + FindClientResourcesByType(clients[cid], RT_FONT, + (FindResType) nxagentFontDisconnect, &fontSuccess); + } } - } - return True; + return True; } static Bool nxagentGetFontServerPath(char * fontServerPath, int size) { - char path[256] = {0}; - - if (NXGetFontParameters(nxagentDisplay, sizeof(path), path) == True) - { - /* the length is stored in the first byte and is therefore limited to 255 */ - unsigned int len = *path; + char path[256] = {0}; - if (len) + if (NXGetFontParameters(nxagentDisplay, sizeof(path), path) == True) { - snprintf(fontServerPath, min(size, len + 1), "%s", path + 1); + /* the length is stored in the first byte and is therefore limited to 255 */ + unsigned int len = *path; - #ifdef TEST - fprintf(stderr, "%s: Got path [%s].\n", __func__, - fontServerPath); - #endif + if (len) + { + snprintf(fontServerPath, min(size, len + 1), "%s", path + 1); + + #ifdef TEST + fprintf(stderr, "%s: Got path [%s].\n", __func__, + fontServerPath); + #endif + } + else + { + #ifdef TEST + fprintf(stderr, "%s: WARNING! Font server tunneling not enabled.\n", __func__); + #endif + + return False; + } } else { - #ifdef TEST - fprintf(stderr, "%s: WARNING! Font server tunneling not enabled.\n", __func__); - #endif + #ifdef TEST + fprintf(stderr, "%s: WARNING! Failed to get path for font server tunneling.\n", __func__); + #endif - return False; + return False; } - } - else - { - #ifdef TEST - fprintf(stderr, "%s: WARNING! Failed to get path for font server tunneling.\n", __func__); - #endif - - return False; - } - return True; + return True; } void nxagentVerifySingleFontPath(char **dest, const char *fontDir) { - if (!dest || !*dest) - return; + if (!dest || !*dest) + return; - #ifdef TEST - fprintf(stderr, "%s: Assuming fonts in directory [%s].\n", __func__, - validateString(fontDir)); - #endif + #ifdef TEST + fprintf(stderr, "%s: Assuming fonts in directory [%s].\n", __func__, + validateString(fontDir)); + #endif - for (int i = 0; ; i++) - { - char *tmppath = NULL; - int rc; + for (int i = 0; ; i++) + { + char *tmppath = NULL; + int rc; - const char *subdir = nxagentFontSubdirs[i]; + const char *subdir = nxagentFontSubdirs[i]; - if (subdir == NULL) - return; + if (subdir == NULL) + return; - if (**dest != '\0') - { - rc = asprintf(&tmppath, "%s,%s/%s", *dest, fontDir, subdir); - } - else - { - rc = asprintf(&tmppath, "%s/%s", fontDir, subdir); - } + if (**dest != '\0') + { + rc = asprintf(&tmppath, "%s,%s/%s", *dest, fontDir, subdir); + } + else + { + rc = asprintf(&tmppath, "%s/%s", fontDir, subdir); + } - if (rc == -1) - return; + if (rc == -1) + return; - SAFE_free(*dest); - *dest = tmppath; - tmppath = NULL; - } + SAFE_free(*dest); + *dest = tmppath; + tmppath = NULL; + } } void nxagentVerifyDefaultFontPath(void) { - static char *fontPath; + static char *fontPath; - #ifdef TEST - fprintf(stderr, "%s: Going to search for one or more valid font paths.\n", __func__); - #endif - - /* - * Set the default font path as the first choice. - */ - - if ((fontPath = strdup(defaultFontPath)) == NULL) - { - #ifdef WARNING - fprintf(stderr, "%s: WARNING! Unable to allocate memory for a new font path. " - "Using the default font path [%s].\n", __func__, - validateString(defaultFontPath)); + #ifdef TEST + fprintf(stderr, "%s: Going to search for one or more valid font paths.\n", __func__); #endif - return; - } - - for (int i = 0; ; i++) - { - int j; - const char *dir = nxagentFontDirs[i]; + /* + * Set the default font path as the first choice. + */ - if (dir == NULL) + if ((fontPath = strdup(defaultFontPath)) == NULL) { - break; + #ifdef WARNING + fprintf(stderr, "%s: WARNING! Unable to allocate memory for a new font path. " + "Using the default font path [%s].\n", __func__, + validateString(defaultFontPath)); + #endif + + return; } - else + + for (int i = 0; ; i++) { - for (j = 0; j <= i; j++) - { - //if (strcmp(nxagentFontDirs[j], dir) == 0) - if (nxagentFontDirs[j] == dir) + int j; + const char *dir = nxagentFontDirs[i]; + + if (dir == NULL) { - break; + break; } - } - - if (j == i) - { - nxagentVerifySingleFontPath(&fontPath, dir); - } + else + { + for (j = 0; j <= i; j++) + { + //if (strcmp(nxagentFontDirs[j], dir) == 0) + if (nxagentFontDirs[j] == dir) + { + break; + } + } + + if (j == i) + { + nxagentVerifySingleFontPath(&fontPath, dir); + } #ifdef TEST - else - { - fprintf(stderr, "%s: Skipping duplicate font dir [%s].\n", __func__, - validateString(dir)); - } + else + { + fprintf(stderr, "%s: Skipping duplicate font dir [%s].\n", __func__, + validateString(dir)); + } #endif + } } - } - if (*fontPath == '\0') - { - #ifdef WARNING - fprintf(stderr, "%s: WARNING! Can't find a valid font directory.\n", __func__); - fprintf(stderr, "%s: WARNING! Using font path [%s].\n", __func__, - validateString(defaultFontPath)); - #endif - } - else - { - /* do _not_ free defaultFontPath here - it's either set at compile time or - part of argv */ - defaultFontPath = fontPath; + if (*fontPath == '\0') + { + #ifdef WARNING + fprintf(stderr, "%s: WARNING! Can't find a valid font directory.\n", __func__); + fprintf(stderr, "%s: WARNING! Using font path [%s].\n", __func__, + validateString(defaultFontPath)); + #endif + } + else + { + /* do _not_ free defaultFontPath here - it's either set at compile time or + part of argv */ + defaultFontPath = fontPath; - #ifdef TEST - fprintf(stderr, "%s: Using font path [%s].\n", __func__, - validateString(defaultFontPath)); - #endif - } + #ifdef TEST + fprintf(stderr, "%s: Using font path [%s].\n", __func__, + validateString(defaultFontPath)); + #endif + } - return; + return; } XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFont) { - XFontStruct* fs; - xCharInfo *xcip; - - fs = (XFontStruct *) malloc (sizeof (XFontStruct)); + XFontStruct* fs = (XFontStruct *) malloc (sizeof (XFontStruct)); - if (fs == NULL) - { - #ifdef WARNING - fprintf(stderr, "nxagentLoadQueryFont: WARNING! Failed allocation of XFontStruct.\n"); - #endif + if (fs == NULL) + { + #ifdef WARNING + fprintf(stderr, "nxagentLoadQueryFont: WARNING! Failed allocation of XFontStruct.\n"); + #endif - return (XFontStruct *)NULL; - } + return (XFontStruct *)NULL; + } #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentLoadQueryFont: Looking for font '%s'.\n", name); #endif - if (nxagentFontLookUp(name) == 0) - { - #ifdef DEBUG - fprintf(stderr, "nxagentLoadQueryFont: WARNING! Font not found '%s'.\n", name); - #endif + if (nxagentFontLookUp(name) == 0) + { + #ifdef DEBUG + fprintf(stderr, "nxagentLoadQueryFont: WARNING! Font not found '%s'.\n", name); + #endif - SAFE_free(fs); + SAFE_free(fs); - return (XFontStruct *) NULL; - } + return (XFontStruct *) NULL; + } - fs -> ext_data = NULL; /* Hook for extension to hang data.*/ - fs -> fid = XLoadFont(dpy, name); /* Font id for this font. */ - fs -> direction = pFont->info.drawDirection; /* Hint about the direction font is painted. */ - fs -> min_char_or_byte2 = pFont->info.firstCol; /* First character. */ - fs -> max_char_or_byte2 = pFont->info.lastCol; /* Last character. */ - fs -> min_byte1 = pFont->info.firstRow; /* First row that exists. */ - fs -> max_byte1 = pFont->info.lastRow; /* Last row that exists. */ - fs -> all_chars_exist = pFont->info.allExist; /* Flag if all characters have nonzero size. */ - fs -> default_char = pFont->info.defaultCh; /* Char to print for undefined character. */ - fs -> n_properties = pFont->info.nprops; /* How many properties there are. */ - - /* - * If no properties defined for the font, then it is bad - * font, but shouldn't try to read nothing. - */ + fs -> ext_data = NULL; /* Hook for extension to hang data.*/ + fs -> fid = XLoadFont(dpy, name); /* Font id for this font. */ + fs -> direction = pFont->info.drawDirection; /* Hint about the direction font is painted. */ + fs -> min_char_or_byte2 = pFont->info.firstCol; /* First character. */ + fs -> max_char_or_byte2 = pFont->info.lastCol; /* Last character. */ + fs -> min_byte1 = pFont->info.firstRow; /* First row that exists. */ + fs -> max_byte1 = pFont->info.lastRow; /* Last row that exists. */ + fs -> all_chars_exist = pFont->info.allExist; /* Flag if all characters have nonzero size. */ + fs -> default_char = pFont->info.defaultCh; /* Char to print for undefined character. */ + fs -> n_properties = pFont->info.nprops; /* How many properties there are. */ - if (fs -> n_properties > 0) - { - register long nbytes; - - nbytes = pFont -> info.nprops * sizeof(XFontProp); - fs -> properties = (XFontProp *) malloc((unsigned) nbytes); + /* + * If no properties defined for the font, then it is bad + * font, but shouldn't try to read nothing. + */ - if (fs -> properties == NULL) + if (fs -> n_properties > 0) { - #ifdef WARNING - fprintf(stderr, "nxagentLoadQueryFont: WARNING! Failed allocation of XFontProp."); - #endif + long nbytes; - SAFE_free(fs); - return (XFontStruct *) NULL; - } + nbytes = pFont -> info.nprops * sizeof(XFontProp); + fs -> properties = (XFontProp *) malloc((unsigned) nbytes); - memmove(fs -> properties, pFont -> info.props, nbytes); - } + if (fs -> properties == NULL) + { + #ifdef WARNING + fprintf(stderr, "nxagentLoadQueryFont: WARNING! Failed allocation of XFontProp."); + #endif - xcip = (xCharInfo *) &pFont -> info.ink_minbounds; + SAFE_free(fs); + return (XFontStruct *) NULL; + } + + memmove(fs -> properties, pFont -> info.props, nbytes); + } - fs -> min_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing); - fs -> min_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing); - fs -> min_bounds.width = cvtINT16toShort(xcip -> characterWidth); - fs -> min_bounds.ascent = cvtINT16toShort(xcip -> ascent); - fs -> min_bounds.descent = cvtINT16toShort(xcip -> descent); - fs -> min_bounds.attributes = xcip -> attributes; + xCharInfo *xcip = (xCharInfo *) &pFont -> info.ink_minbounds; - xcip = (xCharInfo *) &pFont -> info.ink_maxbounds; + fs -> min_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing); + fs -> min_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing); + fs -> min_bounds.width = cvtINT16toShort(xcip -> characterWidth); + fs -> min_bounds.ascent = cvtINT16toShort(xcip -> ascent); + fs -> min_bounds.descent = cvtINT16toShort(xcip -> descent); + fs -> min_bounds.attributes = xcip -> attributes; - fs -> max_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing); - fs -> max_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing); - fs -> max_bounds.width = cvtINT16toShort(xcip -> characterWidth); - fs -> max_bounds.ascent = cvtINT16toShort(xcip -> ascent); - fs -> max_bounds.descent = cvtINT16toShort(xcip -> descent); - fs -> max_bounds.attributes = xcip -> attributes; + xcip = (xCharInfo *) &pFont -> info.ink_maxbounds; - fs -> per_char = NULL; /* First_char to last_char information. */ - fs -> ascent = pFont->info.fontAscent; /* Logical extent above baseline for spacing. */ - fs -> descent = pFont->info.fontDescent; /* Logical decent below baseline for spacing. */ + fs -> max_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing); + fs -> max_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing); + fs -> max_bounds.width = cvtINT16toShort(xcip -> characterWidth); + fs -> max_bounds.ascent = cvtINT16toShort(xcip -> ascent); + fs -> max_bounds.descent = cvtINT16toShort(xcip -> descent); + fs -> max_bounds.attributes = xcip -> attributes; - return fs; + fs -> per_char = NULL; /* First_char to last_char information. */ + fs -> ascent = pFont->info.fontAscent; /* Logical extent above baseline for spacing. */ + fs -> descent = pFont->info.fontDescent; /* Logical decent below baseline for spacing. */ + + return fs; } int nxagentFreeFont(XFontStruct *fs) { - if (fs->per_char) - { - #ifdef USE_XF86BIGFONT - _XF86BigfontFreeFontMetrics(fs); - #else - SAFE_free(fs->per_char); - #endif - } + if (fs->per_char) + { + #ifdef USE_XF86BIGFONT + _XF86BigfontFreeFontMetrics(fs); + #else + SAFE_free(fs->per_char); + #endif + } - SAFE_free(fs->properties); - SAFE_XFree(fs); + SAFE_free(fs->properties); + SAFE_XFree(fs); - return 1; + return 1; } int nxagentSplitString(char *string, char *fields[], int nfields, char *sep) { - int seplen = strlen(sep); - int len = strlen(string); + int seplen = strlen(sep); + int len = strlen(string); - char *current = string; + char *current = string; - int i = 0; - int last = 0; + int i = 0; + int last = 0; - for (;;) - { - char *next = NULL; - - if (current < string + len) + for (;;) { - next = strstr(current, sep); - } + char *next = NULL; - if (next == NULL) - { - next = string + len; - last = 1; - } + if (current < string + len) + { + next = strstr(current, sep); + } - int fieldlen = next - current; + if (next == NULL) + { + next = string + len; + last = 1; + } - if (i < nfields) - { - fields[i] = strndup(current, fieldlen); - } - else - { - fields[i] = NULL; - } + int fieldlen = next - current; + + if (i < nfields) + { + fields[i] = strndup(current, fieldlen); + } + else + { + fields[i] = NULL; + } - current = next + seplen; + current = next + seplen; - i++; + i++; - if (last == 1) - { - break; + if (last == 1) + { + break; + } } - } - return i; + return i; } char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution) { - char *scalableFontName; - - /* FIXME: use str(n)dup()? */ - if ((scalableFontName = malloc(strlen(fontName) + 1)) == NULL) - { - #ifdef PANIC - fprintf(stderr, "nxagentMakeScalableFontName: PANIC! malloc() failed.\n"); - #endif + char *scalableFontName; - return NULL; - } + /* FIXME: use str(n)dup()? */ + if ((scalableFontName = malloc(strlen(fontName) + 1)) == NULL) + { + #ifdef PANIC + fprintf(stderr, "nxagentMakeScalableFontName: PANIC! malloc() failed.\n"); + #endif - scalableFontName[0] = '\0'; + return NULL; + } - if (*fontName != '-') - { - goto MakeScalableFontNameError; - } + scalableFontName[0] = '\0'; - const char *s = fontName; + if (*fontName != '-') + { + goto MakeScalableFontNameError; + } - int field = 0; + const char *s = fontName; - while (s != NULL) - { - s = strchr(s + 1, '-'); + int field = 0; - if (s != NULL) + while (s != NULL) { - if (field == 6 || field == 7 || field == 11) - { - /* - * PIXEL_SIZE || POINT_SIZE || AVERAGE_WIDTH - */ + s = strchr(s + 1, '-'); - strcat(scalableFontName, "-0"); - } - else if (scalableResolution == 1 && (field == 8 || field == 9)) - { - /* - * RESOLUTION_X || RESOLUTION_Y - */ - - strcat(scalableFontName, "-0"); - } - else - { - strncat(scalableFontName, fontName, s - fontName); - } + if (s != NULL) + { + if (field == 6 || field == 7 || field == 11) + { + /* + * PIXEL_SIZE || POINT_SIZE || AVERAGE_WIDTH + */ + + strcat(scalableFontName, "-0"); + } + else if (scalableResolution == 1 && (field == 8 || field == 9)) + { + /* + * RESOLUTION_X || RESOLUTION_Y + */ + + strcat(scalableFontName, "-0"); + } + else + { + strncat(scalableFontName, fontName, s - fontName); + } + + fontName = s; + } + else + { + strcat(scalableFontName, fontName); + } - fontName = s; + field++; } - else + + if (field != 14) { - strcat(scalableFontName, fontName); + goto MakeScalableFontNameError; } - field++; - } - - if (field != 14) - { - goto MakeScalableFontNameError; - } - - return scalableFontName; + return scalableFontName; MakeScalableFontNameError: - SAFE_free(scalableFontName); + SAFE_free(scalableFontName); - #ifdef DEBUG - fprintf(stderr, "nxagentMakeScalableFontName: Invalid font name.\n"); - #endif + #ifdef DEBUG + fprintf(stderr, "nxagentMakeScalableFontName: Invalid font name.\n"); + #endif - return NULL; + return NULL; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.h b/nx-X11/programs/Xserver/hw/nxagent/Font.h index c5b236562..a8eae6554 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.h @@ -82,4 +82,5 @@ void nxagentVerifyDefaultFontPath(void); int nxagentSplitString(char *string, char *fields[], int nfields, char *sep); +void nxagentFreeFontData(void); #endif /* __Font_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c index 1feb62a4d..21e888b8a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GC.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c @@ -1264,7 +1264,7 @@ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen) int nxagentSaveGCTrap = nxagentGCTrap; - nxagentGCTrap = 0; + nxagentGCTrap = False; GCPtr pGC = GetScratchGC(depth, pScreen); diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 5ac341990..5cc29234a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -80,7 +80,7 @@ static int nxagentSaveGCTrap; { \ nxagentSaveGCTrap = nxagentGCTrap;\ \ - nxagentGCTrap = 1; \ + nxagentGCTrap = True; \ } #define RESET_GC_TRAP() \ @@ -313,7 +313,7 @@ FIXME: The popup could be synchronized with one single put image, RegionUninit(&corruptedRegion); - nxagentFreeRegion(pSrcDrawable, pSrcRegion); + nxagentFreeRegion(pSrcRegion); if (nxagentDrawableStatus(pSrcDrawable) == Synchronized) { @@ -511,7 +511,7 @@ FIXME: The popup could be synchronized with one single put image, if (pClipRegionFree == True) { - nxagentFreeRegion(pSrcDrawable, pClipRegion); + nxagentFreeRegion(pClipRegion); } FreeScratchGC(targetGC); @@ -527,10 +527,10 @@ FIXME: The popup could be synchronized with one single put image, * we deallocate it explicitly only if we don't change the clip. */ - nxagentFreeRegion(pSrcDrawable, pClipRegion); + nxagentFreeRegion(pClipRegion); } - nxagentFreeRegion(pSrcDrawable, pCorruptedRegion); + nxagentFreeRegion(pCorruptedRegion); return 1; } @@ -562,7 +562,7 @@ FIXME: The popup could be synchronized with one single put image, RegionUninit(&corruptedRegion); - nxagentFreeRegion(pSrcDrawable, pSrcRegion); + nxagentFreeRegion(pSrcRegion); } return 0; @@ -800,7 +800,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); - nxagentFreeRegion(pDstDrawable, pDstRegion); + nxagentFreeRegion(pDstRegion); } } @@ -981,7 +981,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentMarkCorruptedRegion(pDstDrawable, pDstRegion); - nxagentFreeRegion(pDstDrawable, pDstRegion); + nxagentFreeRegion(pDstRegion); skip = 1; } @@ -1009,12 +1009,12 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); - nxagentFreeRegion(pDstDrawable, pDstRegion); + nxagentFreeRegion(pDstRegion); } RegionUninit(&corruptedRegion); - nxagentFreeRegion(pSrcDrawable, pSrcRegion); + nxagentFreeRegion(pSrcRegion); } } #ifdef TEST diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index fa6b9ce03..411dfe933 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -36,7 +36,7 @@ #include "Reconnect.h" #include "Dialog.h" #include "Drawable.h" -#include "Splash.h" +#include "Xdmcp.h" #include "Screen.h" #include "Millis.h" @@ -573,7 +573,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask) if (!SmartScheduleSignalEnable) { - #ifdef DEBUG fprintf(stderr, "nxagentWakeupHandler: Resetting the dispatch state after wakeup.\n"); #endif @@ -582,7 +581,6 @@ void nxagentWakeupHandler(void * data, int count, void * mask) nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; - } /* @@ -638,12 +636,10 @@ void nxagentWakeupHandler(void * data, int count, void * mask) nxagentReady = count; #ifdef TEST - if (nxagentReady == 0) { fprintf(stderr, "nxagentWakeupHandler: No X clients found to be processed.\n"); } - #endif /* @@ -714,17 +710,17 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTime) > 0) { -#ifdef TEST + #ifdef TEST fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n", nxagentOption(SleepTime)); -#endif + #endif usleep(nxagentOption(SleepTime) * 1000); } -#ifdef TEST + #ifdef TEST else if (0 == nxagentOption(SleepTime)) { fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n"); } -#endif + #endif if (nxagentReadEvents(nxagentDisplay) > 0 || nxagentReadEvents(nxagentShadowDisplay) > 0) @@ -1003,7 +999,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) if (!SmartScheduleSignalEnable) { - /* * Pay attention to the next client if this client produced * enough output. @@ -1032,9 +1027,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client); } #endif - } - return; } else if (in > 0) @@ -1048,6 +1041,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) in, client -> index); #endif +#ifdef COUNT_CLIENT_BYTES /* * This is presently unused. * @@ -1059,6 +1053,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) * #endif * */ +#endif nxagentBytesIn += in; @@ -1077,7 +1072,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) if (!SmartScheduleSignalEnable) { - if (client -> index != nxagentDispatch.client) { #ifdef DEBUG @@ -1122,9 +1116,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) } #endif } - } - } /* @@ -1168,12 +1160,10 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) */ #ifdef TEST - if (nxagentTokens.pending == TOKENS_PENDING_LIMIT) { fprintf(stderr, "nxagentDispatchHandler: WARNING! Waiting for the synchronization reply.\n"); } - #endif while (nxagentTokens.pending == TOKENS_PENDING_LIMIT) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index 9e50b5d60..9369aeb1e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -864,7 +864,7 @@ nxagentPutImageEnd: if (pRegion != NullRegion) { - nxagentFreeRegion(pDrawable, pRegion); + nxagentFreeRegion(pRegion); } } @@ -992,7 +992,7 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, if (clipRegion != NullRegion) { - nxagentFreeRegion(pDrawable, clipRegion); + nxagentFreeRegion(clipRegion); } y += h; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index e37f97e84..a713467ae 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -190,34 +190,35 @@ INCLUDES = \ #endif #endif -### NXAGENT Defines: +### list of existing NXAGENT macros: # # NXAGENT_SHAPE Old shape code # NXAGENT_SHAPE2 New shape code # NXAGENT_FIXKEYS Force the release of pressed key when losing focus # NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers. -# NXAGENT_RANDR_MODE_PREFIX Prefix for RandR modes (i.e., nx_<x>x<y>) (default: nx_) +# NXAGENT_RANDR_MODE_PREFIX Prefix for RandR display modes (i.e., nx_<x>x<y>) (default: nx_) # NXAGENT_RANDR_XINERAMA_CLIPPING cut off invisible window parts in xinerama mode (you probably do not want this) # NXAGENT_TIMESTAMP print duration for some routines +# NXAGENT_ONSTART communicate about startup phase to the original nxclient by NoMachine via selections +# NXAGENT_WAKEUP=<milliseconds> Specifies a timeout that makes WaitForSomething() return earlier than normal which +# enables nxagent to close the splash window at the right time and/or improve connection +# handling for the xdmcp option. +# This only has an effect if NX_TRANS_WAKEUP is also set for os/WaitFor.c +# NXAGENT_ARTSD enable special handling of MCOPGLOBALS property used by artsd. +# NXAGENT_RENDER_CLEANUP cleanup padding bits/bytes of glyphs to possibly increase compression rate # ### macros not investigated yet: # # NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL -# NXAGENT_RENDER_CLEANUP -# NXAGENT_WAKEUP=<milliseconds> -# NXAGENT_ONSTART -# NXAGENT_SPLASH -# NXAGENT_ARTSD # ### Debug macros: # # DEBUG_COLORMAP -# DEBUG_TREE -# NXAGENT_DEBUG +# DEBUG_TREE Include code that activates the keystroke to print the current window tree # NXAGENT_FIXKEYS_DEBUG # NXAGENT_FONTCACHE_DEBUG # NXAGENT_FONTMATCH_DEBUG -# NXAGENT_LOGO_DEBUG +# NXAGENT_LOGO_DEBUG print details about splash logo creating and paint some helper lines # NXAGENT_RECONNECT_COLORMAP_DEBUG # NXAGENT_RECONNECT_CURSOR_DEBUG # NXAGENT_RECONNECT_DEBUG @@ -228,7 +229,9 @@ INCLUDES = \ # NXAGENT_RECONNECT_SCREEN_DEBUG # NXAGENT_RECONNECT_WINDOW_DEBUG # NXAGENT_XKBD_DEBUG -# NX_DEBUG_INPUT +# NX_DEBUG_INPUT include input debugging code. Can then by controlled at runtime by +# xprop -root -f NX_DEBUG_INPUT 8b -set NX_DEBUG_INPUT "True" or +# xprop -root -f NX_DEBUG_INPUT 8b -set NX_DEBUG_INPUT "False" #if nxVersion NX_DEFINES = \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index cf156c35f..804c8c43b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -54,6 +54,7 @@ is" without express or implied warranty. #include "mi.h" #include <X11/fonts/fontstruct.h> #include "dixfontstr.h" +#include "dixstruct.h" #include "Agent.h" #include "Display.h" @@ -74,6 +75,7 @@ is" without express or implied warranty. #include "Error.h" #include "Keystroke.h" #include "Atoms.h" +#include "Client.h" #include <nx/NX.h> #include "compext/Compext.h" @@ -98,15 +100,6 @@ extern int (*ProcVector[256])(ClientPtr); */ extern int fbGCPrivateIndex; -#ifdef DPMSExtension -/* - * Stubs for the DPMS extension. - */ -void DPMSSet(int level); -int DPMSGet(int *level); -Bool DPMSSupported(void); -#endif - /* * Our error logging function. */ @@ -395,9 +388,13 @@ FIXME: These variables, if not removed at all because have probably nxagentInitKeystrokes(False); #ifdef NXAGENT_CLIPBOARD + /* FIXME: we need to call DeleteCallback at shutdown, but where? */ AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL); #endif + /* FIXME: we need to call DeleteCallback at shutdown, but where? */ + AddCallback(&ClientStateCallback, nxagentClientStateCallback, NULL); + nxagentInitAtoms(); } @@ -625,19 +622,3 @@ static void nxagentGrabServerCallback(CallbackListPtr *callbacks, void *data, nxagentGrabServerInfo.client = grab->client; nxagentGrabServerInfo.grabstate = grab->grabstate; } - -#ifdef DPMSExtension -void DPMSSet(int level) -{ -} - -int DPMSGet(int *level) -{ - return -1; -} - -Bool DPMSSupported(void) -{ - return 0; -} -#endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 950aec839..233b6df74 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -80,7 +80,8 @@ is" without express or implied warranty. #include <errno.h> -static void nxagentXkbGetNames(void); +static void nxagentXkbGetRemoteNames(void); +static void nxagentXkbClearRemoteNames(void); void nxagentKeycodeConversionSetup(void); @@ -696,6 +697,9 @@ XkbError: } #endif + /* we don't need the remote keyboard information anymore */ + nxagentXkbClearRemoteNames(); + xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); if (xkb && xkb->geom) @@ -1341,7 +1345,7 @@ void nxagentTuneXkbWrapper(void) } } -void nxagentXkbClearNames(void) +void nxagentXkbClearRemoteNames(void) { SAFE_free(nxagentRemoteRules); SAFE_free(nxagentRemoteModel); @@ -1350,7 +1354,7 @@ void nxagentXkbClearNames(void) SAFE_free(nxagentRemoteOptions); } -static void nxagentXkbGetNames(void) +static void nxagentXkbGetRemoteNames(void) { if (nxagentRemoteRules) return; @@ -1554,7 +1558,7 @@ void nxagentKeycodeConversionSetup(void) Bool nxagentGetRemoteXkbExtension(void) { nxagentXkbInfo.Opcode = nxagentXkbInfo.EventBase = nxagentXkbInfo.ErrorBase = nxagentXkbInfo.MajorVersion = nxagentXkbInfo.MinorVersion = -1; - nxagentXkbClearNames(); + nxagentXkbClearRemoteNames(); Bool result = XkbQueryExtension(nxagentDisplay, &nxagentXkbInfo.Opcode, @@ -1565,7 +1569,7 @@ Bool nxagentGetRemoteXkbExtension(void) if (result) { - nxagentXkbGetNames(); + nxagentXkbGetRemoteNames(); } #ifdef WARNING else diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index ea139b10f..73a5901f8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -428,35 +428,117 @@ void nxagentInitKeystrokes(Bool force) nxagentDumpKeystrokes(); } -void nxagentDumpKeystrokes(void) +static char *nxagentGetSingleKeystrokeString(struct nxagentSpecialKeystrokeMap *cur) +{ + if (!cur) + return strdup(""); /* caller is expected to free the returned string */ + + char *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *s10, *s11; + s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = s9 = s10 = s11 = ""; + + unsigned int mask = cur->modifierMask; + + if (mask & ControlMask) {s1 = "Ctrl+"; mask &= ~ControlMask;} + if (mask & ShiftMask) {s2 = "Shift+"; mask &= ~ShiftMask;} + + /* these are only here for better readable modifier names. Normally + they are covered by the Mod<n> and Lock lines below */ + if (cur->modifierAltMeta) {s3 = "Alt+"; mask &= ~(cur->modifierAltMeta);} + if (mask & nxagentCapsMask) {s4 = "CapsLock+"; mask &= ~nxagentCapsMask;} + if (mask & nxagentNumlockMask) {s5 = "NumLock+"; mask &= ~nxagentNumlockMask;} + + if (mask & Mod1Mask) {s6 = "Mod1+"; mask &= ~Mod1Mask;} + if (mask & Mod2Mask) {s7 = "Mod2+"; mask &= ~Mod2Mask;} + if (mask & Mod3Mask) {s8 = "Mod3+"; mask &= ~Mod3Mask;} + if (mask & Mod4Mask) {s9 = "Mod4+"; mask &= ~Mod4Mask;} + if (mask & Mod5Mask) {s10 = "Mod5+"; mask &= ~Mod5Mask;} + if (mask & LockMask) {s11 = "Lock+"; mask &= ~LockMask;} + + char *ret = NULL; + asprintf(&ret, "%s%s%s%s%s%s%s%s%s%s%s%s", s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, XKeysymToString(cur->keysym)); + return ret; +} + +/* + * return the _first_ keystroke for the passed keystroke name + * + * e.g. nxagentFindFirstKeystroke("resize") -> "Ctrl+Alt+r" + * + * result must be free()d after use. + */ +char *nxagentFindFirstKeystroke(char *name) +{ + for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) + { + if (nxagentSpecialKeystrokeNames[cur->stroke] && + strcmp(nxagentSpecialKeystrokeNames[cur->stroke], name) == 0) + { + return nxagentGetSingleKeystrokeString(cur); + } + } + return NULL; +} + +/* + * return a string with linefeeds of all keystrokes who's name starts + * with the the passed string, + * + * e.g. nxagentFindKeystrokeString("viewport_scroll_") + * -> + * " viewport_scroll_left : Ctrl+Alt+Left + * viewport_scroll_left : Ctrl+Alt+KP_Left + * viewport_scroll_up : Ctrl+Alt+Up + * viewport_scroll_up : Ctrl+Alt+KP_Up + * viewport_scroll_right : Ctrl+Alt+Right + * viewport_scroll_right : Ctrl+Alt+KP_Right + * viewport_scroll_down : Ctrl+Alt+Down + * viewport_scroll_down : Ctrl+Alt+KP_Down + * " + * result must be free()d after use. + */ +char *nxagentFindMatchingKeystrokes(char *name) { int maxlen = 0; for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++) maxlen = max(maxlen, strlen(nxagentSpecialKeystrokeNames[i])); - fprintf(stderr, "Currently known keystrokes:\n"); - - for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) { - unsigned int mask = cur->modifierMask; - fprintf(stderr, " %-*s ", maxlen, nxagentSpecialKeystrokeNames[cur->stroke]); - if (mask & ControlMask) {fprintf(stderr, "Ctrl+"); mask &= ~ControlMask;} - if (mask & ShiftMask) {fprintf(stderr, "Shift+"); mask &= ~ShiftMask;} - - /* these are only here for better readable modifier - names. Normally they are covered by the Mod<n> and Lock lines - below */ - if (cur->modifierAltMeta) {fprintf(stderr, "Alt+"); mask &= ~(cur->modifierAltMeta);} - if (mask & nxagentCapsMask) {fprintf(stderr, "CapsLock+"); mask &= ~nxagentCapsMask;} - if (mask & nxagentNumlockMask) {fprintf(stderr, "NumLock+"); mask &= ~nxagentNumlockMask;} - - if (mask & Mod1Mask) {fprintf(stderr, "Mod1+"); mask &= ~Mod1Mask;} - if (mask & Mod2Mask) {fprintf(stderr, "Mod2+"); mask &= ~Mod2Mask;} - if (mask & Mod3Mask) {fprintf(stderr, "Mod3+"); mask &= ~Mod3Mask;} - if (mask & Mod4Mask) {fprintf(stderr, "Mod4+"); mask &= ~Mod4Mask;} - if (mask & Mod5Mask) {fprintf(stderr, "Mod5+"); mask &= ~Mod5Mask;} - if (mask & LockMask) {fprintf(stderr, "Lock+"); mask &= ~LockMask;} - fprintf(stderr, "%s\n", XKeysymToString(cur->keysym)); + char * res = strdup(""); /* let the caller free the string */ + for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) + { + if (nxagentSpecialKeystrokeNames[cur->stroke] && + strncmp(nxagentSpecialKeystrokeNames[cur->stroke], name, strlen(name)) == 0) + { + char *tmp; + char *tmp1 = nxagentGetSingleKeystrokeString(cur); + if (-1 == asprintf(&tmp, "%s %-*s : %s\n", res, maxlen, + nxagentSpecialKeystrokeNames[cur->stroke], + tmp1)) + { + SAFE_free(tmp1); + #ifdef TEST + fprintf(stderr, "%s: returning incomplete result:\n%s", __func__, res); + #endif + return res; + } + else + { + SAFE_free(tmp1); + free(res); + res = tmp; + } + } } + #ifdef TEST + fprintf(stderr, "%s: returning result:\n%s", __func__, res); + #endif + return res; +} + +void nxagentDumpKeystrokes(void) +{ + char *s = nxagentFindMatchingKeystrokes(""); + fprintf(stderr, "Currently known keystrokes:\n%s", s); + SAFE_free(s); } static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) @@ -465,7 +547,6 @@ static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0); - #ifdef DEBUG fprintf(stderr, "%s: got keysym '%c' (%d)\n", __func__, keysym, keysym); #endif @@ -495,10 +576,10 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) #ifdef TEST if (stroke != KEYSTROKE_NOTHING && stroke != KEYSTROKE_END_MARKER) fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - stroke %d (%s)\n", - X -> keycode, X -> state, stroke, nxagentSpecialKeystrokeNames[stroke]); + X -> keycode, X -> state, stroke, nxagentSpecialKeystrokeNames[stroke]); else fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - stroke %d (unused)\n", - X -> keycode, X -> state, stroke); + X -> keycode, X -> state, stroke); #endif if (stroke == KEYSTROKE_NOTHING) @@ -566,7 +647,7 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) break; case KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB: if (X->type == KeyPress) { - nxagentDeactivateInputDevicesGrab(); + nxagentDeactivateInputDevicesGrabs(); } return True; break; @@ -623,13 +704,13 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) break; case KEYSTROKE_REREAD_KEYSTROKES: /* two reasons to check on KeyRelease: - - this code is called for KeyPress and KeyRelease, so we - would read the keystroke file twice - - if the keystroke file changes settings for this key this + - this code is called for KeyPress and KeyRelease, so we + would read the keystroke file twice + - if the keystroke file changes settings for this key this might lead to unexpected behaviour */ if (X->type == KeyRelease) - nxagentInitKeystrokes(True); + nxagentInitKeystrokes(True); break; case KEYSTROKE_AUTOGRAB: *result = doAutoGrab; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h index 9d7c4c4d5..463bda9b3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h @@ -32,6 +32,9 @@ extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*); extern void nxagentDumpKeystrokes(void); extern void nxagentInitKeystrokes(Bool force); +char *nxagentFindFirstKeystroke(char *name); +char *nxagentFindMatchingKeystrokes(char *name); + /* keep this sorted, do not rely on any numerical value in this enum, and be aware * that KEYSTROKE_MAX may be used in a malloc */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Literals.h b/nx-X11/programs/Xserver/hw/nxagent/Literals.h index c0bb8c5d7..cef2904d1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Literals.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Literals.h @@ -23,6 +23,7 @@ /* */ /**************************************************************************/ +#ifdef TEST /* * Simple table used to translate a request * opcode to the name of the X request. @@ -210,4 +211,4 @@ static char *nxagentShmRequestLiteral[] = "ShmGetImage", "ShmCreatePixmap" }; - +#endif /* TEST */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index ad9ce771f..8f806093e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -117,6 +117,7 @@ Equipment Corporation. #include "Atoms.h" #include "Splash.h" +#include "Xdmcp.h" #include "Client.h" #include "Clipboard.h" #include "Reconnect.h" @@ -161,9 +162,7 @@ void nxagentListRemoteFonts(const char *, int); #include "unistd.h" #endif -#ifdef TEST #include "Literals.h" -#endif #ifdef VIEWPORT_FRAME @@ -330,7 +329,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio clientReady[0] = 0; - if (nxagentSplashWindow != None || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0)) + if (nxagentHaveSplashWindow() || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0)) { #ifdef TEST fprintf(stderr, "******Dispatch: Requesting a timeout of [%d] Ms.\n", @@ -346,7 +345,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio (nxagentOption(Xdmcp) == 0 || nxagentXdmcpUp == 1)) { #ifdef NX_DEBUG_INPUT - fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", + fprintf(stderr, "Session: Session started at '%s' timestamp [%u].\n", GetTimeAsString(), GetTimeInMillis()); #else fprintf(stderr, "Session: Session started at '%s'.\n", @@ -418,7 +417,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio isItTimeToYield = FALSE; #ifdef NXAGENT_SERVER - nxagentRequestingClient = client; + nxagentRequestingClient = client; #endif start_tick = SmartScheduleTime; while (!isItTimeToYield) @@ -580,6 +579,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio NXShadowDestroy(); } saveAgentState("TERMINATED"); + + nxagentFreeAtomMap(); + nxagentFreeFontData(); #endif /* NXAGENT_SERVER */ KillAllClients(); @@ -744,7 +746,7 @@ ProcConvertSelection(register ClientPtr client) #ifdef NXAGENT_SERVER (CurrentSelections[i].window != None) && (CurrentSelections[i].client != NullClient) #else - (CurrentSelections[i].window != None)) + (CurrentSelections[i].window != None) #endif #ifdef XCSECURITY && (!client->CheckAccess || @@ -799,12 +801,12 @@ ProcOpenFont(register ClientPtr client) #ifdef NXAGENT_SERVER char fontReq[256]; - memcpy(fontReq,(char *)&stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); - fontReq[stuff->nbytes]=0; - if (strchr(fontReq,'*') || strchr(fontReq,'?')) + memcpy(fontReq,(char *)&stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255); + fontReq[stuff->nbytes] = '\0'; + if (strchr(fontReq, '*') || strchr(fontReq, '?')) { #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Dispatch: ProcOpenFont try to find a common font with font pattern=%s\n",fontReq); + fprintf(stderr, "%s: try to find a common font with font pattern [%s]\n", __func__, fontReq); #endif nxagentListRemoteFonts(fontReq, nxagentMaxFontNames); err = nxOpenFont(client, stuff->fid, (Mask) 0, @@ -836,10 +838,9 @@ ProcCloseFont(register ClientPtr client) #ifdef NXAGENT_SERVER /* - * When a client closes a font the resource - * should not be lost if the reference counter - * is not 0, otherwise the server will not be - * able to find this font looping through the + * When a client closes a font the resource should not be lost + * if the reference counter is not 0, otherwise the server + * will not be able to find this font looping through the * resources. */ @@ -848,7 +849,7 @@ ProcCloseFont(register ClientPtr client) if (nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont) == 0) { #ifdef TEST - fprintf(stderr, "ProcCloseFont: Switching resource for font at [%p].\n", + fprintf(stderr, "%s: Switching resource for font at [%p].\n", __func__, (void *) pFont); #endif @@ -860,8 +861,8 @@ ProcCloseFont(register ClientPtr client) #ifdef TEST else { - fprintf(stderr, "ProcCloseFont: Found duplicated font at [%p], " - "resource switching skipped.\n", (void *) pFont); + fprintf(stderr, "%s: Found duplicated font at [%p], " + "resource switching skipped.\n", __func__, (void *) pFont); } #endif } @@ -888,11 +889,11 @@ ProcListFonts(register ClientPtr client) #ifdef NXAGENT_SERVER char tmp[256]; - memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); - tmp[stuff->nbytes]=0; + memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255); + tmp[stuff->nbytes] = '\0'; #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Dispatch: ListFont request with pattern %s max_names=%d\n",tmp,stuff->maxNames); + fprintf(stderr, "%s: ListFont request with pattern [%s] max_names [%d]\n", __func__, tmp, stuff->maxNames); #endif nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames); #endif @@ -910,12 +911,12 @@ ProcListFontsWithInfo(register ClientPtr client) #ifdef NXAGENT_SERVER char tmp[256]; - memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); - tmp[stuff->nbytes]=0; + memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255); + tmp[stuff->nbytes] = '\0'; #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Dispatch: ListFont with info request with pattern %s max_names=%d\n",tmp,stuff->maxNames); + fprintf(stderr, "%s: ListFont with info request with pattern [%s] max_names [%d]\n", __func__, tmp, stuff->maxNames); #endif - nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames :stuff->maxNames); + nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames); #endif return StartListFontsWithInfo(client, stuff->nbytes, @@ -937,11 +938,10 @@ ProcFreePixmap(register ClientPtr client) #ifdef NXAGENT_SERVER /* - * When a client releases a pixmap the resource - * should not be lost if the reference counter - * is not 0, otherwise the server will not be - * able to find this pixmap looping through the - * resources. + * When a client releases a pixmap the resource should not be + * lost if the reference counter is not 0, otherwise the + * server will not be able to find this pixmap looping through + * the resources. */ if (pMap -> refcnt > 0) @@ -960,8 +960,8 @@ ProcFreePixmap(register ClientPtr client) #ifdef TEST else { - fprintf(stderr, "ProcFreePixmap: Found duplicated pixmap at [%p], " - "resource switching skipped.\n", (void *) pMap); + fprintf(stderr, "%s: Found duplicated pixmap at [%p], " + "resource switching skipped.\n", __func__, (void *) pMap); } #endif } @@ -990,49 +990,12 @@ CloseDownClient(register ClientPtr client) { #ifdef NXAGENT_SERVER /* - * There must be a better way to hook a - * call-back function to be called any - * time a client is going to be closed. - */ - - nxagentClearClipboard(client, NULL); - - /* - * Need to reset the karma counter and - * get rid of the pending sync replies. + * Need to reset the karma counter and get rid of the pending sync + * replies. */ nxagentWakeupByReset(client); - - /* - * Check if the client - * is a shadow nxagent. - */ - - nxagentCheckIfShadowAgent(client); #endif xorg_CloseDownClient(client); } - -/* FIXME: Instead of having a own function use the provided Callback - mechanism */ -int -InitClientPrivates(ClientPtr client) -{ - int ret = xorg_InitClientPrivates(client); - -#ifdef NXAGENT_SERVER - if (ret == 1) - { - - /* - * Initialize the private members. - */ - - nxagentInitClientPrivates(client); - } -#endif - - return ret; -} diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index 992a6674f..6bb4ea306 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -81,15 +81,16 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c); #include "../../dix/dixfonts.c" -/* -#define NXAGENT_DEBUG -*/ - #include "Agent.h" #include "Font.h" #ifdef NXAGENT_SERVER +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + #define NXFONTPATHLENGTH 1024 char _NXFontPath[NXFONTPATHLENGTH]; @@ -99,7 +100,7 @@ char _NXFontPath[NXFONTPATHLENGTH]; * the NX_FONT environment. */ -static const char *_NXGetFontPath(const char *path) +static char *_NXGetFontPath(const char *path) { /* * Check the environment only once. @@ -116,17 +117,17 @@ static const char *_NXGetFontPath(const char *path) { if (strlen(fontEnv) + 1 > NXFONTPATHLENGTH) { -#ifdef TEST + #ifdef TEST fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n"); -#endif + #endif goto _NXGetFontPathError; } snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", fontEnv); -#ifdef TEST + #ifdef TEST fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath); -#endif + #endif return _NXFontPath; } @@ -135,9 +136,9 @@ _NXGetFontPathError: snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", path); -#ifdef TEST + #ifdef TEST fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath); -#endif + #endif return _NXFontPath; } @@ -156,8 +157,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c) *newname; int newlen; int aliascount = 20; +#ifdef NXAGENT_SERVER char nxagentOrigFontName[256]; int nxagentOrigFontNameLen; +#endif /* * Decide at runtime what FontFormat to use. @@ -190,13 +193,13 @@ doOpenFont(ClientPtr client, OFclosurePtr c) BitmapFormatScanlineUnit8; - +#ifdef NXAGENT_SERVER nxagentOrigFontNameLen = (c -> origFontNameLen < sizeof(nxagentOrigFontName) ? c -> origFontNameLen : sizeof(nxagentOrigFontName) - 1); memcpy(nxagentOrigFontName, c -> origFontName, nxagentOrigFontNameLen); nxagentOrigFontName[nxagentOrigFontNameLen] = 0; - +#endif if (client->clientGone) { if (c->current_fpe < c->num_fpes) @@ -253,8 +256,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (void *) c); -#ifdef NXAGENT_DEBUG +#ifdef NXAGENT_SERVER + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] sleeping.\n", client); + #endif #endif } return TRUE; @@ -284,15 +289,23 @@ doOpenFont(ClientPtr client, OFclosurePtr c) pScr = screenInfo.screens[i]; if (pScr->RealizeFont) { - - /* NXAGENT uses useless screen pointer to pass the original font name - * to realizeFont, could be a source of problems in the future. - */ +#ifdef NXAGENT_SERVER + /* + * NXAGENT uses useless screen pointer to pass the original font name + * to realizeFont, could be a source of problems in the future. + */ if (!(*pScr->RealizeFont) ((ScreenPtr)nxagentOrigFontName, pfont)) +#else + if (!(*pScr->RealizeFont) (pScr, pfont)) +#endif { CloseFont (pfont, (Font) 0); - err=BadFontName; +#ifdef NXAGENT_SERVER + err = BadFontName; +#else + err = AllocError; +#endif goto bail; } } @@ -302,6 +315,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) err = AllocError; goto bail; } +#ifdef NXAGENT_SERVER if( nxagentFontPriv(pfont) -> mirrorID == 0 ) { extern RESTYPE RT_NX_FONT; @@ -313,12 +327,21 @@ doOpenFont(ClientPtr client, OFclosurePtr c) goto bail; } } +#endif if (patternCache && pfont != c->non_cachable_font) -#ifdef HAS_XFONT2 +#ifdef NXAGENT_SERVER + #ifdef HAS_XFONT2 xfont2_cache_font_pattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen, -#else + #else CacheFontPattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen, -#endif /* HAS_XFONT2 */ + #endif /* HAS_XFONT2 */ +#else + #ifdef HAS_XFONT2 + xfont2_cache_font_pattern(patternCache, c->origFontName, c->origFontNameLen, + #else + CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen, + #endif /* HAS_XFONT2 */ +#endif pfont); bail: if (err != Successful && c->client != serverClient) { @@ -326,12 +349,16 @@ bail: c->fontid, FontToXError(err)); } if (c->slept) +#ifdef NXAGENT_SERVER { ClientWakeup(c->client); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] wakeup.\n", client); -#endif + #endif } +#else + ClientWakeup(c->client); +#endif for (i = 0; i < c->num_fpes; i++) { FreeFPE(c->fpe_list[i]); } @@ -353,7 +380,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) int nnames; int stringLens; int i; - xListFontsReply reply = {0}; + xListFontsReply reply; char *bufptr; char *bufferStart; int aliascount = 0; @@ -403,8 +430,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); -#ifdef NXAGENT_DEBUG +#ifdef NXAGENT_SERVER + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont (1): client [%lx] sleeping.\n", client); + #endif #endif } return TRUE; @@ -438,6 +467,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); c->slept = TRUE; +#ifdef NXAGENT_SERVER + #ifdef DEBUG + fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client); + #endif +#endif } return TRUE; } @@ -460,11 +494,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); c->slept = TRUE; -#ifdef NXAGENT_DEBUG - fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client); -#endif -#ifdef NXAGENT_DEBUG +#ifdef NXAGENT_SERVER + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client); + #endif #endif } return TRUE; @@ -593,13 +626,17 @@ finish: for (i = 0; i < nnames; i++) stringLens += (names->length[i] <= 255) ? names->length[i] : 0; + memset(&reply, 0, sizeof(xListFontsReply)); reply.type = X_Reply; reply.length = (stringLens + nnames + 3) >> 2; reply.nFonts = nnames; reply.sequenceNumber = client->sequence; +#ifdef NXAGENT_SERVER bufptr = bufferStart = (char *) calloc(1, reply.length << 2); - +#else + bufptr = bufferStart = (char *) malloc(reply.length << 2); +#endif if (!bufptr && reply.length) { SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); goto bail; @@ -613,24 +650,26 @@ finish: reply.nFonts--; else { +#ifdef NXAGENT_SERVER { - /* dirty hack: don't list to client fonts not existing on the remote side */ - char tmp[256]; + /* dirty hack: don't list to client fonts not existing on the remote side */ + char tmp[256]; - memcpy(tmp, names->names[i], names->length[i]); - tmp[ names->length[i] ] = 0; + memcpy(tmp, names->names[i], names->length[i]); + tmp[ names->length[i] ] = 0; - if (nxagentFontLookUp(tmp) == 0) - { + if (nxagentFontLookUp(tmp) == 0) + { #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "doListFontsAndAliases:\n"); - fprintf(stderr, " removing font: %s \n", tmp); + fprintf(stderr, "doListFontsAndAliases:\n"); + fprintf(stderr, " removing font: %s \n", tmp); #endif - reply.nFonts--; - stringLens -= names->length[i]; - continue; - } + reply.nFonts--; + stringLens -= names->length[i]; + continue; + } } +#endif *bufptr++ = names->length[i]; memmove( bufptr, names->names[i], names->length[i]); bufptr += names->length[i]; @@ -646,9 +685,11 @@ finish: bail: if (c->slept) { - ClientWakeup(client); -#ifdef NXAGENT_DEBUG + ClientWakeup(client); +#ifdef NXAGENT_SERVER + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client); + #endif #endif } for (i = 0; i < c->num_fpes; i++) @@ -689,11 +730,19 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, free(c); return BadAlloc; } -#ifdef HAS_XFONT2 +#ifdef NXAGENT_SERVER + #ifdef HAS_XFONT2 c->names = xfont2_make_font_names_record(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames); -#else + #else c->names = MakeFontNamesRecord(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames); -#endif /* HAS_XFONT2 */ + #endif /* HAS_XFONT2 */ +#else + #ifdef HAS_XFONT2 + c->names = xfont2_make_font_names_record(max_names < 100 ? max_names : 100); + #else + c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100); + #endif /* HAS_XFONT2 */ +#endif if (!c->names) { free(c->fpe_list); @@ -734,7 +783,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) xFontProp *pFP; int i; int aliascount = 0; - xListFontsWithInfoReply finalReply = {0}; + xListFontsWithInfoReply finalReply; if (client->clientGone) { @@ -772,8 +821,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; -#ifdef NXAGENT_DEBUG +#ifdef NXAGENT_SERVER + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (1): client [%lx] sleeping.\n", client); + #endif #endif } return TRUE; @@ -800,8 +851,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; -#ifdef NXAGENT_DEBUG +#ifdef NXAGENT_SERVER + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (2): client [%lx] sleeping.\n", client); + #endif #endif } return TRUE; @@ -887,23 +940,23 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) } else if (err == Successful) { - +#ifdef NXAGENT_SERVER if (c->haveSaved) { - numFonts = c->savedNumFonts; - name = c->savedName; - namelen = strlen(name); + numFonts = c->savedNumFonts; + name = c->savedName; + namelen = strlen(name); } - if (nxagentFontLookUp(name) == 0) - { + if (nxagentFontLookUp(name) == 0) + { #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "doListFontsAndAliases (with info):\n"); - fprintf(stderr, " removing font: %s \n", name); + fprintf(stderr, "doListFontsAndAliases (with info):\n"); + fprintf(stderr, " removing font: %s \n", name); +#endif + continue; + } #endif - continue; - } - length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp); reply = c->reply; if (c->length < length) @@ -918,6 +971,14 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) c->reply = reply; c->length = length; } +#ifndef NXAGENT_SERVER + if (c->haveSaved) + { + numFonts = c->savedNumFonts; + name = c->savedName; + namelen = strlen(name); + } +#endif reply->type = X_Reply; reply->length = (sizeof *reply - sizeof(xGenericReply) + pFontInfo->nprops * sizeof(xFontProp) + @@ -956,6 +1017,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) } finish: length = sizeof(xListFontsWithInfoReply); + bzero((char *) &finalReply, sizeof(xListFontsWithInfoReply)); finalReply.type = X_Reply; finalReply.sequenceNumber = client->sequence; finalReply.length = (sizeof(xListFontsWithInfoReply) @@ -963,12 +1025,16 @@ finish: WriteSwappedDataToClient(client, length, &finalReply); bail: if (c->slept) +#ifdef NXAGENT_SERVER { ClientWakeup(client); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo: client [%lx] wakeup.\n", client); -#endif + #endif } +#else + ClientWakeup(client); +#endif for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->reply); @@ -982,95 +1048,21 @@ bail: int SetDefaultFontPath(char *path) { - char *temp_path, - *start, - *end; - unsigned char *cp, - *pp, - *nump, - *newpath; - int num = 1, - len, - err, - size = 0, - bad; - -#ifdef NXAGENT_SERVER - path = (char *) _NXGetFontPath(path); -#endif /* NXAGENT_SERVER */ - - start = path; - - /* ensure temp_path contains "built-ins" */ - while (1) { - start = strstr(start, "built-ins"); - if (start == NULL) - break; - end = start + strlen("built-ins"); - if ((start == path || start[-1] == ',') && (!*end || *end == ',')) - break; - start = end; - } - if (!start) { - if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "") - == -1) - temp_path = NULL; - } - else { - temp_path = strdup(path); - } - if (!temp_path) - return BadAlloc; - - /* get enough for string, plus values -- use up commas */ - len = strlen(temp_path) + 1; - nump = cp = newpath = (unsigned char *) malloc(len); - if (!newpath) { - free(temp_path); - return BadAlloc; - } - pp = (unsigned char *) temp_path; - cp++; - while (*pp) { - if (*pp == ',') { - *nump = (unsigned char) size; - nump = cp++; - pp++; - num++; - size = 0; - } else { - *cp++ = *pp++; - size++; - } - } - *nump = (unsigned char) size; - - err = SetFontPathElements(num, newpath, &bad, TRUE); - - free(newpath); - free(temp_path); - - return err; + return xorg_SetDefaultFontPath(_NXGetFontPath(path)); } - typedef struct { LFclosurePtr c; OFclosurePtr oc; } nxFs,*nxFsPtr; +/* this is derived from doListFontsAndAliases above */ static Bool -#if NeedFunctionPrototypes nxdoListFontsAndAliases(ClientPtr client, nxFsPtr fss) -#else -nxdoListFontsAndAliases(client, fss) - ClientPtr client; - nxFsPtr fss; -#endif { - LFclosurePtr c=fss->c; - OFclosurePtr oc=fss->oc; + LFclosurePtr c = fss->c; + OFclosurePtr oc = fss->oc; FontPathElementPtr fpe; int err = Successful; char *name, *resolved=NULL; @@ -1078,7 +1070,7 @@ nxdoListFontsAndAliases(client, fss) int i; int aliascount = 0; char tmp[256]; - tmp[0]=0; + tmp[0] = 0; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) @@ -1124,9 +1116,9 @@ nxdoListFontsAndAliases(client, fss) ClientSleep(client, (ClientSleepProcPtr)nxdoListFontsAndAliases, (void *) fss); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont (1): client [%lx] sleeping.\n", client); -#endif + #endif } return TRUE; } @@ -1159,9 +1151,9 @@ nxdoListFontsAndAliases(client, fss) (ClientSleepProcPtr)nxdoListFontsAndAliases, (void *) fss); c->slept = TRUE; -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont (2): client [%lx] sleeping.\n", client); -#endif + #endif } return TRUE; } @@ -1184,9 +1176,9 @@ nxdoListFontsAndAliases(client, fss) (ClientSleepProcPtr)nxdoListFontsAndAliases, (void *) fss); c->slept = TRUE; -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont (3): client [%lx] sleeping.\n", client); -#endif + #endif } return TRUE; } @@ -1207,20 +1199,20 @@ nxdoListFontsAndAliases(client, fss) { if (c->savedName) { - memcpy(tmp,c->savedName,c->savedNameLen>255?255:c->savedNameLen); - tmp[c->savedNameLen>255?255:c->savedNameLen]=0; + memcpy(tmp, c->savedName, c->savedNameLen > 255 ? 255 : c->savedNameLen); + tmp[c->savedNameLen >255 ? 255 : c->savedNameLen] = 0; if (nxagentFontLookUp(tmp)) break; - else tmp[0]=0; + else tmp[0] = 0; } } else { - memcpy(tmp,name,namelen>255?255:namelen); - tmp[namelen>255?255:namelen]=0; + memcpy(tmp, name, namelen > 255 ? 255 : namelen); + tmp[namelen > 255 ? 255 : namelen] = 0; if (nxagentFontLookUp(tmp)) break; - else tmp[0]=0; + else tmp[0] = 0; } } @@ -1314,14 +1306,13 @@ finish: if (strlen(tmp)) { #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "nxListFont changed (0) font to %s\n",tmp); + fprintf(stderr, "nxListFont changed (0) font to %s\n", tmp); #endif memcpy(oc->fontname, tmp, strlen(tmp)); oc->fnamelen = strlen(tmp); oc->origFontName = oc->fontname; oc->origFontNameLen = oc->fnamelen; - } else { @@ -1352,9 +1343,9 @@ finish: if (c->slept) { ClientWakeup(client); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont: client [%lx] wakeup.\n", client); -#endif + #endif } for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); @@ -1372,17 +1363,14 @@ finish: return doOpenFont(client, oc); } + +/* this is derived from dix/dixfonts.c:OpenFont() */ int -nxOpenFont(client, fid, flags, lenfname, pfontname) - ClientPtr client; - XID fid; - Mask flags; - unsigned lenfname; - char *pfontname; +nxOpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname) { - nxFsPtr fss; - LFclosurePtr c; - OFclosurePtr oc; + nxFsPtr fss; /* NX Font Struct Ptr */ + LFclosurePtr c; /* ListFont closure Ptr */ + OFclosurePtr oc; /* OpenFont closure Ptr */ int i; FontPtr cached = (FontPtr)0; @@ -1437,7 +1425,8 @@ nxOpenFont(client, fid, flags, lenfname, pfontname) free(fss); return BadAlloc; } - c->fpe_list = (FontPathElementPtr *) + + c->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { free(c); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index ed444e7a4..4b4232c4b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -143,6 +143,7 @@ of the copyright holder. #include "Events.h" #include "Windows.h" #include "Args.h" +#include "Clipboard.h" extern Display *nxagentDisplay; @@ -153,11 +154,6 @@ extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr); #endif extern int nxagentShadowInit(ScreenPtr, WindowPtr); -#ifdef NXAGENT_CLIPBOARD -extern int nxagentSendNotify(xEvent*); -#endif - - void ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, TimeStamp time, Bool autoGrab) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c b/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c index 7af295eac..6149ad27d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c @@ -64,7 +64,7 @@ static int __glXDispatch(ClientPtr client) * dispatching a GLX operation. */ - nxagentGlxTrap = 1; + nxagentGlxTrap = True; #ifdef TEST fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n", @@ -73,7 +73,7 @@ static int __glXDispatch(ClientPtr client) retval = xorg__glXDispatch(client); - nxagentGlxTrap = 0; + nxagentGlxTrap = False; #ifdef TEST fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n", diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index dc2f5b07f..11e66720f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -76,6 +76,7 @@ SOFTWARE. #include "Rootless.h" #include "Client.h" #include "Windows.h" +#include "Clipboard.h" extern Atom clientCutProperty; @@ -93,14 +94,14 @@ nxagentWMStateRec; #undef TEST #undef DEBUG -#ifdef NXAGENT_CLIPBOARD -extern WindowPtr nxagentGetClipboardWindow(Atom); -#endif - #ifdef NXAGENT_ARTSD extern Atom mcop_local_atom; #endif +#ifdef NX_DEBUG_INPUT +extern void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data); +#endif + int ProcChangeProperty(ClientPtr client) { @@ -229,7 +230,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, } } - return Xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent); + return xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent); } /***************** @@ -447,7 +448,7 @@ ProcGetProperty(ClientPtr client) #ifdef NXAGENT_CLIPBOARD /* GetWindowProperty clipboard use only */ -/* FIXME: that's wrong, it is also called in Window.c and Events. */ +/* FIXME: that's wrong, it is also called in Window.c and Events.c */ /* FIXME: should be moved to a different file, is not derived from dix */ int @@ -502,7 +503,6 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, pProp = pProp->next; } - if (!pProp) { #ifdef DEBUG diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 76a375db2..bcb64edcd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -65,9 +65,7 @@ #undef TEST #undef DEBUG -#ifdef TEST #include "Literals.h" -#endif /* * From NXglyph.c. @@ -1768,11 +1766,11 @@ ProcRenderDispatch (ClientPtr client) * operation to avoid reentrancy in GCOps.c. */ - nxagentGCTrap = 1; + nxagentGCTrap = True; int result = xorg_ProcRenderDispatch(client); - nxagentGCTrap = 0; + nxagentGCTrap = False; return result; } @@ -1795,11 +1793,11 @@ SProcRenderDispatch (ClientPtr client) * operation to avoid reentrancy in GCOps.c. */ - nxagentGCTrap = 1; + nxagentGCTrap = True; int result = xorg_SProcRenderDispatch(client); - nxagentGCTrap = 0; + nxagentGCTrap = False; return result; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index e05b36877..30be3e781 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -142,16 +142,11 @@ static int nxagentResChangedFlag = 0; #ifdef NXAGENT_SERVER int nxagentFindClientResource(int client, RESTYPE type, void * value) { - ResourcePtr pResource; - ResourcePtr *resources; - - int i; - - for (i = 0; i < clientTable[client].buckets; i++) + for (int i = 0; i < clientTable[client].buckets; i++) { - resources = clientTable[client].resources; + ResourcePtr *resources = clientTable[client].resources; - for (pResource = resources[i]; pResource; pResource = pResource -> next) + for (ResourcePtr pResource = resources[i]; pResource; pResource = pResource -> next) { if (pResource -> type == type && pResource -> value == value) { @@ -171,13 +166,8 @@ int nxagentFindClientResource(int client, RESTYPE type, void * value) int nxagentSwitchResourceType(int client, RESTYPE type, void * value) { - ResourcePtr pResource; - ResourcePtr *resources; - RESTYPE internalType = 0; - int i; - if (type == RT_PIXMAP) { internalType = RT_NX_PIXMAP; @@ -205,11 +195,11 @@ int nxagentSwitchResourceType(int client, RESTYPE type, void * value) return 0; } - for (i = 0; i < clientTable[serverClient -> index].buckets; i++) + for (int i = 0; i < clientTable[serverClient -> index].buckets; i++) { - resources = clientTable[serverClient -> index].resources; + ResourcePtr *resources = clientTable[serverClient -> index].resources; - for (pResource = resources[i]; pResource; pResource = pResource -> next) + for (ResourcePtr pResource = resources[i]; pResource; pResource = pResource -> next) { if (pResource -> type == internalType && pResource -> value == value) @@ -248,14 +238,12 @@ AddResource(XID id, RESTYPE type, void * value) } #ifdef NXAGENT_SERVER - nxagentSwitchResourceType(client, type, value); #ifdef TEST fprintf(stderr, "AddResource: Adding resource for client [%d] type [%lu] value [%p] id [%lu].\n", client, (unsigned long) type, (void *) value, (unsigned long) id); #endif - #endif if ((rrec->elements >= 4*rrec->buckets) && @@ -274,9 +262,9 @@ AddResource(XID id, RESTYPE type, void * value) res->value = value; *head = res; rrec->elements++; - #ifdef NXAGENT_SERVER +#ifdef NXAGENT_SERVER nxagentResChangedFlag = 1; - #endif +#endif if (!(id & SERVER_BIT) && (id >= rrec->expectID)) rrec->expectID = id + 1; return TRUE; @@ -289,15 +277,13 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) register ResourcePtr res; register ResourcePtr *prev, *head; register int *eltptr; - int elements; + int elements = 0; Bool gotOne = FALSE; #ifdef NXAGENT_SERVER - #ifdef TEST fprintf(stderr, "FreeResource: Freeing resource id [%lu].\n", (unsigned long) id); #endif - #endif if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) @@ -313,9 +299,9 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) RESTYPE rtype = res->type; *prev = res->next; elements = --*eltptr; - #ifdef NXAGENT_SERVER +#ifdef NXAGENT_SERVER nxagentResChangedFlag = 1; - #endif +#endif if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); free(res); @@ -349,9 +335,9 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) if (res->id == id && res->type == type) { *prev = res->next; - #ifdef NXAGENT_SERVER +#ifdef NXAGENT_SERVER nxagentResChangedFlag = 1; - #endif +#endif if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); free(res); @@ -381,28 +367,21 @@ FindClientResourcesByType( int i, elements; register int *eltptr; - #ifdef NXAGENT_SERVER - register ResourcePtr **resptr; - #endif - if (!client) client = serverClient; +#ifdef NXAGENT_SERVER /* * If func triggers a resource table * rebuild then restart the loop. */ +register ResourcePtr **resptr; -#ifdef NXAGENT_SERVER RestartLoop: + resptr = &clientTable[client->index].resources; #endif resources = clientTable[client->index].resources; - - #ifdef NXAGENT_SERVER - resptr = &clientTable[client->index].resources; - #endif - eltptr = &clientTable[client->index].elements; for (i = 0; i < clientTable[client->index].buckets; i++) { @@ -412,17 +391,16 @@ RestartLoop: if (!type || this->type == type) { elements = *eltptr; +#ifdef NXAGENT_SERVER /* * FIXME: * It is not safe to let a function change the resource * table we are reading! */ - - #ifdef NXAGENT_SERVER nxagentResChangedFlag = 0; - #endif +#endif (*func)(this->value, this->id, cdata); - +#ifdef NXAGENT_SERVER /* * Avoid that a call to RebuildTable() could invalidate the * pointer. This is safe enough, because in RebuildTable() @@ -430,10 +408,8 @@ RestartLoop: * freed, so it can't point to the same address. */ - #ifdef NXAGENT_SERVER if (*resptr != resources) goto RestartLoop; - #endif /* * It's not enough to check if the number of elements has @@ -444,11 +420,10 @@ RestartLoop: * added or freed. */ - #ifdef NXAGENT_SERVER if (*eltptr != elements || nxagentResChangedFlag) - #else +#else if (*eltptr != elements) - #endif +#endif next = resources[i]; /* start over */ } } @@ -466,28 +441,21 @@ FindAllClientResources( int i, elements; register int *eltptr; - #ifdef NXAGENT_SERVER - register ResourcePtr **resptr; - #endif - if (!client) client = serverClient; +#ifdef NXAGENT_SERVER /* * If func triggers a resource table * rebuild then restart the loop. */ +register ResourcePtr **resptr; -#ifdef NXAGENT_SERVER RestartLoop: + resptr = &clientTable[client->index].resources; #endif resources = clientTable[client->index].resources; - - #ifdef NXAGENT_SERVER - resptr = &clientTable[client->index].resources; - #endif - eltptr = &clientTable[client->index].elements; for (i = 0; i < clientTable[client->index].buckets; i++) { @@ -496,17 +464,18 @@ RestartLoop: next = this->next; elements = *eltptr; +#ifdef NXAGENT_SERVER /* * FIXME: * It is not safe to let a function change the resource * table we are reading! */ - #ifdef NXAGENT_SERVER nxagentResChangedFlag = 0; - #endif +#endif (*func)(this->value, this->id, this->type, cdata); +#ifdef NXAGENT_SERVER /* * Avoid that a call to RebuildTable() could invalidate the * pointer. This is safe enough, because in RebuildTable() @@ -514,10 +483,8 @@ RestartLoop: * freed, so it can't point to the same address. */ - #ifdef NXAGENT_SERVER if (*resptr != resources) goto RestartLoop; - #endif /* * It's not enough to check if the number of elements has @@ -528,11 +495,10 @@ RestartLoop: * added or freed. */ - #ifdef NXAGENT_SERVER if (*eltptr != elements || nxagentResChangedFlag) - #else +#else if (*eltptr != elements) - #endif +#endif next = resources[i]; /* start over */ } } @@ -550,44 +516,36 @@ LookupClientResourceComplex( ResourcePtr this; int i; - #ifdef NXAGENT_SERVER - ResourcePtr **resptr; - Bool res; - #endif - if (!client) client = serverClient; +#ifdef NXAGENT_SERVER /* * If func triggers a resource table * rebuild then restart the loop. */ +ResourcePtr **resptr; -#ifdef NXAGENT_SERVER RestartLoop: + resptr = &clientTable[client->index].resources; #endif resources = clientTable[client->index].resources; - - #ifdef NXAGENT_SERVER - resptr = &clientTable[client->index].resources; - #endif - for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = this->next) { if (!type || this->type == type) { - #ifdef NXAGENT_SERVER - res = (*func)(this->value, this->id, cdata); +#ifdef NXAGENT_SERVER + Bool res = (*func)(this->value, this->id, cdata); if (*resptr != resources) goto RestartLoop; if (res) return this->value; - #else +#else if((*func)(this->value, this->id, cdata)) return this->value; - #endif +#endif } } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 83deb74c4..e72a37494 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -70,9 +70,7 @@ in this Software without prior written authorization from The Open Group. #undef TEST #undef DEBUG -#ifdef TEST #include "Literals.h" -#endif extern void fbGetImage(DrawablePtr pDrw, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); @@ -173,11 +171,11 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) { /* Careful! This wrapper DEACTIVATES the trap! */ - nxagentShmTrap = 0; + nxagentShmTrap = False; xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data); - nxagentShmTrap = 1; + nxagentShmTrap = True; return; } @@ -192,9 +190,6 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) char *data; { #ifdef NXAGENT_SERVER - int length; - char *newdata; - #ifdef TEST fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n", (void *) dst, (void *) pGC, (void *) data); @@ -229,9 +224,9 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) sx, sy, sw, sh, dx); #endif - length = nxagentImageLength(sw, sh, format, 0, depth); + char *newdata = calloc(1, nxagentImageLength(sw, sh, format, 0, depth)); - if ((newdata = calloc(1, length)) != NULL) + if (newdata != NULL) { fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata); (*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata); @@ -394,7 +389,7 @@ ProcShmPutImage(client) return (client->noClientException); } - +/* derived from Xext/shm.c */ static PixmapPtr nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr) ScreenPtr pScreen; @@ -405,29 +400,22 @@ nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr) { register PixmapPtr pPixmap; +#ifdef NXAGENT_SERVER pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth, 0); - +#else + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0); +#endif if (!pPixmap) { - return NullPixmap; + return NullPixmap; } - #if defined(NXAGENT_SERVER) && defined(TEST) - fprintf(stderr,"fbShmCreatePixmap: Width [%d] Height [%d] Depth [%d] Hint[%d]\n", width, height, depth, 0); - #endif - if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr)) { - #if defined(NXAGENT_SERVER) && defined(WARNING) - fprintf(stderr,"fbShmCreatePixmap: Return Null Pixmap.\n"); - #endif - - (*pScreen->DestroyPixmap)(pPixmap); - - return NullPixmap; + (*pScreen->DestroyPixmap)(pPixmap); + return NullPixmap; } - return pPixmap; } @@ -439,39 +427,44 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) int depth; char *addr; { - PixmapPtr result; + #ifdef TEST + fprintf(stderr, "%s: Width [%d] Height [%d] Depth [%d] Hint[%d]\n", __func__, + width, height, depth, 0); + #endif + + nxagentShmPixmapTrap = True; - nxagentShmPixmapTrap = 1; + PixmapPtr result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr); - result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr); + nxagentShmPixmapTrap = False; - nxagentShmPixmapTrap = 0; + #ifdef WARNING + if (result == NullPixmap) + { + fprintf(stderr, "%s: Return Null Pixmap.\n", __func__); + } + #endif return result; } -/* A wrapper that handles the trap. This construct is used - to keep the derived code closer to the original -*/ static int ProcShmDispatch (register ClientPtr client) { - int result; - #ifdef TEST REQUEST(xReq); if (stuff->data <= X_ShmCreatePixmap) { - fprintf(stderr, "ProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n", + fprintf(stderr, "%s: Request [%s] OPCODE [%d] for client [%d].\n", __func__, nxagentShmRequestLiteral[stuff->data], stuff->data, client->index); } #endif - nxagentShmTrap = 1; + nxagentShmTrap = True; - result = xorg_ProcShmDispatch(client); + int result = xorg_ProcShmDispatch(client); - nxagentShmTrap = 0; + nxagentShmTrap = False; return result; } @@ -479,22 +472,20 @@ ProcShmDispatch (register ClientPtr client) static int SProcShmDispatch (register ClientPtr client) { - int result; - #ifdef TEST REQUEST(xReq); if (stuff->data <= X_ShmCreatePixmap) { - fprintf(stderr, "SProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n", + fprintf(stderr, "%s: Request [%s] OPCODE [%d] for client [%d].\n", __func__, nxagentShmRequestLiteral[stuff->data], stuff->data, client->index); } #endif - nxagentShmTrap = 1; + nxagentShmTrap = True; - result = xorg_SProcShmDispatch(client); + int result = xorg_SProcShmDispatch(client); - nxagentShmTrap = 0; + nxagentShmTrap = False; return result; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c index 545d9255c..8d7af08c0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c @@ -79,11 +79,11 @@ ProcXvDispatch(ClientPtr client) stuff->data, client -> index); #endif - nxagentXvTrap = 1; + nxagentXvTrap = True; result = xorg_ProcXvDispatch(client); - nxagentXvTrap = 0; + nxagentXvTrap = False; #ifdef TEST fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n", @@ -108,11 +108,11 @@ SProcXvDispatch(ClientPtr client) stuff->data, client -> index); #endif - nxagentXvTrap = 1; + nxagentXvTrap = True; result = xorg_SProcXvDispatch(client); - nxagentXvTrap = 0; + nxagentXvTrap = False; #ifdef TEST fprintf(stderr, "SProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n", diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 565394c65..13ac47d00 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -71,9 +71,6 @@ RESTYPE RT_NX_PIXMAP; int nxagentPixmapPrivateIndex; -int nxagentCorruptedPixmaps; -int nxagentCorruptedBackgrounds; - /* * Force deallocation of the virtual pixmap. */ @@ -157,7 +154,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, * synchronized with the remote X Server. */ - if (pPixmapPriv -> isShared == 1) + if (pPixmapPriv -> isShared) { BoxRec box = { .x1 = 0, .y1 = 0, .x2 = width, .y2 = height }; @@ -773,11 +770,11 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2) return; } - nxagentSplitTrap = 1; + nxagentSplitTrap = True; *pBool = nxagentSynchronizeDrawableData((DrawablePtr) pPixmap, NEVER_BREAK, NULL); - nxagentSplitTrap = 0; + nxagentSplitTrap = False; if (!*pBool) { @@ -1095,13 +1092,13 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, int length = nxagentImageLength(width, height, format, 0, depth); - int saveTrap = nxagentGCTrap; + Bool saveTrap = nxagentGCTrap; - nxagentGCTrap = 0; + nxagentGCTrap = False; - nxagentSplitTrap = 1; + nxagentSplitTrap = True; - nxagentFBTrap = 1; + nxagentFBTrap = True; char *data = malloc(length); @@ -1124,9 +1121,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, nxagentGCTrap = saveTrap; - nxagentSplitTrap = 0; + nxagentSplitTrap = False; - nxagentFBTrap = 0; + nxagentFBTrap = False; nxagentFreeScratchGC(pGC); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 98db9ca92..90e796772 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -146,13 +146,12 @@ void setStatePath(char* path) void saveAgentState(char* state) { - FILE* fptr; - if(strlen(stateFile)) + if (strlen(stateFile)) { - fptr=fopen(stateFile, "w"); - if(!fptr) + FILE* fptr = fopen(stateFile, "w"); + if (!fptr) return; - fprintf(fptr,"%s", state); + fprintf(fptr, "%s", state); fclose(fptr); } } @@ -237,8 +236,7 @@ int nxagentHandleConnectionStates(void) fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error in the exception flags.\n"); #endif /* -TODO: This should be reset only when - the state became SESSION_DOWN. +TODO: This should be reset only when the state became SESSION_DOWN. */ nxagentException.ioError = 0; @@ -301,7 +299,7 @@ TODO: This should be reset only when if ((dispatchException & DE_TERMINATE) == 0) { #ifdef NX_DEBUG_INPUT - fprintf(stderr, "Session: Session suspended at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); + fprintf(stderr, "Session: Session suspended at '%s' timestamp [%u].\n", GetTimeAsString(), GetTimeInMillis()); #else fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString()); #endif @@ -340,7 +338,7 @@ void nxagentInitializeRecLossyLevel(void) void nxagentInitReconnector(void) { - nxagentReconnectTrap = 0; + nxagentReconnectTrap = False; reconnectLossyLevel[DISPLAY_STEP] = malloc(sizeof(int)); reconnectLossyLevel[SCREEN_STEP] = malloc(sizeof(int)); @@ -365,8 +363,7 @@ void nxagentDisconnectSession(void) nxagentFreeTimeoutTimer(); /* - * Force an I/O error on the display - * and wait until the NX transport + * Force an I/O error on the display and wait until the NX transport * is gone. */ @@ -427,16 +424,15 @@ Bool nxagentReconnectSession(void) nxagentChangeOption(DeviceControl, nxagentOption(DeviceControlUserDefined)); /* - * We need to zero out every new XID - * created by the disconnected display. + * We need to zero out every new XID created by the disconnected + * display. */ nxagentDisconnectSession(); /* - * Set this in order to let the screen - * function to behave differently at - * reconnection time. + * Set this in order to let the screen function to behave + * differently at reconnection time. */ nxagentReconnectTrap = True; @@ -464,19 +460,17 @@ Bool nxagentReconnectSession(void) if (nxagentReconnectDisplay(reconnectLossyLevel[DISPLAY_STEP]) == 0) { - failedStep = DISPLAY_STEP; - #ifdef TEST fprintf(stderr, "nxagentReconnectSession: WARNING! Failed display reconnection.\n"); #endif + failedStep = DISPLAY_STEP; goto nxagentReconnectError; } if (nxagentReconnectScreen(reconnectLossyLevel[SCREEN_STEP]) == 0) { failedStep = SCREEN_STEP; - goto nxagentReconnectError; } @@ -489,7 +483,6 @@ Bool nxagentReconnectSession(void) if (nxagentReconnectFailedFonts(reconnectLossyLevel[FONT_STEP]) == 0) { failedStep = FONT_STEP; - goto nxagentReconnectError; } else @@ -504,16 +497,15 @@ Bool nxagentReconnectSession(void) } /* - * Map the main window and send a - * SetSelectionOwner request to + * Map the main window and send a SetSelectionOwner request to * notify of the agent start. */ nxagentMapDefaultWindows(); /* - * Ensure that the SetSelectionOwner - * request is sent through the link. + * Ensure that the SetSelectionOwner request is sent through the + * link. */ XFlush(nxagentDisplay); @@ -533,21 +525,18 @@ Bool nxagentReconnectSession(void) if (nxagentReconnectAllGCs(reconnectLossyLevel[GC_STEP]) == 0) { failedStep = GC_STEP; - goto nxagentReconnectError; } if (nxagentReconnectAllColormap(reconnectLossyLevel[COLORMAP_STEP]) == 0) { failedStep = COLORMAP_STEP; - goto nxagentReconnectError; } if (nxagentReconnectAllWindows(reconnectLossyLevel[WINDOW_STEP]) == 0) { failedStep = WINDOW_STEP; - goto nxagentReconnectError; } @@ -556,21 +545,18 @@ Bool nxagentReconnectSession(void) if (nxagentReconnectAllGlyphSet(reconnectLossyLevel[GLYPHSET_STEP]) == 0) { failedStep = GLYPHSET_STEP; - goto nxagentReconnectError; } if (nxagentReconnectAllPictFormat(reconnectLossyLevel[PICTFORMAT_STEP]) == 0) { failedStep = PICTFORMAT_STEP; - goto nxagentReconnectError; } if (nxagentReconnectAllPicture(reconnectLossyLevel[PICTURE_STEP]) == 0) { failedStep = PICTURE_STEP; - goto nxagentReconnectError; } } @@ -578,14 +564,12 @@ Bool nxagentReconnectSession(void) if (nxagentReconnectAllCursor(reconnectLossyLevel[CURSOR_STEP]) == 0) { failedStep = CURSOR_STEP; - goto nxagentReconnectError; } if (nxagentSetWindowCursors(reconnectLossyLevel[WINDOW_STEP]) == 0) { failedStep = WINDOW_STEP; - goto nxagentReconnectError; } @@ -621,7 +605,6 @@ Bool nxagentReconnectSession(void) #endif failedStep = WINDOW_STEP; - goto nxagentReconnectError; } } @@ -674,7 +657,7 @@ Bool nxagentReconnectSession(void) nxagentInitKeystrokes(True); #ifdef NX_DEBUG_INPUT - fprintf(stderr, "Session: Session resumed at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); + fprintf(stderr, "Session: Session resumed at '%s' timestamp [%u].\n", GetTimeAsString(), GetTimeInMillis()); #else fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString()); #endif @@ -683,10 +666,9 @@ Bool nxagentReconnectSession(void) nxagentRemoveSplashWindow(); /* - * We let the proxy flush the link on our behalf - * after having opened the display. We are now - * entering again the dispatcher so can flush - * the link explicitly. + * We let the proxy flush the link on our behalf after having opened + * the display. We are now entering again the dispatcher so can + * flush the link explicitly. */ #ifdef TEST @@ -799,9 +781,8 @@ void nxagentSetReconnectError(int id, char *format, ...) else { /* - * The vsnprintf() in glibc 2.0.6 would return - * -1 when the output was truncated. See section - * NOTES on printf(3). + * The vsnprintf() in glibc 2.0.6 would return -1 when the + * output was truncated. See section NOTES on printf(3). */ size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE); @@ -863,4 +844,3 @@ void nxagentHandleConnectionChanges(void) } } } - diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 6113a419a..f38319858 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -186,6 +186,7 @@ Bool nxagentDisconnectAllPicture(void); #define ROUNDUP(nbits, pad) ((((nbits) + ((pad)-1)) / (pad)) * ((pad)>>3)) +/* Clean the padding bytes of data section of request.*/ void nxagentCleanGlyphs(xGlyphInfo *gi, int nglyphs, @@ -360,19 +361,15 @@ nxagentCleanGlyphs(xGlyphInfo *gi, if (bytesToClean > 0) { - while (height > 0) + for (; height > 0; height--) { - int count = bytesToClean; - - while (count > 0) + for (int i = bytesToClean; i > 0; i--) { - *(images + (bytesPerLine - count)) = 0; + *(images + (bytesPerLine - i)) = 0; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n"); #endif - - count--; } #ifdef DUMP @@ -385,8 +382,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #endif images += bytesPerLine; - - height--; } } @@ -537,11 +532,11 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) * if the cursor was already encoded with the best quality. */ - nxagentLosslessTrap = 1; + nxagentLosslessTrap = True; nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); - nxagentLosslessTrap = 0; + nxagentLosslessTrap = False; nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y); } @@ -1157,7 +1152,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion); - nxagentFreeRegion(pDst -> pDrawable, pDstRegion); + nxagentFreeRegion(pDstRegion); return; } @@ -1326,12 +1321,12 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, (void *) pDst -> pDrawable); #endif - nxagentFreeRegion(pDst -> pDrawable, pRegion); + nxagentFreeRegion(pRegion); return; } - nxagentFreeRegion(pDst -> pDrawable, pRegion); + nxagentFreeRegion(pRegion); } /* @@ -1817,7 +1812,7 @@ FIXME: Is this useful or just a waste of bandwidth? nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion); - nxagentFreeRegion(pDst -> pDrawable, pDstRegion); + nxagentFreeRegion(pDstRegion); if (pDst -> pDrawable -> type == DRAWABLE_PIXMAP) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 2adb254f6..3bd0b7c25 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -39,6 +39,7 @@ #include "Atoms.h" #include "Trap.h" #include "Utils.h" +#include "Atoms.h" #include "compext/Compext.h" @@ -151,10 +152,9 @@ void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w) if (topLevelParentMap.next == topLevelParentMap.size) { - TopLevelParentRec *ptr = topLevelParentMap.elt; size_t size = (topLevelParentMap.size += TOP_LEVEL_TABLE_UNIT); - ptr = realloc(ptr, size * sizeof(TopLevelParentRec)); + TopLevelParentRec *ptr = realloc(topLevelParentMap.elt, size * sizeof(TopLevelParentRec)); if (ptr == NULL) { @@ -332,18 +332,18 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) WindowPtr pWin = screenInfo.screens[0]->root -> firstChild; + XID values[2] = {0, (XID) Above}; + for (int i = ntoplevel; i-- && pWin; pWin = toplevel[i] -> nextSib) { - XID values[2] = {0, (XID) Above}; - if (toplevel[i] != pWin) { Mask mask = CWSibling | CWStackMode; values[0] = pWin -> drawable.id; ClientPtr pClient = wClient(toplevel[i]); - nxagentScreenTrap = 1; - ConfigureWindow(toplevel[i], mask, (XID *) values, pClient); - nxagentScreenTrap = 0; + nxagentScreenTrap = True; + ConfigureWindow(toplevel[i], mask, values, pClient); + nxagentScreenTrap = False; #ifdef TEST fprintf(stderr, "%s: Restacked window [%p].\n", __func__, (void*) toplevel[i]); @@ -418,6 +418,11 @@ int nxagentExportAllProperty(WindowPtr pWin) return total; } +/* + * Export a property from an agent window to the corresponding window + * on the real X server This is e.g. called if a client changes a + * property. + */ int nxagentExportProperty(WindowPtr pWin, Atom property, Atom type, @@ -720,7 +725,7 @@ int nxagentExportProperty(WindowPtr pWin, else { #ifdef TEST - fprintf(stderr, "%s: Property [%u] format [%i] units [%lu].\n", __func__, + fprintf(stderr, "%s: Property [%lu] format [%i] units [%lu].\n", __func__, propertyX, format, nUnits); #endif @@ -793,6 +798,11 @@ int nxagentExportProperty(WindowPtr pWin, return export; } +/* + * Import a property from the proxy window on the real X server into + * the agent's corresponding window. This is e.g. called on reception + * of a property change event on the real X server. + */ void nxagentImportProperty(Window window, XlibAtom property, XlibAtom type, @@ -817,7 +827,7 @@ void nxagentImportProperty(Window window, if (pWin == NULL) { #ifdef TEST - fprintf(stderr, "%s: Failed to look up remote window [0x%x] property [%d] exiting.\n", + fprintf(stderr, "%s: Failed to look up remote window [0x%x] property [%ld] exiting.\n", __func__, window, property); #endif @@ -829,29 +839,34 @@ void nxagentImportProperty(Window window, if (!ValidAtom(propertyL)) { #ifdef TEST - fprintf(stderr, "%s: Failed to convert remote property atom.\n", __func__); + fprintf(stderr, "%s: Failed to convert remote property atom [%ld].\n", __func__, property); #endif return; } #ifdef TEST - fprintf(stderr, "%s: Window [0x%x] property [%d]: [%s]\n", __func__, - window, property, validateString(NameForAtom(propertyL))); + fprintf(stderr, "%s: Window [0x%x] property: remote [%ld][%s] local [%d]\n", __func__, + window, property, validateString(NameForAtom(propertyL)), propertyL); #endif /* * We settle a property size limit of 256K beyond which we simply * ignore them. + * FIXME: where's this checked/set/enforced/whatever? */ Atom typeL = nxagentRemoteToLocalAtom(type); const char *typeS = NameForAtom(typeL); + #ifdef TEST + fprintf(stderr, "%s: type: remote [%ld] local [%d][%s].\n", __func__, type, typeL, validateString(typeS)); + #endif + if (buffer == NULL && (nitems > 0)) { #ifdef WARNING - fprintf(stderr, "%s: Failed to retrieve remote property [%ld] [%s] on Window [%ld]\n", __func__, + fprintf(stderr, "%s: Failed to retrieve remote property [%ld] [%s] on window [%ld]\n", __func__, (long int) property, validateString(NameForAtom(propertyL)), (long int) window); #endif } @@ -864,7 +879,7 @@ void nxagentImportProperty(Window window, else if (!ValidAtom(typeL)) { #ifdef WARNING - fprintf(stderr, "%s: Failed to convert remote atoms [%ld].\n", __func__, + fprintf(stderr, "%s: Failed to convert remote atom [%ld].\n", __func__, (long int) type); #endif } @@ -876,6 +891,41 @@ void nxagentImportProperty(Window window, import = True; } + else if (property == nxagentAtoms[0]) /* NX_IDENTITY */ + { + #ifdef WARNING + fprintf(stderr, "%s: not importing private [%ld][NXDARWIN].\n", __func__, + (long int) property); + #endif + } + else if (property == nxagentAtoms[5]) /* NX_CUT_BUFFER_SERVER */ + { + #ifdef WARNING + fprintf(stderr, "%s: not importing private [%ld][NX_CUT_BUFFER_SERVER].\n", __func__, + (long int) property); + #endif + } + else if (property == nxagentAtoms[8]) /* NX_AGENT_SIGNATURE */ + { + #ifdef WARNING + fprintf(stderr, "%s: not importing private [%ld][NX_AGENT_SIGNATURE].\n", __func__, + (long int) property); + #endif + } + else if (property == nxagentAtoms[9]) /* NXDARWIN */ + { + #ifdef TEST + fprintf(stderr, "%s: not importing private [%ld][NXDARWIN].\n", __func__, + (long int) property); + #endif + } + else if (property == nxagentAtoms[15]) /* NX_SELTRANS_FROM_AGENT */ + { + #ifdef TEST + fprintf(stderr, "%s: not importing private [%ld][NX_SELTRANS_FROM_AGENT].\n", __func__, + (long int) property); + #endif + } else if (strcmp(typeS, "STRING") == 0 || strcmp(typeS, "UTF8_STRING") == 0 || strcmp(typeS, "CARDINAL") == 0 || @@ -1069,7 +1119,7 @@ void nxagentImportProperty(Window window, if (import) { #ifdef TEST - fprintf(stderr, "%s: ChangeProperty on window [0x%x] property [%d] type [%s]" + fprintf(stderr, "%s: ChangeProperty on window [0x%x] property [%ld] type [%s]" " nitems [%ld] format [%d]\n", __func__, window, property, typeS, nitems, format); #endif @@ -1080,7 +1130,7 @@ void nxagentImportProperty(Window window, else { #ifdef TEST - fprintf(stderr, "%s: WARNING! Ignored ChangeProperty on window [0x%x] property [%d] type [%s]" + fprintf(stderr, "%s: WARNING! Ignored ChangeProperty on window [0x%x] property [%ld] type [%s]" " ntems [%ld] format [%d]\n", __func__, window, property, validateString(typeS), nitems, format); #endif @@ -1126,7 +1176,7 @@ void nxagentRemovePropertyFromList(void) struct nxagentPropertyRec *tmp = nxagentPropertyList.first; #ifdef TEST - fprintf(stderr, "%s: Property [%d] on Window [0x%x] to list, list size is [%d].\n", __func__, + fprintf(stderr, "%s: Property [%ld] on Window [0x%x] to list, list size is [%d].\n", __func__, nxagentPropertyList.first -> property, nxagentPropertyList.first -> window, nxagentPropertyList.size); #endif @@ -1162,7 +1212,7 @@ void nxagentAddPropertyToList(XlibAtom property, WindowPtr pWin) } #ifdef TEST - fprintf(stderr, "%s: Adding record Property [%d] - Window [0x%x][%p] to list, list" + fprintf(stderr, "%s: Adding record Property [%ld] - Window [0x%x][%p] to list, list" " size is [%d].\n", __func__, property, nxagentWindow(pWin), (void*) pWin, nxagentPropertyList.size); #endif @@ -1208,7 +1258,7 @@ Bool nxagentNotifyMatchChangeProperty(void *p) if (first) { - fprintf(stderr, "%s: First element on list is window [0x%x] property [%d] list size is [%d].\n", __func__, + fprintf(stderr, "%s: First element on list is window [0x%x] property [%ld] list size is [%d].\n", __func__, first -> window, first -> property, nxagentPropertyList.size); } else diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 3745c0aec..2bdc4bde5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -151,12 +151,9 @@ int nxagentArgc = 0; char **nxagentArgv = NULL; #ifdef NXAGENT_ARTSD - char mcop_atom[] = "MCOPGLOBALS"; Atom mcop_local_atom = None; unsigned char fromHexNibble(char c); -void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); - #endif Window nxagentIconWindow = None; @@ -3289,11 +3286,11 @@ FIXME: The port information is not used at the moment and produces a { local_buf[in] = pszReturnData[i]; - if(pszReturnData[i] == ':') + if (pszReturnData[i] == ':') { i++; - while(pszReturnData[i] != '\n') + while (pszReturnData[i] != '\n') { unsigned char h = fromHexNibble(pszReturnData[i]); i++; @@ -3302,7 +3299,8 @@ FIXME: The port information is not used at the moment and produces a unsigned char l = fromHexNibble(pszReturnData[i]); i++; - if(h >= 16 || l >= 16) continue; + if (h >= 16 || l >= 16) + continue; /* * FIXME: The array tchar[] was used uninitialized. It's @@ -3333,7 +3331,7 @@ FIXME: The port information is not used at the moment and produces a /* FIXME: The port information is not used at the moment and produces a warning on recent gcc versions. Do we need such information - to run the audio forawrding? + to run the audio forwarding? chport = &port[0]; @@ -3349,7 +3347,7 @@ FIXME: The port information is not used at the moment and produces a strcat(local_buf,"00"); in += 2; - while(pszReturnData[i] != '\n') + while (pszReturnData[i] != '\n') { i++; } @@ -3920,7 +3918,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) output = pScrPriv->outputs[i]; } #ifdef DEBUG - fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", pScrPriv->outputs[i]->name); + fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", output->name); #endif RROutputSetCrtcs(output, &(pScrPriv->crtcs[i]), 1); /* FIXME: Isn't there a function for setting this? */ @@ -4011,9 +4009,9 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) distinguish between pre-existing modes which should stay and our own modes that should be removed after use. */ char name[100]; - sprintf(name, "%s%dx%d", QUOTE(NXAGENT_RANDR_MODE_PREFIX), new_w, new_h); + sprintf(name, "%s%dx%d", QUOTE(NXAGENT_RANDR_MODE_PREFIX), new_w, new_h); - const int refresh = 60; + const int refresh = 60; xRRModeInfo modeInfo = { .width = new_w, @@ -4022,7 +4020,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) .vTotal = new_h, .dotClock = ((CARD32) new_w * (CARD32) new_h * (CARD32) refresh), .nameLength = strlen(name) - }; + }; RRModePtr mymode = RRModeGet(&modeInfo, name); @@ -4081,7 +4079,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) SAFE_free(screeninfo); #ifdef DEBUG - for (i = 0; i < pScrPriv->numCrtcs; i++) + for (int i = 0; i < pScrPriv->numCrtcs; i++) { RRModePtr mode = pScrPriv->crtcs[i]->mode; if (mode) { @@ -4093,7 +4091,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) } if (pScrPriv->crtcs[i]->numOutputs > 0) - for (int j=0; j < pScrPriv->crtcs[i]->numOutputs; j++) + for (int j = 0; j < pScrPriv->crtcs[i]->numOutputs; j++) fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]->crtc=[%p]\n", j, pScrPriv->crtcs[i]->outputs[j]->name, (void *)pScrPriv->crtcs[i]->outputs[j]->crtc); } #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h index 104da1cea..6d775e1cc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h @@ -59,8 +59,6 @@ extern int nxagentClients; extern ScreenPtr nxagentDefaultScreen; -extern Pixmap nxagentPixmapLogo; - extern Window nxagentIconWindow; extern Window nxagentFullscreenWindow; @@ -140,7 +138,9 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr, int, int); void nxagentShadowSetRatio(float, float); +#ifdef NXAGENT_ARTSD void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); +#endif /* * Change window settings to adapt to a ratio. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 91292470e..ea82513e6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -52,23 +52,19 @@ * Colors used to paint the splash screen. */ -#define nxagentLogoWhite 0xffffff -#define nxagentLogoBlack 0x000000 -#define nxagentLogoDarkGray 0x222222 -#define nxagentLogoLightGray 0xbbbbbb +#define LOGOWHITE 0xffffff +#define LOGOBLACK 0x000000 +#define LOGODARKGRAY 0x222222 +#define LOGOLIGHTGRAY 0xbbbbbb -Pixmap nxagentPixmapLogo; -Window nxagentSplashWindow = None; -Bool nxagentWMPassed = False; +static XlibPixmap nxagentPixmapLogo; +static XlibWindow nxagentSplashWindow = None; +static Bool nxagentWMPassed = False; -static void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height); +static void nxagentPaintLogo(XlibWindow win, int scale, int width, int height); -void nxagentShowSplashWindow(Window parentWindow) +void nxagentShowSplashWindow(XlibWindow parentWindow) { - XWindowAttributes getAttributes; - XWindowChanges values; - XSetWindowAttributes attributes; - /* * Show splash window only when running as X2Go Agent */ @@ -94,19 +90,19 @@ void nxagentShowSplashWindow(Window parentWindow) nxagentWMPassed = False; + XWindowAttributes getAttributes; + /* - * This would cause a GetWindowAttributes and a - * GetGeometry (asynchronous) reply. We use instead - * the geometry requested by the user for the agent - * window. + * This would cause a GetWindowAttributes and a GetGeometry + * (asynchronous) reply. We use instead the geometry requested by + * the user for the agent window. * * XGetWindowAttributes(nxagentDisplay, parentWindow, &getAttributes); */ /* - * During reconnection we draw the splash over - * the default window and not over the root - * window because it would be hidden by other + * During reconnection we draw the splash over the default window + * and not over the root window because it would be hidden by other * windows. */ @@ -128,28 +124,40 @@ void nxagentShowSplashWindow(Window parentWindow) fprintf(stderr, "%s: Going to create new splash window.\n", __func__); #endif + XSetWindowAttributes attributes = { + .override_redirect = True, + .border_pixel = WhitePixel (nxagentDisplay, 0), + .background_pixel = BlackPixel (nxagentDisplay, 0) + }; + nxagentSplashWindow = - XCreateSimpleWindow(nxagentDisplay, - parentWindow, - getAttributes.x, getAttributes.y, - getAttributes.width, getAttributes.height, - 0, - WhitePixel (nxagentDisplay, 0), - BlackPixel (nxagentDisplay, 0)); + XCreateWindow(nxagentDisplay, + parentWindow, + getAttributes.x, getAttributes.y, + getAttributes.width, getAttributes.height, + 0, + CopyFromParent, CopyFromParent, CopyFromParent, + CWOverrideRedirect | CWBorderPixel | CWBackPixel, + &attributes); #ifdef TEST - fprintf(stderr, "%s: Created new splash window with id [%ld].\n", __func__, + fprintf(stderr, "%s: Created new splash window with id [0x%lx].\n", __func__, nxagentSplashWindow); #endif - XlibGC gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL); - nxagentPaintLogo(nxagentSplashWindow, gc, 1, getAttributes.width, getAttributes.height); - XMapRaised (nxagentDisplay, nxagentSplashWindow); - values.stack_mode = Above; + nxagentPaintLogo(nxagentSplashWindow, 1, getAttributes.width, getAttributes.height); + XMapRaised(nxagentDisplay, nxagentSplashWindow); +#if 0 + /* + * should not be required since XMapRaised takes care of that: + * "The XMapRaised function essentially is similar to XMapWindow in + * that it maps the window and all of its subwindows that have had + * map requests. However, it also raises the specified window to + * the top of the stack." + */ + XWindowChanges values = {.stack_mode = Above}; XConfigureWindow(nxagentDisplay, nxagentSplashWindow, CWStackMode, &values); - attributes.override_redirect = True; - XChangeWindowAttributes(nxagentDisplay, nxagentSplashWindow, CWOverrideRedirect, &attributes); - XFreeGC(nxagentDisplay, gc); +#endif #ifdef NXAGENT_TIMESTAMP { @@ -160,8 +168,15 @@ void nxagentShowSplashWindow(Window parentWindow) #endif } -void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) +Bool nxagentHaveSplashWindow(void) +{ + return (nxagentSplashWindow != None); +} + +void nxagentPaintLogo(XlibWindow win, int scale, int width, int height) { + XlibGC gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL); + int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); #ifdef DEBUG @@ -178,9 +193,6 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) int w = width/scale; int h = height/scale; - int w2 = w/2; - int h2 = h/2; - int c; if (height > width) { @@ -202,173 +214,107 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) if (blackRoot) { - XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); - XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); + XSetForeground(nxagentDisplay, gc, LOGOBLACK); + XSetBackground(nxagentDisplay, gc, LOGOWHITE); } else { - XSetForeground(nxagentDisplay, gc, nxagentLogoWhite); - XSetBackground(nxagentDisplay, gc, nxagentLogoBlack); + XSetForeground(nxagentDisplay, gc, LOGOWHITE); + XSetBackground(nxagentDisplay, gc, LOGOBLACK); } - XPoint rect[4]; + XPoint rect[15]; rect[0].x = 0; rect[0].y = 0; - rect[1].x = 0; rect[1].y = h; - rect[2].x = w; rect[2].y = h; - rect[3].x = w; rect[3].y = 0; + rect[1].x = 0; rect[1].y = height; + rect[2].x = width; rect[2].y = height; + rect[3].x = width; rect[3].y = 0; /* paint background */ XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "%s: filled first poly\n", __func__); + fprintf(stderr, "%s: filled background\n", __func__); #endif - /* - * Draw X2GO Logo - */ - if (blackRoot) - XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray); + XSetForeground(nxagentDisplay, gc, LOGODARKGRAY); else - XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); - - /* - * Start 'X'. - */ + XSetForeground(nxagentDisplay, gc, LOGOLIGHTGRAY); - rect[0].x = w2-7*c; rect[0].y = h2-5*c; - rect[1].x = w2-8*c; rect[1].y = h2-5*c; - rect[2].x = w2-4*c; rect[2].y = h2+3*c; - rect[3].x = w2-3*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = w2-4*c; rect[0].y = h2-5*c; - rect[1].x = w2-3*c; rect[1].y = h2-5*c; - rect[2].x = w2-7*c; rect[2].y = h2+3*c; - rect[3].x = w2-8*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - /* - * End 'X'. - */ + #ifdef NXAGENT_LOGO_DEBUG + /* mark center */ + XDrawLine(nxagentDisplay, nxagentPixmapLogo, gc, 0, h/2, w, h/2); + XDrawLine(nxagentDisplay, nxagentPixmapLogo, gc, w/2, 0, w/2, h); + #endif /* - * Start '2'. + * Draw X2GO Logo */ - rect[0].x = w2-2*c; rect[0].y = h2-5*c; - rect[1].x = w2-1*c; rect[1].y = h2-5*c; - rect[2].x = w2-1*c; rect[2].y = h2-3*c; - rect[3].x = w2-2*c; rect[3].y = h2-3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); +#define WX 5 /* width of "X" */ +#define W2 4 /* width of "2" */ +#define WG 4 /* width of "G" */ +#define WO 4 /* width of "O" */ +#define SPC 1 /* width of space between letters */ +#define H 8 /* height of letters */ - rect[0].x = w2-2*c; rect[0].y = h2-5*c; - rect[1].x = w2+2*c; rect[1].y = h2-5*c; - rect[2].x = w2+2*c; rect[2].y = h2-4*c; - rect[3].x = w2-2*c; rect[3].y = h2-4*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); +#define TOTALW (WX + SPC + W2 + SPC + WG + SPC + WO) /* total width of logo */ +#define XSTART ((w - (TOTALW * c)) / 2) /* x position of whole logo */ +#define YSTART ((h - (H * c)) / 2) /* y position whole logo */ - rect[0].x = w2+1*c; rect[0].y = h2-5*c; - rect[1].x = w2+2*c; rect[1].y = h2-5*c; - rect[2].x = w2+2*c; rect[2].y = h2-2*c; - rect[3].x = w2+1*c; rect[3].y = h2-2*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); +#define X(offset) (XSTART + (offset) * c) +#define Y(offset) (YSTART + (offset) * c) - rect[0].x = w2+2*c; rect[0].y = h2-2*c; - rect[1].x = w2+1*c; rect[1].y = h2-2*c; - rect[2].x = w2-2*c; rect[2].y = h2+2*c; - rect[3].x = w2-1*c; rect[3].y = h2+2*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); +#define XY(xx,yy) {rect[cnt].x = X(xx); rect[cnt++].y = Y(yy);} + int cnt; - rect[0].x = w2-2*c; rect[0].y = h2+2*c; - rect[1].x = w2+2*c; rect[1].y = h2+2*c; - rect[2].x = w2+2*c; rect[2].y = h2+3*c; - rect[3].x = w2-2*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* - * End '2'. + * Paint 'X'. */ - /* - * Start 'G'. - */ + cnt = 0; XY(1,0); XY(0,0); XY(4,8); XY(5,8); + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Convex, CoordModeOrigin); - rect[0].x = w2+3*c; rect[0].y = h2-5*c; - rect[1].x = w2+7*c; rect[1].y = h2-5*c; - rect[2].x = w2+7*c; rect[2].y = h2-4*c; - rect[3].x = w2+3*c; rect[3].y = h2-4*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = w2+3*c; rect[0].y = h2-5*c; - rect[1].x = w2+4*c; rect[1].y = h2-5*c; - rect[2].x = w2+4*c; rect[2].y = h2+3*c; - rect[3].x = w2+3*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = w2+3*c; rect[0].y = h2+2*c; - rect[1].x = w2+7*c; rect[1].y = h2+2*c; - rect[2].x = w2+7*c; rect[2].y = h2+3*c; - rect[3].x = w2+3*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = w2+6*c; rect[0].y = h2-5*c; - rect[1].x = w2+7*c; rect[1].y = h2-5*c; - rect[2].x = w2+7*c; rect[2].y = h2-3*c; - rect[3].x = w2+6*c; rect[3].y = h2-3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + cnt = 0; XY(4,0); XY(5,0); XY(1,8); XY(0,8); + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Convex, CoordModeOrigin); - rect[0].x = w2+6*c; rect[0].y = h2-0*c; - rect[1].x = w2+7*c; rect[1].y = h2-0*c; - rect[2].x = w2+7*c; rect[2].y = h2+3*c; - rect[3].x = w2+6*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = w2+5*c; rect[0].y = h2-1*c; - rect[1].x = w2+7*c; rect[1].y = h2-1*c; - rect[2].x = w2+7*c; rect[2].y = h2+0*c; - rect[3].x = w2+5*c; rect[3].y = h2+0*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* - * End 'G'. + * Paint '2'. */ - /* - * Start 'O'. - */ +#undef X +#define X(offset) (XSTART + (SPC + WX + offset) * c) - rect[0].x = w2+8*c; rect[0].y = h2-5*c; - rect[1].x = w2+12*c; rect[1].y = h2-5*c; - rect[2].x = w2+12*c; rect[2].y = h2-4*c; - rect[3].x = w2+8*c; rect[3].y = h2-4*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + cnt = 0; XY(0,0); XY(4,0); XY(4,3); XY(1,7); XY(4,7); XY(4,8); XY(0,8); XY(0,7); XY(3,3); XY(3,1); XY(1,1); XY(1,2); XY(0,2); XY(0,0); + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Nonconvex, CoordModeOrigin); - rect[0].x = w2+8*c; rect[0].y = h2+3*c; - rect[1].x = w2+12*c; rect[1].y = h2+3*c; - rect[2].x = w2+12*c; rect[2].y = h2+2*c; - rect[3].x = w2+8*c; rect[3].y = h2+2*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + /* + * Paint 'G'. + */ - rect[0].x = w2+8*c; rect[0].y = h2-5*c; - rect[1].x = w2+9*c; rect[1].y = h2-5*c; - rect[2].x = w2+9*c; rect[2].y = h2+3*c; - rect[3].x = w2+8*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); +#undef X +#define X(offset) (XSTART + (SPC + WX + SPC + W2 + offset) * c) - rect[0].x = w2+11*c; rect[0].y = h2-5*c; - rect[1].x = w2+12*c; rect[1].y = h2-5*c; - rect[2].x = w2+12*c; rect[2].y = h2+3*c; - rect[3].x = w2+11*c; rect[3].y = h2+3*c; - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + cnt = 0; XY(0,0); XY(4,0); XY(4,2); XY(3,2); XY(3,1); XY(1,1);XY(1,7); + XY(3,7); XY(3,5); XY(2,5); XY(2,4); XY(4,4); XY(4,8); XY(0,8); XY(0,0); + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Nonconvex, CoordModeOrigin); /* - * End 'O'. + * Paint 'O'. */ +#undef X +#define X(offset) (XSTART + (SPC + WX + SPC + W2 + SPC + WG + offset) * c) + + cnt = 0; XY(0,0); XY(4,0); XY(4,8); XY(0,8); XY(0,1); XY(1,1); XY(1,7); XY(3,7); XY(3,1); XY(0,1); XY(0,0); + XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, cnt, Nonconvex, CoordModeOrigin); XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); + XFreeGC(nxagentDisplay, gc); + #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: end\n", __func__); #endif @@ -404,7 +350,7 @@ void nxagentRemoveSplashWindow(void) nxagentRefreshWindows(screenInfo.screens[0]->root); #ifdef TEST - fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__ + fprintf(stderr, "%s: setting the ownership of %s (%d) on window [0x%lx]\n", __func__, "NX_CUT_BUFFER_SERVER", (int)serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root)); #endif @@ -415,6 +361,6 @@ void nxagentRemoveSplashWindow(void) if (nxagentPixmapLogo) { XFreePixmap(nxagentDisplay, nxagentPixmapLogo); - nxagentPixmapLogo = (Pixmap) 0; + nxagentPixmapLogo = (XlibPixmap) 0; } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index a43801469..eae9c9dd1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -26,20 +26,9 @@ #ifndef __Splash_H__ #define __Splash_H__ -#include "Windows.h" -#include "X11/Xdmcp.h" -#include <nx/NXalert.h> - -#define XDM_TIMEOUT 20000 - -extern xdmcp_states XdmcpState; -extern int XdmcpTimeOutRtx; -extern int XdmcpStartTime; -extern int nxagentXdmcpUp; - -extern Window nxagentSplashWindow; - -extern void nxagentShowSplashWindow(Window); -extern void nxagentRemoveSplashWindow(); - +#ifdef XlibWindow +extern void nxagentShowSplashWindow(XlibWindow); +#endif +extern void nxagentRemoveSplashWindow(void); +extern Bool nxagentHaveSplashWindow(void); #endif /* __Splash_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.c b/nx-X11/programs/Xserver/hw/nxagent/Trap.c index 4fe12bede..6eade2073 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Trap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.c @@ -25,94 +25,84 @@ #include "Trap.h" +#include <nx-X11/Xdefs.h> + /* - * Set if we are dispatching a render - * extension request. Used to avoid + * Set if we are dispatching a render extension request. Used to avoid * reentrancy in GC operations. */ -int nxagentGCTrap = 0; +Bool nxagentGCTrap = False; /* - * Set if we are enqueing an internal - * operation, CreateWindow and Reparent- - * Window. Used to remove any screen operation. + * Set if we are enqueing an internal operation, CreateWindow and + * Reparent- Window. Used to remove any screen operation. */ -int nxagentScreenTrap = 0; +Bool nxagentScreenTrap = False; /* - * Set if we are executing a GC operation - * only on the X side. Used to avoid - * reentrancy in FB layer. + * Set if we are executing a GC operation only on the X side. Used to + * avoid reentrancy in FB layer. */ -int nxagentFBTrap = 0; +Bool nxagentFBTrap = False; /* - * Set if we are dispatching a shared - * memory extension request. + * Set if we are dispatching a shared memory extension request. */ -int nxagentShmTrap = 0; +Bool nxagentShmTrap = False; /* - * Set if a shared pixmap operation is - * requested by the client. + * Set if a shared pixmap operation is requested by the client. */ -int nxagentShmPixmapTrap = 0; +Bool nxagentShmPixmapTrap = False; /* - * Set if we are dispatching a XVideo - * extension request. + * Set if we are dispatching a XVideo extension request. */ -int nxagentXvTrap = 0; +Bool nxagentXvTrap = False; /* - * Set if we are dispatching a GLX - * extension request. + * Set if we are dispatching a GLX extension request. */ -int nxagentGlxTrap = 0; +Bool nxagentGlxTrap = False; /* * Set while we are resuming the session. */ -int nxagentReconnectTrap = 0; +Bool nxagentReconnectTrap = False; /* - * Set if we need to realize a drawable - * by using a lossless encoding. + * Set if we need to realize a drawable by using a lossless encoding. */ -int nxagentLosslessTrap = 0; +Bool nxagentLosslessTrap = False; /* - * Set to force the synchronization of - * a drawable. + * Set to force the synchronization of a drawable. */ -int nxagentSplitTrap = 0; +Bool nxagentSplitTrap = False; /* - * Set to avoid CapsLock synchronization - * problems when CapsLock is the first - * key to be pressed in the session. + * Set to avoid CapsLock synchronization problems when CapsLock is the + * first key to be pressed in the session. */ -int nxagentXkbCapsTrap = 0; +Bool nxagentXkbCapsTrap = False; /* - * Set to avoid NumLock synchronization - * problems when NumLock is the first - * key to be pressed in the session. + * Set to avoid NumLock synchronization problems when NumLock is the + * first key to be pressed in the session. */ -int nxagentXkbNumTrap = 0; - +Bool nxagentXkbNumTrap = False; /* * Set to indicate we are processing a clipboard event triggered by @@ -120,4 +110,4 @@ int nxagentXkbNumTrap = 0; * would trigger another event by the real X server */ -int nxagentExternalClipboardEventTrap = 0; +Bool nxagentExternalClipboardEventTrap = False; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.h b/nx-X11/programs/Xserver/hw/nxagent/Trap.h index cd1e79ff7..4203d2b13 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Trap.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.h @@ -26,6 +26,14 @@ #ifndef __Traps_H__ #define __Traps_H__ +#ifndef False +#define False 0 +#endif + +#ifndef True +#define True 1 +#endif + /* * Set if we are dispatching a render extension request. Used to avoid * reentrancy in GC operations. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Visual.h b/nx-X11/programs/Xserver/hw/nxagent/Visual.h index 40946f3c0..3f173021b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Visual.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Visual.h @@ -74,7 +74,7 @@ Colormap nxagentDefaultVisualColormap(Visual *visual); (v1).blue_mask == (v2).red_mask) && \ (v1).colormap_size == (v2).colormap_size) -Visual nxagentAlphaVisual; +extern Visual nxagentAlphaVisual; void nxagentInitAlphaVisual(); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index d60be1aa7..e6b9c03df 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -76,12 +76,6 @@ int nxagentWindowPrivateIndex; /* - * Number of windows which need synchronization. - */ - -int nxagentCorruptedWindows; - -/* * Used to track nxagent window's visibility. */ @@ -89,6 +83,9 @@ int nxagentVisibility = VisibilityUnobscured; unsigned long nxagentVisibilityTimeout = 0; Bool nxagentVisibilityStop = False; +ConfiguredWindowStruct *nxagentConfiguredWindowList; +StaticResizedWindowStruct *nxagentStaticResizedWindowList; + /* * Set here the required log level. */ @@ -99,8 +96,7 @@ Bool nxagentVisibilityStop = False; #undef DEBUG /* - * Useful to test the window configuration - * failures. + * Useful to test the window configuration failures. */ #ifdef TEST @@ -128,8 +124,7 @@ static int nxagentExposeSerial = 0; StoringPixmapPtr nxagentBSPixmapList[BSPIXMAPLIMIT]; /* - * Used to walk through the window hierarchy - * to find a window + * Used to walk through the window hierarchy to find a window */ typedef struct _WindowMatch @@ -337,9 +332,8 @@ Bool nxagentCreateWindow(WindowPtr pWin) #endif /* - * Select the event mask if window is a top level - * window. This at least makes the keyboard barely - * work. + * Select the event mask if window is a top level window. This at + * least makes the keyboard barely work. */ #ifdef TEST @@ -415,9 +409,8 @@ Bool nxagentCreateWindow(WindowPtr pWin) #endif /* - * Set the WM_DELETE_WINDOW protocols on every - * top level window. Also redirect the window - * if it is a top level. + * Set the WM_DELETE_WINDOW protocols on every top level + * window. Also redirect the window if it is a top level. */ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) @@ -430,9 +423,8 @@ Bool nxagentCreateWindow(WindowPtr pWin) nxagentAddPropertyToList(prop, pWin); /* - * Redirect the window to the off-screen - * memory, if the composite extension is - * supported on the display. + * Redirect the window to the off-screen memory, if the composite + * extension is supported on the display. */ /* FIXME: Do all the windows for which nxagentWindowTopLevel(pWin) @@ -483,8 +475,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) fbCreateWindow(pWin); /* - * Only the root window will have - * the right colormap. + * Only the root window will have the right colormap. */ if (!pWin->parent) @@ -707,10 +698,9 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) nxagentWMDetect(); /* - * The smart scheduler could be stopped while - * waiting for the reply. In this case we need - * to yield explicitly to avoid to be stuck in - * the dispatch loop forever. + * The smart scheduler could be stopped while waiting for the + * reply. In this case we need to yield explicitly to avoid to be + * stuck in the dispatch loop forever. */ isItTimeToYield = 1; @@ -764,10 +754,6 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) { - Window w; - XSetWindowAttributes attributes; - unsigned long valuemask; - if (nxagentOption(Rootless)) { return; @@ -787,14 +773,16 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) } } - w = nxagentDefaultWindows[pScreen -> myNum]; + Window w = nxagentDefaultWindows[pScreen -> myNum]; /* * override_redirect makes the window manager ignore the window and * not add decorations, see ICCCM) */ - attributes.override_redirect = switchOn; - valuemask = CWOverrideRedirect; + XSetWindowAttributes attributes = { + .override_redirect = switchOn + }; + unsigned long valuemask = CWOverrideRedirect; XUnmapWindow(nxagentDisplay, w); XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes); @@ -836,8 +824,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) if (i < 100) { /* - * The window manager has done with the reparent - * operation. We can resize and map the window. + * The window manager has done with the reparent operation. We + * can resize and map the window. */ nxagentChangeOption(Fullscreen, True); @@ -881,8 +869,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) nxagentOption(RootX), nxagentOption(RootY)); /* - * We disable the screensaver when changing - * mode to fullscreen. Is it really needed? + * We disable the screensaver on the real Xserver when changing mode to + * fullscreen. Is it really needed? */ XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); @@ -1167,11 +1155,10 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) if (nxagentOption(ClientOs) == ClientOsWinnt) { /* - * If doMove is True we add exposed rectangles - * to the remote expose region. This is done to - * refresh the areas showed newly in the viewport. - * We create two rectangles, one for horizontal - * pan and one for vertical pan. + * If doMove is True we add exposed rectangles to the remote + * expose region. This is done to refresh the areas showed newly + * in the viewport. We create two rectangles, one for + * horizontal pan and one for vertical pan. */ BoxRec hRect = {.x1 = -newX, .y1 = -newY}; @@ -1411,10 +1398,9 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) Window parent_return; Window *children_return = NULL; unsigned int nchildren_return; - Status result; - result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), - &root_return, &parent_return, &children_return, &nchildren_return); + Status result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), + &root_return, &parent_return, &children_return, &nchildren_return); if (result) { @@ -1447,7 +1433,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) * * else if (mask & CWStackMode) * { - * if (nxagentSplashWindow) + * if (nxagentHaveSplashWindow()) * { * valuemask = CWStackMode; * @@ -1622,16 +1608,14 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) case ParentRelative: { attributes.background_pixmap = ParentRelative; - break; } case BackgroundPixmap: { /* - * If a window background is corrupted, we grant - * its usability by clearing it with a solid co- - * lor. When the pixmap will be fully synchroni- - * zed, an expose will be sent to the window's + * If a window background is corrupted, we grant its usability + * by clearing it with a solid color. When the pixmap will be + * fully synchronized, an expose will be sent to the window's * hierarchy. */ @@ -1649,8 +1633,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) nxagentAllocateCorruptedResource((DrawablePtr) pWin -> background.pixmap, RT_NX_CORR_BACKGROUND); /* - * Clearing the remote background to - * make it usable. + * Clearing the remote background to make it usable. */ nxagentFillRemoteRegion((DrawablePtr) pWin -> background.pixmap, @@ -1665,7 +1648,6 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) case BackgroundPixel: { mask &= ~CWBackPixmap; - break; } } @@ -1713,9 +1695,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) } /* - * As we set this bit, we must change dix in - * order not to perform PositionWindow and let - * X move children windows for us. + * As we set this bit, we must change dix in order not to perform + * PositionWindow and let X move children windows for us. */ if (mask & CWWinGravity) @@ -1724,8 +1705,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) } /* - FIXME: Do we need to set the attribute on the - remote display? + FIXME: Do we need to set the attribute on the remote display? */ if (mask & CWBackingStore) { @@ -1767,8 +1747,7 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) } /* - FIXME: Do we need to set the attribute on the - remote display? + FIXME: Do we need to set the attribute on the remote display? */ if (mask & CWSaveUnder) { @@ -1794,9 +1773,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ColormapPtr pCmap = (ColormapPtr) LookupIDByType(wColormap(pWin), RT_COLORMAP); /* - FIXME: When the caller is nxagentReconfigureWindow - sometimes wColormap(pWin) is 0. Could a window - have no colormap? + FIXME: When the caller is nxagentReconfigureWindow sometimes + wColormap(pWin) is 0. Could a window have no colormap? */ if (pCmap != NULL) { @@ -1987,8 +1965,6 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) { - RegionRec temp; - if (pWin -> realized) { BoxPtr pBox = RegionRects(pRegion); @@ -2012,11 +1988,11 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) #endif /* - * The framebuffer operations don't take care of - * clipping to the actual area of the framebuffer - * so we need to clip ourselves. + * The framebuffer operations don't take care of clipping to the + * actual area of the framebuffer so we need to clip ourselves. */ + RegionRec temp; RegionInit(&temp, NullBox, 1); RegionIntersect(&temp, pRegion, &pWin -> clipList); nxagentFrameBufferPaintWindow(pWin, &temp, what); @@ -2025,14 +2001,12 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { - RegionRec temp; - /* - * The framebuffer operations don't take care of - * clipping to the actual area of the framebuffer - * so we need to clip ourselves. + * The framebuffer operations don't take care of clipping to the + * actual area of the framebuffer so we need to clip ourselves. */ + RegionRec temp; RegionInit(&temp, NullBox, 1); RegionIntersect(&temp, pRegion, &pWin -> borderClip); nxagentFrameBufferPaintWindow(pWin, &temp, what); @@ -2148,8 +2122,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo * final region by referring to the first element of the vector. */ - RegionRec temp; - BoxRec box; if (nxagentSessionState != SESSION_DOWN) { @@ -2181,13 +2153,14 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeArrayIsInitialized = 1; } + RegionRec temp; RegionInit(&temp, (BoxRec *) NULL, 1); if (pRgn != NULL) { if (RegionNumRects(pRgn) > RECTLIMIT) { - box = *RegionExtents(pRgn); + BoxRec box = *RegionExtents(pRgn); RegionEmpty(pRgn); RegionInit(pRgn, &box, 1); @@ -2247,8 +2220,8 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo #endif /* - * Mark this region for sending a synchro, - * in nxagentFlushConfigureWindow(). + * Mark this region for sending a synchro, in + * nxagentFlushConfigureWindow(). */ nxagentExposeQueue.exposures[index].synchronize = 1; @@ -2300,9 +2273,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo #ifdef SHAPE static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) { - BoxPtr pBox1, pBox2; - unsigned int n1, n2; - if (pReg1 == pReg2) { return True; @@ -2313,11 +2283,11 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) return False; } - pBox1 = RegionRects(pReg1); - n1 = RegionNumRects(pReg1); + BoxPtr pBox1 = RegionRects(pReg1); + int n1 = RegionNumRects(pReg1); - pBox2 = RegionRects(pReg2); - n2 = RegionNumRects(pReg2); + BoxPtr pBox2 = RegionRects(pReg2); + int n2 = RegionNumRects(pReg2); if (n1 != n2) { @@ -2339,9 +2309,6 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) void nxagentShapeWindow(WindowPtr pWin) { - Region reg; - BoxPtr pBox; - if (NXDisplayError(nxagentDisplay) == 1) { return; @@ -2379,8 +2346,8 @@ void nxagentShapeWindow(WindowPtr pWin) RegionCopy(nxagentWindowPriv(pWin)->boundingShape, wBoundingShape(pWin)); - reg = XCreateRegion(); - pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape); + Region reg = XCreateRegion(); + BoxPtr pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape); for (int i = 0; i < RegionNumRects(nxagentWindowPriv(pWin)->boundingShape); i++) @@ -2438,8 +2405,8 @@ void nxagentShapeWindow(WindowPtr pWin) RegionCopy(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin)); - reg = XCreateRegion(); - pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape); + Region reg = XCreateRegion(); + BoxPtr pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape); for (int i = 0; i < RegionNumRects(nxagentWindowPriv(pWin)->clipShape); i++) @@ -2581,9 +2548,8 @@ void nxagentMapDefaultWindows(void) XMapWindow(nxagentDisplay, nxagentInputWindows[pScreen->myNum]); /* - * At reconnection the Input Window is - * raised in nxagentReconnectAllWindows, - * after the Root Window is mapped. + * At reconnection the Input Window is raised in + * nxagentReconnectAllWindows, after the Root Window is mapped. */ if (nxagentReconnectTrap == 0) @@ -2593,8 +2559,7 @@ void nxagentMapDefaultWindows(void) } /* - * Send a SetSelectionOwner request - * to notify of the agent start. + * Send a SetSelectionOwner request to notify of the agent start. */ XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, @@ -2640,8 +2605,7 @@ Bool nxagentDisconnectAllWindows(void) for (int i = 0; i < screenInfo.numScreens; i++) { - WindowPtr pWin = screenInfo.screens[i]->root; - nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeeded); + nxagentTraverseWindow(screenInfo.screens[i]->root, nxagentDisconnectWindow, &succeeded); nxagentDefaultWindows[i] = None; } @@ -2706,7 +2670,7 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) if (DeleteProperty(pWin, prop) != Success) { - fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW failed.\n"); + fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW failed.\n"); } #ifdef DEBUG else @@ -2771,9 +2735,8 @@ Bool nxagentReconnectAllWindows(void *p0) } /* - * After the Root Window has - * been mapped, the Input - * Windows is raised. + * After the Root Window has been mapped, the Input Windows is + * raised. */ if (nxagentOption(Rootless) == 0) @@ -2990,14 +2953,12 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer #endif /* - * FIXME: This quick hack is intended to solve a - * problem of NXWin X server for windows. - * The NXWin minimize the windows moving them - * out of the screen area, this behaviour - * can cause problem when a rootless session - * is disconnected and an apps is minimized. - * It will be solved with new Xorg version of - * the NXWin server. + * FIXME: This quick hack is intended to solve a problem of NXWin X + * server for windows. The NXWin minimize the windows moving + * them out of the screen area, this behaviour can cause + * problem when a rootless session is disconnected and an + * apps is minimized. It will be solved with new Xorg + * version of the NXWin server. */ if (nxagentOption(Rootless)) @@ -3040,9 +3001,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer #endif /* - * We have to set the WM_DELETE_WINDOW protocols - * on every top level window, because we don't know - * if a client handles this. + * We have to set the WM_DELETE_WINDOW protocols on every top level + * window, because we don't know if a client handles this. */ if (nxagentOption(Rootless) && (pWin != screenInfo.screens[0]->root)) @@ -3061,7 +3021,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer if (nxagentWindowTopLevel(pWin)) { - int ret; Atom type; int format; unsigned long nItems, bytesLeft; @@ -3071,15 +3030,15 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer unsigned char *data64 = NULL; #endif - ret = GetWindowProperty(pWin, - XA_WM_NORMAL_HINTS, - 0, sizeof(XSizeHints), - False, XA_WM_SIZE_HINTS, - &type, &format, &nItems, &bytesLeft, &data); + int ret = GetWindowProperty(pWin, + XA_WM_NORMAL_HINTS, + 0, sizeof(XSizeHints), + False, XA_WM_SIZE_HINTS, + &type, &format, &nItems, &bytesLeft, &data); /* - * 72 is the number of bytes returned by - * sizeof(XSizeHints) on 32 bit platforms. + * 72 is the number of bytes returned by sizeof(XSizeHints) on + * 32 bit platforms. */ if (ret == Success && @@ -3087,7 +3046,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer bytesLeft == 0 && type == XA_WM_SIZE_HINTS) { - XSizeHints *props; #ifdef TEST fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n", (void*)pWin, pWin -> drawable.id, nxagentWindow(pWin)); @@ -3108,9 +3066,9 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer *(data64 + i) = *(data + i - 4); } - props = (XSizeHints *) data64; + XSizeHints *props = (XSizeHints *) data64; #else - props = (XSizeHints *) data; + XSizeHints *props = (XSizeHints *) data; #endif /* _XSERVER64 */ hints = *props; @@ -3164,15 +3122,14 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat { WindowPtr pWin = (WindowPtr)param0; Bool *pBool = (Bool*)data_buffer; - CursorPtr pCursor; - ScreenPtr pScreen; + CursorPtr pCursor; if (!pWin || !*pBool || !(pCursor = wCursor(pWin))) { return; } - pScreen = pWin -> drawable.pScreen; + ScreenPtr pScreen = pWin -> drawable.pScreen; if (!(nxagentCursorPriv(pCursor, pScreen))) { @@ -3308,27 +3265,23 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) Bool nxagentCheckWindowIntegrity(WindowPtr pWin) { Bool integrity = True; - XImage *image; - char *data; - int format; - unsigned long plane_mask = AllPlanes; - unsigned int width, height, length, depth; - width = pWin -> drawable.width; - height = pWin -> drawable.height; - depth = pWin -> drawable.depth; - format = (depth == 1) ? XYPixmap : ZPixmap; + unsigned int width = pWin -> drawable.width; + unsigned int height = pWin -> drawable.height; + unsigned int depth = pWin -> drawable.depth; + int format = (depth == 1) ? XYPixmap : ZPixmap; if (width && height) { - length = nxagentImageLength(width, height, format, 0, depth); - data = calloc(1, length); + unsigned int length = nxagentImageLength(width, height, format, 0, depth); + char *data = calloc(1, length); if (data == NULL) { FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size %d.\n", length); } - image = XGetImage(nxagentDisplay, nxagentWindow(pWin), 0, 0, + unsigned long plane_mask = AllPlanes; + XImage *image = XGetImage(nxagentDisplay, nxagentWindow(pWin), 0, 0, width, height, plane_mask, format); if (image == NULL) { @@ -3396,7 +3349,6 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) Bool nxagentIsIconic(WindowPtr pWin) { - int iReturn; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; Atom atomReturnType; @@ -3408,9 +3360,9 @@ Bool nxagentIsIconic(WindowPtr pWin) return 0; } - iReturn = GetWindowProperty(pWin, MakeAtom("WM_STATE", 8, False), 0, sizeof(CARD32), False, - AnyPropertyType, &atomReturnType, &iReturnFormat, - &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); + int iReturn = GetWindowProperty(pWin, MakeAtom("WM_STATE", 8, False), 0, sizeof(CARD32), False, + AnyPropertyType, &atomReturnType, &iReturnFormat, + &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); if (iReturn == Success) { @@ -3734,7 +3686,6 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence) { - StaticResizedWindowStruct *index; StaticResizedWindowStruct *ret = NULL; if (nxagentStaticResizedWindowList == NULL) @@ -3742,7 +3693,7 @@ StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence return NULL; } - index = nxagentStaticResizedWindowList; + StaticResizedWindowStruct *index = nxagentStaticResizedWindowList; while (index && index -> sequence > sequence) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Windows.h b/nx-X11/programs/Xserver/hw/nxagent/Windows.h index aa4629b47..8666ebec9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Windows.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Windows.h @@ -50,16 +50,14 @@ typedef struct void *pPicture; /* - * Set if the window is mapped - * on the remote server. + * Set if the window is mapped on the remote server. */ int isMapped; /* - * Set if the window on the remote - * server is redirected by using - * the composite extension. + * Set if the window on the remote server is redirected by using the + * composite extension. */ int isRedirected; @@ -116,9 +114,8 @@ extern int nxagentWindowPrivateIndex; #define nxagentWindow(pWin) (nxagentWindowPriv(pWin)->window) /* - * Window is either a child of our root - * or a child of the root of the real X - * server. + * Window is either a child of our root or a child of the root of the + * real X server. */ #define nxagentWindowParent(pWin) \ @@ -165,8 +162,7 @@ extern int nxagentWindowPrivateIndex; #define CW_RootlessRestack (1 << 18) /* - * This force the agent to send exposures - * for all windows. + * This force the agent to send exposures for all windows. */ #define nxagentRefreshScreen() \ @@ -182,17 +178,16 @@ extern XlibAtom serverTransToAgentProperty; #endif /* - * If the rectangles in an exposed region exceed - * the number of 4, we let the function decide if - * it is better to send the window extents rather - * than the rectangles in the region. + * If the rectangles in an exposed region exceed the number of 4, we + * let the function decide if it is better to send the window extents + * rather than the rectangles in the region. */ int nxagentExtentsPredicate(int total); /* - * Agent's nested window procedures. Look also - * at Rootless.h for the rootless counterparts. + * Agent's nested window procedures. Look also at Rootless.h for the + * rootless counterparts. */ Bool nxagentCreateWindow(WindowPtr pWin); @@ -250,8 +245,8 @@ void nxagentMapDefaultWindows(void); Bool nxagentSetWindowCursors(void *p0); /* - * The ConfigureWindow procedure has not - * a pointer in the screen structure. + * The ConfigureWindow procedure has not a pointer in the screen + * structure. */ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask); @@ -265,10 +260,9 @@ extern unsigned long nxagentVisibilityTimeout; extern Bool nxagentVisibilityStop; /* - * Return the pointer to the window given the - * remote id. It tries to match the id from - * the last matched window before iterating - * through the hierarchy. + * Return the pointer to the window given the remote id. It tries to + * match the id from the last matched window before iterating through + * the hierarchy. */ WindowPtr nxagentGetWindowFromID(Window id); @@ -294,7 +288,6 @@ typedef struct _ConfiguredWindow unsigned int valuemask; } ConfiguredWindowStruct; -ConfiguredWindowStruct *nxagentConfiguredWindowList; typedef struct _StaticResizedWindow { @@ -306,8 +299,6 @@ typedef struct _StaticResizedWindow int offY; } StaticResizedWindowStruct; -StaticResizedWindowStruct *nxagentStaticResizedWindowList; - void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); void nxagentFlushConfigureWindow(void); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Xdmcp.h b/nx-X11/programs/Xserver/hw/nxagent/Xdmcp.h new file mode 100644 index 000000000..086ea9082 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/Xdmcp.h @@ -0,0 +1,41 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */ +/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/ +/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */ +/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXAGENT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef __Xdmcp_H__ +#define __Xdmcp_H__ + +#include "Windows.h" +#include "X11/Xdmcp.h" +#include <nx/NXalert.h> + +#define XDM_TIMEOUT 20000 + +/* these are defined in os/xdmcp.h */ +extern xdmcp_states XdmcpState; +extern int XdmcpTimeOutRtx; +extern int XdmcpStartTime; +extern int nxagentXdmcpUp; + +#endif /* __Xdmcp_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/screensaver b/nx-X11/programs/Xserver/hw/nxagent/screensaver deleted file mode 100644 index a9ca85114..000000000 --- a/nx-X11/programs/Xserver/hw/nxagent/screensaver +++ /dev/null @@ -1,711 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */ -/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/ -/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */ -/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXAGENT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#define screensaver_width 256 -#define screensaver_height 256 -static unsigned char screensaver_bits[] = { - 0xa8, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, - 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x40, 0x55, - 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x55, 0x05, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0xa0, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0xaa, - 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0xa0, - 0xaa, 0x0a, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x50, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xaa, 0x2a, 0x80, 0x02, 0x80, 0xaa, 0xaa, 0x82, 0x0a, 0xa8, 0x28, 0x80, - 0x8a, 0x80, 0x2a, 0x80, 0x80, 0x8a, 0xa2, 0x82, 0x0a, 0xaa, 0x0a, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x80, 0x82, 0x41, 0x40, 0x00, 0x50, - 0x55, 0x41, 0x00, 0x00, 0x04, 0x00, 0x54, 0x40, 0x10, 0x00, 0x40, 0x00, - 0x51, 0x55, 0x00, 0x15, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x10, 0x14, 0x00, 0x00, 0x00, 0xa8, 0x8a, 0x02, 0x00, 0x02, - 0x00, 0x20, 0xa2, 0x00, 0x80, 0x00, 0x08, 0x00, 0xaa, 0x2a, 0x00, 0x2a, - 0x08, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, - 0x01, 0x00, 0x01, 0x50, 0x45, 0x05, 0x00, 0x01, 0x10, 0x10, 0x40, 0x11, - 0x40, 0x00, 0x44, 0x00, 0x50, 0x15, 0x01, 0x15, 0x04, 0x00, 0x40, 0x00, - 0x05, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0xa2, - 0xaa, 0x2a, 0x00, 0x00, 0x02, 0x00, 0xa0, 0x08, 0x00, 0x00, 0x00, 0x00, - 0xa2, 0xaa, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x01, 0x40, 0x44, 0x15, 0x10, 0x01, - 0x10, 0x10, 0x40, 0x01, 0x40, 0x00, 0x00, 0x00, 0x54, 0x55, 0x41, 0x45, - 0x04, 0x00, 0x40, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x54, - 0x20, 0x80, 0x00, 0x82, 0xaa, 0x0a, 0x00, 0x00, 0x22, 0x00, 0x80, 0x0a, - 0x00, 0x00, 0x82, 0x00, 0xa0, 0x8a, 0x22, 0x02, 0x00, 0x08, 0x20, 0x00, - 0xa8, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x2a, 0x10, 0x40, 0x00, 0x01, - 0x54, 0x45, 0x10, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x00, - 0x50, 0x45, 0x05, 0x41, 0x00, 0x04, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x15, 0x00, 0x28, 0x00, 0xaa, 0xaa, 0x0a, 0x0a, 0x00, - 0x20, 0x08, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x22, 0x2a, - 0x00, 0x00, 0x0a, 0x00, 0xa8, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0a, - 0x50, 0x05, 0x00, 0x01, 0x55, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, - 0x01, 0x00, 0x00, 0x00, 0x40, 0x55, 0x11, 0x00, 0x00, 0x54, 0x01, 0x00, - 0x44, 0x01, 0x00, 0x00, 0x05, 0x40, 0x00, 0x05, 0x00, 0x08, 0x00, 0x80, - 0xaa, 0xaa, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x80, 0x00, - 0x80, 0xaa, 0x28, 0x20, 0x00, 0x00, 0x02, 0x00, 0x80, 0x02, 0x00, 0x00, - 0x28, 0x00, 0x80, 0x02, 0x10, 0x10, 0x00, 0x01, 0x54, 0x45, 0x01, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x10, 0x55, 0x14, 0x00, - 0x00, 0x04, 0x04, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x40, 0x40, 0x01, - 0x08, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x20, 0xa0, 0xaa, 0x00, 0x80, 0x28, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x80, 0x02, 0x00, 0x00, 0x80, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x14, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x40, 0x00, 0x00, 0x08, 0x20, 0x80, 0x00, 0x08, 0x08, 0x80, 0x80, - 0x80, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x8a, 0x00, - 0x02, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, - 0x10, 0x10, 0x00, 0x01, 0x10, 0x45, 0x55, 0x01, 0x00, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, - 0x20, 0xa2, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, - 0x00, 0x80, 0x00, 0x02, 0x04, 0x00, 0x40, 0x00, 0x04, 0x04, 0x40, 0x40, - 0x00, 0x01, 0x00, 0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x51, 0x45, 0x05, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x45, 0x01, - 0x2a, 0x80, 0xaa, 0xaa, 0x82, 0xaa, 0x2a, 0xa0, 0x02, 0x02, 0x80, 0xa8, - 0x00, 0x2a, 0xa0, 0x02, 0x80, 0xa2, 0x00, 0xa0, 0xa0, 0x0a, 0xa0, 0x00, - 0x00, 0x00, 0x80, 0x88, 0x02, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x50, 0x41, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0xaa, 0x0a, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x54, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x2a, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, - 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x55, 0x55, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x05, 0x00, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, - 0x15, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa8, 0xaa, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, - 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x2a, 0x20, 0x00, 0x00, 0x41, 0x05, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14, - 0x40, 0x10, 0x44, 0x15, 0x15, 0x00, 0x00, 0x50, 0x01, 0x00, 0x50, 0x55, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x10, 0x50, 0x40, - 0x82, 0x08, 0x02, 0x08, 0x20, 0x08, 0x00, 0x22, 0xa0, 0x20, 0x88, 0x00, - 0x22, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x80, 0x02, - 0x00, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x88, 0x20, 0x44, 0x10, 0x01, 0x04, - 0x50, 0x04, 0x00, 0x41, 0x10, 0x11, 0x44, 0x00, 0x41, 0x00, 0x00, 0x54, - 0x41, 0x00, 0x40, 0x55, 0x15, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x11, 0x04, 0x11, 0x80, 0x20, 0x02, 0x08, 0xa0, 0x08, 0x00, 0x02, - 0x88, 0x20, 0x88, 0x00, 0x82, 0x00, 0x00, 0x2a, 0x22, 0x00, 0x80, 0xaa, - 0x2a, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x08, 0x20, - 0x40, 0x10, 0x01, 0x04, 0x50, 0x04, 0x00, 0x01, 0x04, 0x41, 0x44, 0x00, - 0x41, 0x00, 0x00, 0x15, 0x05, 0x14, 0x15, 0x50, 0x10, 0x05, 0x40, 0x41, - 0x41, 0x10, 0x45, 0x05, 0x50, 0x04, 0x04, 0x10, 0x80, 0x20, 0x02, 0x08, - 0xa0, 0x08, 0x00, 0x02, 0x08, 0x22, 0x82, 0x00, 0x82, 0x00, 0x00, 0x0a, - 0x2a, 0x22, 0x8a, 0x22, 0x22, 0x08, 0x80, 0x22, 0x22, 0x88, 0x88, 0x02, - 0x28, 0x02, 0x08, 0x20, 0x40, 0x10, 0x15, 0x54, 0x10, 0x05, 0x00, 0x14, - 0x04, 0x41, 0x44, 0x05, 0x41, 0x00, 0x00, 0x05, 0x50, 0x01, 0x41, 0x04, - 0x05, 0x11, 0x00, 0x05, 0x44, 0x44, 0x50, 0x00, 0x10, 0x05, 0x50, 0x10, - 0x80, 0x0a, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x20, 0xa8, 0x82, 0x82, 0x00, - 0x2a, 0x00, 0x80, 0x02, 0x22, 0x02, 0x82, 0x20, 0x20, 0x08, 0x20, 0x88, - 0x82, 0x88, 0x8a, 0x00, 0x88, 0x0a, 0x80, 0x20, 0x40, 0x04, 0x01, 0x04, - 0x10, 0x05, 0x00, 0x40, 0x04, 0x41, 0x41, 0x00, 0x11, 0x00, 0x40, 0x01, - 0x41, 0x41, 0x41, 0x14, 0x15, 0x11, 0x40, 0x44, 0x04, 0x44, 0x40, 0x00, - 0x44, 0x15, 0x00, 0x11, 0x80, 0x08, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x80, - 0x08, 0x82, 0x82, 0x00, 0x22, 0x00, 0xa0, 0x00, 0x22, 0x22, 0x82, 0x20, - 0x22, 0x0a, 0x20, 0x28, 0x82, 0x82, 0x88, 0x00, 0x88, 0x2a, 0x00, 0x22, - 0x44, 0x10, 0x01, 0x04, 0x10, 0x04, 0x00, 0x41, 0x04, 0x01, 0x41, 0x00, - 0x41, 0x00, 0x50, 0x01, 0x14, 0x14, 0x01, 0x55, 0x10, 0x15, 0x40, 0x45, - 0x05, 0x01, 0x45, 0x00, 0x04, 0x55, 0x04, 0x11, 0x82, 0x20, 0x02, 0x08, - 0x20, 0x08, 0x00, 0x22, 0x08, 0x82, 0x80, 0x00, 0x82, 0x00, 0xa8, 0x00, - 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0xaa, 0x88, 0x20, 0x41, 0x10, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14, - 0x04, 0x01, 0x41, 0x15, 0x41, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40, - 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x54, 0x51, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x15, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, - 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xa8, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, - 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, - 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, - 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x15, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, - 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x14, 0x40, 0x01, 0x41, 0x40, 0x01, 0x14, 0x10, 0x01, 0x00, 0x40, - 0x01, 0x04, 0x14, 0x14, 0x14, 0x10, 0x04, 0x00, 0xa0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0a, 0xaa, 0x00, 0x00, 0x00, 0x80, 0x82, 0xa0, 0x20, 0x82, - 0xa2, 0x20, 0x02, 0x22, 0x28, 0x02, 0x00, 0x08, 0x8a, 0x22, 0x08, 0x08, - 0x22, 0x28, 0x0a, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x44, 0x54, - 0x01, 0x00, 0x00, 0x40, 0x41, 0x40, 0x10, 0x04, 0x11, 0x11, 0x04, 0x41, - 0x10, 0x04, 0x00, 0x04, 0x04, 0x40, 0x10, 0x00, 0x41, 0x10, 0x11, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xaa, 0x02, 0x00, 0x00, 0xa0, - 0x82, 0x80, 0x08, 0x08, 0x02, 0x08, 0x88, 0x80, 0x08, 0x08, 0x00, 0x08, - 0x08, 0x20, 0x20, 0x80, 0x80, 0x20, 0x00, 0x00, 0x10, 0x50, 0x14, 0x14, - 0x45, 0x05, 0x40, 0x05, 0x41, 0x14, 0x15, 0x50, 0x41, 0x01, 0x04, 0x00, - 0x01, 0x04, 0x50, 0x00, 0x11, 0x04, 0x00, 0x14, 0x00, 0x40, 0x10, 0x44, - 0x00, 0x11, 0x00, 0x00, 0xa0, 0x88, 0x22, 0xa2, 0x88, 0x08, 0x00, 0x2a, - 0x82, 0x22, 0x22, 0xa8, 0x80, 0x0a, 0x08, 0x00, 0x02, 0xa8, 0x8a, 0xaa, - 0x08, 0x08, 0x00, 0xa8, 0x00, 0x2a, 0x20, 0x80, 0xaa, 0x20, 0x00, 0x00, - 0x00, 0x05, 0x04, 0x15, 0x55, 0x04, 0x40, 0x04, 0x50, 0x54, 0x01, 0x54, - 0x00, 0x54, 0x04, 0x00, 0x01, 0x04, 0x40, 0x00, 0x10, 0x04, 0x00, 0x40, - 0x05, 0x41, 0x40, 0x40, 0x00, 0x10, 0x00, 0x00, 0x80, 0x08, 0x02, 0x82, - 0x80, 0x08, 0x80, 0x20, 0x02, 0x02, 0x02, 0x2a, 0x00, 0xa0, 0x08, 0x00, - 0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00, 0x8a, 0x20, 0x20, 0x82, - 0x00, 0x20, 0x00, 0x00, 0x10, 0x45, 0x04, 0x11, 0x51, 0x04, 0x50, 0x44, - 0x44, 0x44, 0x01, 0x15, 0x00, 0x40, 0x05, 0x00, 0x01, 0x04, 0x40, 0x00, - 0x10, 0x04, 0x00, 0x00, 0x54, 0x40, 0x40, 0x41, 0x00, 0x10, 0x00, 0x00, - 0xa0, 0x28, 0x02, 0x0a, 0x8a, 0x08, 0x20, 0x0a, 0x0a, 0x28, 0x02, 0x0a, - 0x00, 0x80, 0x08, 0x00, 0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00, - 0x88, 0x20, 0x80, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x05, 0x40, 0x00, 0x11, 0x00, - 0x01, 0x10, 0x10, 0x01, 0x11, 0x04, 0x00, 0x04, 0x50, 0x40, 0x41, 0x01, - 0x01, 0x11, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, - 0xaa, 0x00, 0x80, 0x02, 0x80, 0x80, 0x20, 0x02, 0x02, 0x20, 0x08, 0x82, - 0x08, 0x08, 0x00, 0x08, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x00, 0x00, - 0x00, 0x40, 0x01, 0x10, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x40, 0x01, - 0x40, 0x14, 0x40, 0x41, 0x05, 0x40, 0x01, 0x14, 0x14, 0x14, 0x00, 0x44, - 0x01, 0x45, 0x00, 0x00, 0x14, 0x54, 0x00, 0x00, 0x00, 0x80, 0x02, 0x08, - 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x50, - 0x55, 0x05, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0xa8, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, - 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0, - 0xaa, 0x0a, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x15, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x8a, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, - 0xa8, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x05, 0x50, 0x00, 0x50, 0x40, 0x45, 0x11, 0x00, 0x50, - 0x40, 0x41, 0x01, 0x00, 0x14, 0x00, 0x51, 0x40, 0x40, 0x00, 0x05, 0x14, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a, - 0x88, 0x02, 0xaa, 0xa8, 0x80, 0x00, 0x00, 0xaa, 0xa8, 0xa2, 0x02, 0x00, - 0xa2, 0xa0, 0x22, 0xa8, 0xa0, 0xa0, 0x8a, 0x2a, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x04, 0x01, 0x45, 0x51, - 0x04, 0x40, 0x00, 0x45, 0x41, 0x51, 0x01, 0x00, 0x41, 0x50, 0x54, 0x50, - 0x50, 0x50, 0x14, 0x14, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x82, 0xa2, 0xa0, 0x02, 0xa0, 0x88, 0x82, - 0xa0, 0x88, 0x02, 0x80, 0x82, 0x28, 0x28, 0xa0, 0x20, 0x28, 0x08, 0x8a, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x45, 0x54, 0x00, - 0x14, 0x40, 0x41, 0x50, 0x05, 0x51, 0x10, 0x41, 0x41, 0x41, 0x01, 0x00, - 0x05, 0x14, 0x10, 0x50, 0x40, 0x10, 0x14, 0x54, 0x04, 0x00, 0x41, 0x55, - 0x04, 0x45, 0x01, 0x04, 0x20, 0x02, 0x08, 0x00, 0x2a, 0xa0, 0x00, 0xa0, - 0x8a, 0x20, 0xa8, 0xa2, 0xa0, 0xa0, 0x00, 0x80, 0x0a, 0x28, 0x28, 0xa0, - 0x20, 0x28, 0x0a, 0x2a, 0x00, 0x00, 0x22, 0x0a, 0x80, 0x88, 0x02, 0x88, - 0x04, 0x50, 0x01, 0x00, 0x54, 0x40, 0x01, 0x50, 0x15, 0x10, 0x14, 0x51, - 0x40, 0x41, 0x01, 0x00, 0x15, 0x14, 0x14, 0x40, 0x11, 0x14, 0x05, 0x14, - 0x00, 0x40, 0x10, 0x00, 0x15, 0x45, 0x04, 0x01, 0x00, 0x00, 0x08, 0x00, - 0xa8, 0xa0, 0x00, 0x28, 0x8a, 0x08, 0x0a, 0x28, 0xa0, 0xa0, 0x00, 0x00, - 0x2a, 0x0a, 0x28, 0xa0, 0x08, 0x8a, 0x02, 0x0a, 0x00, 0x80, 0x00, 0x08, - 0x80, 0x00, 0x00, 0x82, 0x44, 0x11, 0x00, 0x00, 0x50, 0x50, 0x00, 0x10, - 0x05, 0x40, 0x15, 0x05, 0x50, 0x50, 0x00, 0x00, 0x14, 0x14, 0x14, 0x40, - 0x11, 0x54, 0x00, 0x05, 0x00, 0x00, 0x11, 0x00, 0x01, 0x40, 0x04, 0x44, - 0x80, 0x20, 0x0a, 0x00, 0xa0, 0xa0, 0x00, 0x88, 0x82, 0xa8, 0x0a, 0x00, - 0xa0, 0xa0, 0x00, 0x00, 0x28, 0x0a, 0x0a, 0xa0, 0x08, 0x0a, 0x00, 0x0a, - 0x00, 0x00, 0x22, 0x0a, 0xa2, 0x00, 0x00, 0x88, 0x01, 0x40, 0x15, 0x00, - 0x50, 0x51, 0x40, 0x00, 0x01, 0x51, 0x15, 0x00, 0x50, 0x50, 0x00, 0x00, - 0x54, 0x14, 0x54, 0x40, 0x05, 0x14, 0x00, 0x05, 0x00, 0x40, 0x41, 0x15, - 0x14, 0x45, 0x04, 0x05, 0x00, 0x00, 0x00, 0x80, 0xa0, 0xa0, 0x20, 0x88, - 0x80, 0xaa, 0x08, 0x82, 0x28, 0x28, 0x02, 0x20, 0x28, 0x0a, 0x2a, 0xa0, - 0x02, 0x0a, 0x88, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x41, 0x40, 0x11, 0x44, 0x00, 0x55, 0x14, 0x44, - 0x50, 0x50, 0x01, 0x40, 0x10, 0x54, 0x15, 0x40, 0x01, 0x14, 0x04, 0x45, - 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x22, 0xa0, 0x0a, 0x00, 0x00, 0x0a, 0x2a, 0x20, 0x28, 0xa8, 0x00, 0xa0, - 0x08, 0xa8, 0x08, 0xa0, 0x00, 0xa8, 0x82, 0x82, 0x02, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x05, 0x00, - 0x00, 0x54, 0x55, 0x10, 0x50, 0x50, 0x00, 0x00, 0x05, 0x50, 0x04, 0x40, - 0x00, 0x50, 0x40, 0x05, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x80, 0xaa, 0x2a, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, - 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x00, 0x00, 0x55, 0x55, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x01, - 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xa8, 0xaa, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, - 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x50, 0x55, - 0x05, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x28, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, - 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x80, 0xaa, - 0x2a, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x50, 0x15, - 0x55, 0x11, 0x55, 0x00, 0x15, 0x00, 0x54, 0x01, 0x00, 0x54, 0x01, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x50, 0x00, 0x20, 0x82, 0x20, 0x08, 0x82, 0x00, 0x22, 0x80, - 0x08, 0x08, 0x28, 0xa2, 0x28, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa2, - 0x00, 0x04, 0x41, 0x10, 0x04, 0x11, 0x00, 0x40, 0x10, 0x14, 0x10, 0x54, - 0x54, 0x11, 0x10, 0x00, 0x01, 0x00, 0x50, 0x14, 0x15, 0x05, 0x45, 0x01, - 0x50, 0x50, 0x44, 0x14, 0x05, 0x00, 0x04, 0x40, 0x20, 0x02, 0x22, 0x02, - 0x22, 0x08, 0x20, 0x20, 0x00, 0x08, 0x20, 0xa8, 0x28, 0x22, 0x08, 0x80, - 0x02, 0x00, 0x88, 0x22, 0xa2, 0x88, 0x28, 0x02, 0x88, 0x80, 0x22, 0xa2, - 0x08, 0x00, 0x08, 0x22, 0x00, 0x04, 0x41, 0x00, 0x04, 0x00, 0x01, 0x40, - 0x00, 0x10, 0x40, 0x04, 0x11, 0x10, 0x04, 0x10, 0x05, 0x00, 0x10, 0x04, - 0x01, 0x55, 0x45, 0x04, 0x10, 0x50, 0x44, 0x15, 0x01, 0x00, 0x14, 0x10, - 0x00, 0x2a, 0xa0, 0x02, 0x2a, 0x20, 0x22, 0x80, 0x02, 0x22, 0x20, 0x02, - 0x0a, 0xa0, 0x02, 0x08, 0x0a, 0x00, 0x20, 0x02, 0x82, 0x80, 0x20, 0x02, - 0x80, 0x88, 0x28, 0x82, 0x00, 0x00, 0xa8, 0x20, 0x00, 0x44, 0x40, 0x01, - 0x14, 0x00, 0x04, 0x00, 0x05, 0x10, 0x40, 0x00, 0x11, 0x10, 0x05, 0x04, - 0x14, 0x00, 0x44, 0x44, 0x01, 0x51, 0x44, 0x04, 0x10, 0x45, 0x14, 0x11, - 0x01, 0x00, 0x50, 0x11, 0x00, 0x82, 0x20, 0x02, 0x22, 0x20, 0x28, 0x20, - 0x08, 0x2a, 0x80, 0x02, 0x02, 0x20, 0x08, 0x00, 0x00, 0x00, 0x28, 0x28, - 0x02, 0x8a, 0x22, 0x02, 0xa0, 0xa8, 0x08, 0x8a, 0x00, 0x00, 0x80, 0x22, - 0x00, 0x04, 0x41, 0x10, 0x04, 0x01, 0x10, 0x00, 0x10, 0x41, 0x40, 0x01, - 0x11, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x51, 0x20, 0x82, 0x20, 0x00, - 0x02, 0x20, 0x28, 0x20, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x28, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x22, 0x10, 0x04, 0x45, 0x10, 0x04, 0x01, 0x10, 0x40, - 0x04, 0x40, 0x00, 0x00, 0x41, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x41, - 0x8a, 0x0a, 0xaa, 0x8a, 0xaa, 0xa8, 0x20, 0xa0, 0x82, 0xa2, 0x80, 0x80, - 0xaa, 0xa8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x15, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, - 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xa0, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x10, 0x50, - 0x41, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x15, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa0, 0x80, 0x02, 0xa8, 0x28, - 0x0a, 0xa0, 0x02, 0xa8, 0x00, 0x8a, 0x02, 0x28, 0x00, 0x00, 0x00, 0x0a, - 0x28, 0x80, 0x2a, 0x80, 0x22, 0x80, 0x0a, 0x00, 0xa8, 0x00, 0x28, 0x2a, - 0x00, 0x05, 0x00, 0x50, 0x00, 0x00, 0x55, 0x51, 0x14, 0x14, 0x54, 0x54, - 0x01, 0x54, 0x01, 0x50, 0x50, 0x05, 0x00, 0x05, 0x00, 0x50, 0x55, 0x40, - 0x51, 0x50, 0x15, 0x00, 0x54, 0x05, 0x14, 0x55, 0x00, 0x0a, 0x00, 0xa0, - 0x00, 0x80, 0xaa, 0x2a, 0x2a, 0x08, 0x2a, 0xa8, 0x02, 0xaa, 0x02, 0xa0, - 0xa0, 0x02, 0x00, 0x0a, 0x00, 0xa8, 0xaa, 0x80, 0x2a, 0xa8, 0x2a, 0x80, - 0xaa, 0x0a, 0xa8, 0xaa, 0x01, 0x05, 0x00, 0x50, 0x05, 0x40, 0x55, 0x55, - 0x14, 0x00, 0x14, 0x50, 0x05, 0x54, 0x01, 0x40, 0x51, 0x01, 0x00, 0x55, - 0x00, 0x54, 0x55, 0x41, 0x15, 0x54, 0x55, 0x40, 0x55, 0x15, 0x54, 0x55, - 0x02, 0x0a, 0x00, 0xa0, 0x0a, 0xa0, 0x02, 0x2a, 0x2a, 0x00, 0x0a, 0x88, - 0x0a, 0x2a, 0x00, 0x80, 0xaa, 0x00, 0x00, 0xaa, 0x00, 0xaa, 0xa0, 0xa2, - 0x0a, 0x2a, 0xa8, 0xa0, 0x0a, 0x0a, 0xaa, 0xa0, 0x01, 0x14, 0x01, 0x40, - 0x55, 0x50, 0x01, 0x14, 0x14, 0x00, 0x05, 0x04, 0x15, 0x15, 0x00, 0x00, - 0x51, 0x00, 0x00, 0x54, 0x05, 0x14, 0x40, 0x45, 0x05, 0x15, 0x50, 0x41, - 0x01, 0x14, 0x54, 0x40, 0x02, 0xa8, 0x00, 0x80, 0xaa, 0xa8, 0x00, 0x2a, - 0x28, 0x88, 0x02, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, - 0x0a, 0x0a, 0xa0, 0xa2, 0x82, 0x0a, 0xa0, 0xa0, 0x00, 0x28, 0x2a, 0xa0, - 0x01, 0x50, 0x00, 0x00, 0x55, 0x50, 0x00, 0x14, 0x54, 0x54, 0x05, 0x15, - 0x14, 0x15, 0x00, 0x00, 0x11, 0x00, 0x00, 0x50, 0x05, 0x15, 0x00, 0x40, - 0x01, 0x05, 0x40, 0x51, 0x00, 0x14, 0x14, 0x40, 0x00, 0xa8, 0x00, 0x00, - 0xa8, 0x28, 0x00, 0x28, 0x28, 0xa8, 0x02, 0x80, 0x0a, 0x0a, 0x00, 0x80, - 0x08, 0x00, 0x00, 0x80, 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0xaa, 0xaa, 0xa8, - 0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x44, 0x01, 0x00, 0x50, 0x55, 0x00, 0x14, - 0x50, 0x14, 0x01, 0x00, 0x15, 0x05, 0x00, 0x40, 0x15, 0x00, 0x00, 0x00, - 0x15, 0x05, 0x00, 0x50, 0x41, 0x55, 0x55, 0x51, 0x55, 0x15, 0x15, 0x40, - 0x00, 0x80, 0x02, 0x00, 0xa0, 0x28, 0x00, 0x0a, 0x28, 0x0a, 0x02, 0x00, - 0x8a, 0x0a, 0x00, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x8a, 0x0a, 0x00, 0xa0, - 0x80, 0xaa, 0xaa, 0xa8, 0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x40, 0x01, 0x00, - 0x50, 0x55, 0x00, 0x14, 0x50, 0x05, 0x00, 0x00, 0x14, 0x05, 0x00, 0x50, - 0x50, 0x00, 0x00, 0x00, 0x15, 0x05, 0x00, 0x50, 0x40, 0x55, 0x55, 0x51, - 0x55, 0x15, 0x05, 0x50, 0x00, 0x80, 0x02, 0x2a, 0xa8, 0x28, 0x00, 0x0a, - 0xa8, 0x0a, 0x80, 0xaa, 0x82, 0x02, 0x00, 0x20, 0xa0, 0x00, 0xa0, 0x82, - 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0x02, 0x00, 0x28, 0x00, 0x00, 0x0a, 0xa0, - 0x00, 0x00, 0x05, 0x14, 0x50, 0x54, 0x00, 0x15, 0x50, 0x05, 0x40, 0x55, - 0x01, 0x05, 0x00, 0x10, 0x40, 0x01, 0x40, 0x01, 0x05, 0x15, 0x50, 0x51, - 0x40, 0x01, 0x00, 0x50, 0x00, 0x00, 0x05, 0x50, 0x00, 0x00, 0x0a, 0x2a, - 0xa8, 0xa8, 0x80, 0x0a, 0xa0, 0x02, 0x80, 0x0a, 0x80, 0x02, 0x00, 0x08, - 0x80, 0x02, 0xa0, 0x82, 0x0a, 0x2a, 0xa8, 0xa0, 0x80, 0x02, 0x2a, 0xa8, - 0x80, 0x8a, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x54, 0x55, 0x50, 0x55, 0x05, - 0x50, 0x01, 0x00, 0x00, 0x44, 0x05, 0x00, 0x04, 0x00, 0x05, 0x40, 0x55, - 0x05, 0x54, 0x55, 0x50, 0x00, 0x55, 0x15, 0x50, 0x55, 0x05, 0x05, 0x50, - 0x00, 0x00, 0x00, 0xa8, 0x2a, 0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x08, 0x00, - 0x8a, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x80, 0xaa, 0x02, 0xaa, 0x2a, 0x28, - 0x80, 0xaa, 0x0a, 0xa0, 0xaa, 0x82, 0x02, 0x28, 0x00, 0x00, 0x00, 0x50, - 0x15, 0x40, 0x55, 0x05, 0x40, 0x01, 0x10, 0x00, 0x55, 0x01, 0x00, 0x05, - 0x00, 0x00, 0x00, 0x55, 0x01, 0x54, 0x15, 0x50, 0x00, 0x55, 0x05, 0x40, - 0x55, 0x01, 0x05, 0x50, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x80, 0x0a, 0x0a, - 0xa0, 0x00, 0x00, 0xa0, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x2a, - 0x00, 0xa0, 0x0a, 0x28, 0x00, 0xa8, 0x00, 0x80, 0x2a, 0x80, 0x02, 0x28, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, - 0x55, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0xa0, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, - 0xaa, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x50, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x55, 0x05, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x0a, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x45, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x22, 0xa0, 0x22, 0xa8, 0x0a, 0xa8, 0x00, - 0xa8, 0xa0, 0x28, 0x80, 0xaa, 0x22, 0x28, 0xa0, 0x02, 0x2a, 0x2a, 0xa0, - 0x02, 0x8a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x15, 0x50, 0x15, 0x54, 0x15, 0x54, 0x01, 0x55, 0x41, 0x55, 0x00, - 0x55, 0x11, 0x54, 0x50, 0x05, 0x54, 0x54, 0x54, 0x05, 0x54, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x08, 0x08, - 0x20, 0x08, 0x02, 0x82, 0x82, 0x82, 0x82, 0x00, 0xaa, 0x08, 0x20, 0x20, - 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x50, 0x10, 0x04, 0x10, 0x10, 0x00, 0x01, 0x04, - 0x01, 0x01, 0x01, 0x01, 0x54, 0x14, 0x11, 0x00, 0x10, 0x10, 0x04, 0x04, - 0x04, 0x10, 0x00, 0x14, 0x51, 0x10, 0x44, 0x01, 0x50, 0x44, 0x44, 0x14, - 0xa0, 0x00, 0x02, 0x08, 0x08, 0x80, 0x00, 0x82, 0x00, 0x82, 0x80, 0x00, - 0xa8, 0x28, 0x00, 0xa0, 0x0a, 0x20, 0x08, 0x02, 0x08, 0x08, 0x00, 0x00, - 0x20, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x05, 0x04, 0x00, - 0x10, 0x00, 0x55, 0x45, 0x55, 0x41, 0x40, 0x00, 0x54, 0x54, 0x00, 0x50, - 0x05, 0x10, 0x04, 0x55, 0x05, 0x04, 0x00, 0x44, 0x10, 0x14, 0x45, 0x04, - 0x10, 0x54, 0x54, 0x04, 0x00, 0x0a, 0x02, 0x00, 0x08, 0x80, 0xaa, 0x82, - 0xaa, 0x82, 0x80, 0x00, 0x2a, 0xaa, 0x00, 0x08, 0x08, 0x20, 0x02, 0xaa, - 0x0a, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, - 0x10, 0x14, 0x04, 0x00, 0x04, 0x00, 0x01, 0x40, 0x00, 0x40, 0x40, 0x00, - 0x15, 0x45, 0x15, 0x04, 0x04, 0x10, 0x01, 0x01, 0x00, 0x04, 0x00, 0x05, - 0x15, 0x10, 0x44, 0x04, 0x14, 0x14, 0x41, 0x04, 0x08, 0x08, 0x0a, 0x08, - 0x08, 0x80, 0x02, 0x82, 0x80, 0x20, 0x20, 0x80, 0x8a, 0x8a, 0x22, 0x02, - 0x02, 0xa0, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x54, 0x05, 0x54, 0x15, 0x55, 0x01, 0x55, 0x01, - 0x55, 0x51, 0x51, 0x01, 0x45, 0x05, 0x00, 0x54, 0x15, 0x40, 0x00, 0x54, - 0x45, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa8, 0x02, 0xa8, 0x82, 0xaa, 0x00, 0xaa, 0x00, 0x2a, 0xa8, 0xa8, 0x80, - 0x82, 0x22, 0x20, 0xa8, 0x0a, 0x20, 0x00, 0xa8, 0x80, 0xaa, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x55, 0x55, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xa0, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x15, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0xa8, 0xaa, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x2a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x54, 0x00, 0x54, 0x55, 0x01, 0x00, 0x40, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, - 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x50, 0x55, 0x05, - 0x00, 0x00, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x0a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x0a, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, - 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x14, 0x04, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x80, 0xaa, 0x2a, - 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa8, 0x02, 0x08, 0x00, 0x10, 0x50, 0x50, 0x50, 0x40, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x50, 0x00, - 0x50, 0x00, 0x05, 0x04, 0x01, 0x05, 0x50, 0x40, 0x54, 0x05, 0x04, 0x05, - 0x8a, 0x20, 0x20, 0x88, 0xa0, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, - 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x20, 0x00, 0x82, 0x82, 0x08, 0x8a, - 0x82, 0x08, 0x88, 0xa0, 0xa8, 0x0a, 0x22, 0x28, 0x00, 0x41, 0x00, 0x04, - 0x41, 0x44, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x55, 0x55, - 0x00, 0x00, 0x10, 0x00, 0x01, 0x41, 0x10, 0x44, 0x44, 0x10, 0x04, 0x41, - 0x50, 0x15, 0x11, 0x10, 0x80, 0x80, 0x00, 0x02, 0x82, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x80, 0x00, - 0x02, 0x22, 0x20, 0x08, 0x20, 0x20, 0x02, 0x22, 0xa0, 0x2a, 0x22, 0x20, - 0x00, 0x41, 0x10, 0x01, 0x44, 0x00, 0x00, 0x40, 0x41, 0x51, 0x04, 0x14, - 0x15, 0x00, 0x11, 0x44, 0x50, 0x54, 0x40, 0x01, 0x05, 0x10, 0x00, 0x04, - 0x10, 0x40, 0x01, 0x44, 0x10, 0x15, 0x51, 0x00, 0xa8, 0x80, 0x00, 0xaa, - 0x82, 0x00, 0x00, 0x20, 0x22, 0x8a, 0xa2, 0x22, 0x22, 0x80, 0xa0, 0x88, - 0x88, 0x88, 0x88, 0x02, 0x2a, 0x20, 0x00, 0x08, 0xa0, 0x2a, 0xaa, 0x22, - 0x20, 0x8a, 0xa0, 0x02, 0x04, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x40, - 0x10, 0x10, 0x41, 0x54, 0x11, 0x00, 0x11, 0x40, 0x54, 0x05, 0x04, 0x05, - 0x50, 0x11, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40, 0x10, 0x45, 0x00, 0x15, - 0x82, 0x80, 0x08, 0x02, 0x80, 0x00, 0x00, 0x00, 0x22, 0x88, 0x02, 0x02, - 0x22, 0x00, 0x82, 0x08, 0x02, 0x08, 0x02, 0x0a, 0x80, 0x22, 0x00, 0x08, - 0x20, 0x00, 0x02, 0x20, 0x20, 0xa2, 0x00, 0x28, 0x01, 0x01, 0x05, 0x01, - 0x40, 0x00, 0x00, 0x40, 0x14, 0x51, 0x41, 0x44, 0x11, 0x40, 0x04, 0x11, - 0x04, 0x05, 0x01, 0x14, 0x00, 0x15, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40, - 0x10, 0x51, 0x01, 0x50, 0x82, 0x00, 0x02, 0x02, 0x80, 0x00, 0x00, 0x80, - 0xa2, 0x88, 0x2a, 0x28, 0x22, 0x80, 0x02, 0x28, 0x8a, 0x88, 0x00, 0x28, - 0x00, 0x22, 0x00, 0x08, 0x20, 0x00, 0x02, 0x20, 0xa0, 0xa8, 0x02, 0x20, - 0x01, 0x05, 0x05, 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, - 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x01, 0x44, 0x00, 0x04, - 0x40, 0x40, 0x04, 0x44, 0x10, 0x51, 0x15, 0x40, 0x82, 0x00, 0x02, 0x08, - 0x82, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, - 0x2a, 0x00, 0x00, 0x00, 0x02, 0x82, 0x08, 0x08, 0x80, 0x20, 0x08, 0x22, - 0xa0, 0xa0, 0x2a, 0x20, 0x14, 0x01, 0x00, 0x50, 0x50, 0x01, 0x00, 0x00, - 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, - 0x51, 0x00, 0x05, 0x15, 0x00, 0x05, 0x50, 0x50, 0x50, 0x40, 0x15, 0x05, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x2a, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x54, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0xa0, 0x0a, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x50, 0x55, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, - 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, - 0x15, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x10, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x2a, 0x00, 0x00, 0x00, - 0x00, 0xa0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xaa, 0x15, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, - 0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, - 0xa2, 0x00, 0x80, 0x02, 0x0a, 0xa2, 0x82, 0x02, 0x0a, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0a, 0xa8, 0xa0, 0x80, 0x82, 0xa0, 0x11, 0x01, 0x00, 0x04, - 0x11, 0x50, 0x41, 0x04, 0x11, 0x10, 0x00, 0x14, 0x44, 0x40, 0x00, 0x41, - 0x11, 0x00, 0x14, 0x00, 0x44, 0x05, 0x05, 0x04, 0x45, 0x00, 0x10, 0x44, - 0x11, 0x11, 0x04, 0x44, 0xa2, 0x02, 0x20, 0x80, 0x20, 0x28, 0x20, 0x08, - 0x02, 0x20, 0x80, 0x22, 0xa8, 0xa8, 0xa0, 0x82, 0x28, 0x00, 0x28, 0x80, - 0x22, 0x08, 0x82, 0x0a, 0x22, 0x80, 0x00, 0x82, 0x20, 0x00, 0x88, 0x8a, - 0x51, 0x05, 0x50, 0x00, 0x10, 0x11, 0x11, 0x10, 0x01, 0x50, 0x40, 0x10, - 0x54, 0x04, 0x11, 0x04, 0x41, 0x00, 0x50, 0x40, 0x10, 0x04, 0x44, 0x10, - 0x44, 0x40, 0x01, 0x01, 0x10, 0x10, 0x44, 0x14, 0xa2, 0x00, 0xa0, 0x00, - 0xa8, 0x02, 0xa0, 0x0a, 0x02, 0xa0, 0xa0, 0x00, 0x0a, 0x82, 0x08, 0x82, - 0x20, 0x00, 0xa0, 0x20, 0x20, 0x08, 0x22, 0x08, 0x02, 0x80, 0x02, 0x02, - 0x20, 0xa8, 0x8a, 0x82, 0x51, 0x01, 0x40, 0x01, 0x55, 0x01, 0x10, 0x00, - 0x01, 0x40, 0x41, 0x00, 0x04, 0x54, 0x50, 0x41, 0x40, 0x00, 0x40, 0x10, - 0x10, 0x04, 0x41, 0x05, 0x01, 0x00, 0x05, 0x01, 0x10, 0x10, 0x40, 0x50, - 0xa2, 0x08, 0x80, 0x82, 0xa0, 0x8a, 0x20, 0x00, 0x02, 0x80, 0x22, 0x00, - 0x02, 0x0a, 0x28, 0x80, 0x20, 0x00, 0x80, 0x20, 0x08, 0x88, 0xa0, 0x00, - 0x02, 0x00, 0x0a, 0x02, 0x20, 0x08, 0x80, 0xa0, 0x51, 0x01, 0x00, 0x44, - 0x50, 0x11, 0x10, 0x00, 0x01, 0x00, 0x11, 0x00, 0x01, 0x01, 0x04, 0x40, - 0x10, 0x00, 0x40, 0x11, 0x10, 0x10, 0x11, 0x00, 0x01, 0x00, 0x10, 0x01, - 0x10, 0x10, 0x40, 0x50, 0xa2, 0x08, 0x00, 0x88, 0x80, 0x08, 0x20, 0x00, - 0x02, 0x02, 0x22, 0x00, 0x02, 0x02, 0x08, 0x20, 0x20, 0x00, 0x80, 0x08, - 0x08, 0x88, 0x20, 0x80, 0x00, 0x00, 0x20, 0x02, 0x20, 0x28, 0x80, 0xa0, - 0x51, 0x11, 0x10, 0x44, 0x40, 0x50, 0x40, 0x10, 0x01, 0x00, 0x11, 0x00, - 0x01, 0x01, 0x04, 0x40, 0x10, 0x00, 0x01, 0x11, 0x04, 0x50, 0x10, 0x00, - 0x01, 0x40, 0x10, 0x04, 0x11, 0x50, 0x00, 0x01, 0xa2, 0x28, 0x20, 0x82, - 0x0a, 0x20, 0xa0, 0x0a, 0x02, 0x02, 0x22, 0x88, 0x00, 0x82, 0x08, 0x22, - 0x08, 0x80, 0x80, 0x28, 0x08, 0x28, 0x20, 0x88, 0x00, 0x80, 0x08, 0xaa, - 0x20, 0xa0, 0x82, 0xaa, 0x41, 0x50, 0x50, 0x01, 0x55, 0x00, 0x00, 0x05, - 0x05, 0x05, 0x51, 0x04, 0x01, 0x45, 0x14, 0x11, 0x50, 0x00, 0x41, 0x50, - 0x04, 0x10, 0x50, 0x44, 0x00, 0x40, 0x05, 0x50, 0x50, 0x40, 0x01, 0x14, - 0xaa, 0xaa, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0x82, - 0x00, 0x2a, 0xa8, 0x20, 0x28, 0x80, 0x2a, 0x20, 0x08, 0x08, 0xa0, 0x82, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x55, 0x01, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x40, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x50, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x28, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x55, 0x55, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x2a, 0x2a, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x15, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x45, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0xa2, 0x22, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x88, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x0a, 0x08, - 0x02, 0x22, 0xa0, 0x80, 0x08, 0x00, 0xa0, 0x00, 0x20, 0xa0, 0xa0, 0xa0, - 0x41, 0x01, 0x51, 0x45, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, - 0x00, 0x00, 0x55, 0x55, 0x14, 0x00, 0x11, 0x14, 0x05, 0x45, 0x10, 0x41, - 0x11, 0x00, 0x40, 0x01, 0x14, 0x41, 0x40, 0x10, 0x82, 0x28, 0xa2, 0xaa, - 0x80, 0xa2, 0xa2, 0xa0, 0xa8, 0x00, 0x28, 0x28, 0x08, 0xa2, 0x02, 0xaa, - 0xa8, 0x80, 0x20, 0x88, 0x88, 0x0a, 0x08, 0x82, 0x20, 0x00, 0x80, 0x0a, - 0x00, 0x82, 0x00, 0x08, 0x04, 0x51, 0x51, 0x55, 0x45, 0x44, 0x11, 0x11, - 0x11, 0x01, 0x50, 0x44, 0x04, 0x11, 0x05, 0x55, 0x41, 0x41, 0x40, 0x10, - 0x40, 0x55, 0x04, 0x44, 0x40, 0x00, 0x00, 0x14, 0x00, 0x01, 0x01, 0x04, - 0x88, 0xa8, 0xa8, 0x2a, 0x2a, 0x20, 0x08, 0x0a, 0x0a, 0x02, 0xa0, 0x80, - 0x88, 0x08, 0xa2, 0xaa, 0x02, 0x22, 0x00, 0x08, 0xa0, 0x8a, 0x02, 0x88, - 0x20, 0x00, 0x00, 0x20, 0x00, 0x82, 0x20, 0x02, 0x05, 0x55, 0x54, 0x55, - 0x44, 0x40, 0x50, 0x51, 0x11, 0x01, 0x04, 0x51, 0x10, 0x51, 0x41, 0x55, - 0x05, 0x44, 0x00, 0x10, 0x00, 0x50, 0x54, 0x45, 0x40, 0x00, 0x00, 0x40, - 0x50, 0x01, 0x01, 0x54, 0x80, 0x2a, 0xaa, 0x0a, 0x28, 0x28, 0x08, 0x08, - 0x08, 0x02, 0x88, 0x88, 0x80, 0x08, 0xa8, 0xaa, 0x0a, 0x28, 0x00, 0x08, - 0xa0, 0x02, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80, 0x08, 0x02, 0x02, 0x02, - 0x00, 0x15, 0x55, 0x15, 0x44, 0x44, 0x10, 0x11, 0x11, 0x01, 0x04, 0x45, - 0x50, 0x10, 0x51, 0x55, 0x15, 0x44, 0x00, 0x10, 0x00, 0x01, 0x04, 0x40, - 0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x11, 0x04, 0x80, 0x0a, 0xaa, 0x2a, - 0x82, 0x22, 0xa0, 0xa0, 0x08, 0x02, 0xa8, 0xa8, 0x20, 0xa0, 0xa8, 0xaa, - 0x0a, 0x28, 0x00, 0x08, 0x80, 0x00, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80, - 0x02, 0x02, 0x0a, 0x02, 0x00, 0x04, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x44, 0x00, 0x10, - 0x10, 0x00, 0x04, 0x40, 0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x04, 0x04, - 0x08, 0x02, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xaa, 0x28, 0x82, 0x00, 0x08, 0xa8, 0x80, 0x08, 0x88, - 0x20, 0x00, 0x20, 0x20, 0x02, 0x0a, 0x0a, 0x08, 0x44, 0x00, 0x50, 0x55, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, - 0x51, 0x01, 0x11, 0x10, 0x54, 0x41, 0x10, 0x44, 0x40, 0x00, 0x40, 0x10, - 0x04, 0x01, 0x04, 0x10, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, - 0x00, 0xa0, 0x00, 0x08, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x00, 0x0a, 0x2a, - 0x2a, 0x0a, 0xa0, 0xa0, 0xa0, 0x00, 0x20, 0x0a, 0x28, 0x02, 0x00, 0xa0, - 0x50, 0x01, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/programs/Xserver/include/dixfont.h b/nx-X11/programs/Xserver/include/dixfont.h index 9ae55157e..510f55268 100644 --- a/nx-X11/programs/Xserver/include/dixfont.h +++ b/nx-X11/programs/Xserver/include/dixfont.h @@ -40,7 +40,7 @@ SOFTWARE. typedef struct _DIXFontProp *DIXFontPropPtr; #ifdef HAS_XFONT2 -xfont2_fpe_funcs_rec const **fpe_functions; +extern xfont2_fpe_funcs_rec const **fpe_functions; #else extern FPEFunctions *fpe_functions; #endif /* HAS_XFONT2 */ diff --git a/nx-X11/programs/Xserver/include/rgb.h b/nx-X11/programs/Xserver/include/rgb.h deleted file mode 100644 index 3e768b615..000000000 --- a/nx-X11/programs/Xserver/include/rgb.h +++ /dev/null @@ -1,53 +0,0 @@ -/*********************************************************** - -Copyright 1987, 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. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef RGB_H -#define RGB_H -typedef struct _RGB { - unsigned short red, green, blue; - } RGB; -#endif /* RGB_H */ diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index da39c57ba..1b1c2d4fe 100644 --- a/nx-X11/programs/Xserver/os/Imakefile +++ b/nx-X11/programs/Xserver/os/Imakefile @@ -42,7 +42,7 @@ NX_DEFINES = -DNX_TRANS_SOCKET \ -DNX_TRANS_FOPEN \ -DNX_TRANS_SLEEP \ -DNX_TRANS_EXIT \ - -DNX_TRANS_WAKEUP=1000 \ + -DNX_TRANS_WAKEUP \ -DNXAGENT_SERVER \ $(NULL) diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c index 3d53335b3..9e887c726 100644 --- a/nx-X11/programs/Xserver/os/WaitFor.c +++ b/nx-X11/programs/Xserver/os/WaitFor.c @@ -96,16 +96,29 @@ SOFTWARE. #include "dpmsproc.h" #endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) +/* + * unset defines without NX_TRANS_SOCKET. This allows for shorter + * ifdefs below + */ +#ifndef NX_TRANS_SOCKET +#ifdef NX_TRANS_DEBUG +#undef NX_TRANS_DEBUG +#endif +#ifdef NX_TRANS_WAKEUP +#undef NX_TRANS_WAKEUP +#endif +#endif +#ifdef NX_TRANS_WAKEUP static unsigned long startTimeInMillis; - #endif /* This is just a fallback to errno to hide the differences between unix and Windows in the code */ #define GetErrno() errno +/* like ffs, but uses fd_mask instead of int as argument, so it works + when fd_mask is longer than an int, such as common 64-bit platforms */ /* modifications by raphael */ int mffs(fd_mask mask) @@ -169,17 +182,15 @@ WaitForSomething(int *pClientsReady) Bool someReady = FALSE; Bool someNotifyWriteReady = FALSE; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Got called.\n"); -#endif + #endif FD_ZERO(&clientsReadable); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) - + #ifdef NX_TRANS_WAKEUP startTimeInMillis = GetTimeInMillis(); - -#endif + #endif /* We need a while loop here to handle crashed connections and the screen saver timeout */ @@ -222,44 +233,46 @@ WaitForSomething(int *pClientsReady) if (NewOutputPending) FlushAllOutput(); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) +#ifdef NX_TRANS_WAKEUP /* * If caller has marked the first element of pClientsReady[], - * bail out of select after a short timeout. We need this to - * let the NX agent remove the splash screen when the timeout - * is expired. A better option would be to use the existing - * screen-saver timeout but it can be modified by clients, so - * we would need a special handling. This hack is trivial and - * keeps WaitForSomething() backward compatible with the exis- - * ting servers. + * bail out of select after the timeout given in the second + * element. We need this to let the NX agent remove the splash + * screen when the timeout is expired even if there's no + * client. Otherwise WaitForSomething would block. A better + * option would be to use the existing screen-saver timeout + * but it can be modified by clients, so we would need a + * special handling. This hack is trivial and keeps + * WaitForSomething() backward compatible with the existing + * servers. */ if (pClientsReady[0] == -1) { unsigned long timeoutInMillis; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: pClientsReady[0] is [%d], pClientsReady[1] is [%d].\n", - pClientsReady[0], pClientsReady[1]); -#endif + pClientsReady[0], pClientsReady[1]); + #endif timeoutInMillis = GetTimeInMillis(); - if (timeoutInMillis - startTimeInMillis >= NX_TRANS_WAKEUP) + if (timeoutInMillis - startTimeInMillis >= pClientsReady[1]) { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n"); -#endif - return 0; + #endif + return 0; } - timeoutInMillis = NX_TRANS_WAKEUP - (timeoutInMillis - startTimeInMillis); + timeoutInMillis = pClientsReady[1] - (timeoutInMillis - startTimeInMillis); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n", timeoutInMillis); -#endif + #endif if (wt == NULL || (wt -> tv_sec * MILLI_PER_SECOND + wt -> tv_usec / MILLI_PER_SECOND) > timeoutInMillis) { @@ -272,38 +285,33 @@ WaitForSomething(int *pClientsReady) wt = &waittime; } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Next wakeup timeout set to %ld milliseconds.\n", (waittime.tv_sec * MILLI_PER_SECOND) + (waittime.tv_usec / MILLI_PER_SECOND)); -#endif + #endif } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG else { fprintf(stderr, "WaitForSomething: Using existing timeout of %ld milliseconds.\n", (waittime.tv_sec * MILLI_PER_SECOND) + (waittime.tv_usec / MILLI_PER_SECOND)); } -#endif + #endif } -#endif +#endif /* defined(NX_TRANS_WAKEUP) */ /* keep this check close to select() call to minimize race */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG if (dispatchException) - { - i = -1; - fprintf(stderr, "WaitForSomething: Value of dispatchException is true. Set i = -1.\n"); - } -#else + #endif if (dispatchException) i = -1; -#endif else if (AnyWritesPending) { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG if (wt == NULL) { fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and " @@ -315,14 +323,14 @@ WaitForSomething(int *pClientsReady) "clientsWritable, %ld secs and %ld usecs.\n", wt -> tv_sec, wt -> tv_usec); } -#endif + #endif XFD_COPYSET(&ClientsWriteBlocked, &LastSelectWriteMask); XFD_ORSET(&LastSelectWriteMask, &NotifyWriteFds, &LastSelectWriteMask); i = Select(MaxClients, &LastSelectMask, &LastSelectWriteMask, NULL, wt); } else { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG if (wt == NULL) { fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and null timeout.\n"); @@ -332,17 +340,16 @@ WaitForSomething(int *pClientsReady) fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask, %ld secs and %ld usecs.\n", wt -> tv_sec, wt -> tv_usec); } -#endif + #endif i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt); } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Bailed out with i = [%d] and errno = [%d].\n", i, errno); - if (i < 0) { fprintf(stderr, "WaitForSomething: Error is [%s].\n", strerror(errno)); } -#endif + #endif selecterr = GetErrno(); WakeupHandler(i, (void *)&LastSelectMask); @@ -350,31 +357,29 @@ WaitForSomething(int *pClientsReady) if (i <= 0) /* An error or timeout occurred */ { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG if (dispatchException) { fprintf(stderr, "WaitForSomething: Returning 0 because of (dispatchException).\n"); - return 0; } -#else + #endif if (dispatchException) return 0; -#endif + if (i < 0) { if (selecterr == EBADF) /* Some client disconnected */ { CheckConnections (); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + + #ifdef NX_TRANS_DEBUG if (! XFD_ANYSET (&AllClients)) { fprintf(stderr, "WaitForSomething: Returning 0 because of (! XFD_ANYSET (&AllClients)).\n"); - return 0; } -#else + #endif if (! XFD_ANYSET (&AllClients)) return 0; -#endif } else if (selecterr == EINVAL) { @@ -396,18 +401,14 @@ WaitForSomething(int *pClientsReady) XFD_COPYSET(&ClientsWithInput, &clientsReadable); break; } -#if defined(NX_TRANS_SOCKET) + #ifdef NX_TRANS_DEBUG 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 + #endif if (*checkForInput[0] != *checkForInput[1]) return 0; -#endif if (timers) { @@ -480,7 +481,7 @@ WaitForSomething(int *pClientsReady) { int client_index; - curclient = ffs (clientsReadable.fds_bits[i]) - 1; + curclient = mffs (clientsReadable.fds_bits[i]) - 1; client_index = /* raphael: modified */ ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))]; pClientsReady[nready++] = client_index; @@ -488,9 +489,9 @@ WaitForSomething(int *pClientsReady) } } } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Returning nready.\n"); -#endif + #endif return nready; } diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 7deeec428..4d30dd86f 100644 --- a/nx-X11/programs/Xserver/os/connection.c +++ b/nx-X11/programs/Xserver/os/connection.c @@ -185,8 +185,6 @@ InitConnectionLimits(void) { lastfdesc = -1; -#ifndef __CYGWIN__ - #if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX) lastfdesc = sysconf(_SC_OPEN_MAX) - 1; #endif @@ -201,8 +199,6 @@ InitConnectionLimits(void) lastfdesc = _NFILE - 1; #endif -#endif /* __CYGWIN__ */ - /* This is the fallback */ if (lastfdesc < 0) lastfdesc = MAXSOCKS; @@ -912,7 +908,7 @@ CheckConnections(void) mask = AllClients.fds_bits[i]; while (mask) { - curoff = ffs (mask) - 1; + curoff = mffs (mask) - 1; curclient = curoff + (i * (sizeof(fd_mask)*8)); FD_ZERO(&tmask); FD_SET(curclient, &tmask); diff --git a/nx-X11/programs/Xserver/os/osdep.h b/nx-X11/programs/Xserver/os/osdep.h index 5985cfef2..e106c5544 100644 --- a/nx-X11/programs/Xserver/os/osdep.h +++ b/nx-X11/programs/Xserver/os/osdep.h @@ -218,7 +218,7 @@ extern OsCommPtr AvailableInput; extern WorkQueuePtr workQueue; -/* added by raphael */ +/* in WaitFor.c */ #define ffs mffs extern int mffs(fd_mask); diff --git a/nx-X11/programs/Xserver/os/osinit.c b/nx-X11/programs/Xserver/os/osinit.c index 823656316..367635f6c 100644 --- a/nx-X11/programs/Xserver/os/osinit.c +++ b/nx-X11/programs/Xserver/os/osinit.c @@ -101,11 +101,8 @@ OsInit(void) InitNotifyFds(); -#if !defined(__CYGWIN__) fclose(stdin); fclose(stdout); -#endif - /* * If a write of zero bytes to stderr returns non-zero, i.e. -1, @@ -131,7 +128,7 @@ OsInit(void) dup2 (fileno (err), 2); fclose (err); } -#if defined(SYSV) || defined(SVR4) || defined(__CYGWIN__) +#if defined(SYSV) || defined(SVR4) { static char buf[BUFSIZ]; setvbuf (stderr, buf, _IOLBF, BUFSIZ); diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index eed8cbf13..853a33736 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -78,11 +78,6 @@ OR PERFORMANCE OF THIS SOFTWARE. #include <dix-config.h> #endif -#ifdef __CYGWIN__ -#include <stdlib.h> -#include <signal.h> -#endif - #include <nx-X11/Xos.h> #include <stdio.h> #include "misc.h" @@ -903,11 +898,9 @@ ProcessCommandLine(int argc, char *argv[]) #ifdef SERVER_LOCK else if ( strcmp ( argv[i], "-nolock") == 0) { -#if !defined(__CYGWIN__) if (getuid() != 0) ErrorF("Warning: the -nolock option can only be used by root\n"); else -#endif nolock = TRUE; } #endif diff --git a/nx-X11/programs/Xserver/xkb/xkbUtils.c b/nx-X11/programs/Xserver/xkb/xkbUtils.c index 941bb4038..4f49c44cb 100644 --- a/nx-X11/programs/Xserver/xkb/xkbUtils.c +++ b/nx-X11/programs/Xserver/xkb/xkbUtils.c @@ -676,7 +676,11 @@ unsigned act; } else { #ifdef NXAGENT_SERVER - /* we have seen division by zero here */ + /* + * we have seen division by zero here - see + * https://github.com/ArcticaProject/nx-libs/issues/808 for + * details and xorg upstream bug report + */ if (ctrls->num_groups != 0) #endif group%= ctrls->num_groups; |