From bd9ada59b47fb777ad1524abdc23b1a151494fff Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 07:51:22 +0100 Subject: os: remove CYGWIN remnants --- nx-X11/programs/Xserver/os/connection.c | 4 ---- nx-X11/programs/Xserver/os/osinit.c | 5 +---- nx-X11/programs/Xserver/os/utils.c | 7 ------- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 7deeec428..8ebef9c33 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; 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 #endif -#ifdef __CYGWIN__ -#include -#include -#endif - #include #include #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 -- cgit v1.2.3 From 0c45fe046ab5ead773e38b1f93c8e5caf9e3ff11 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 07:53:28 +0100 Subject: Events.c: Whitespace fix --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index b19dda3ac..e02f25288 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2633,7 +2633,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 -- cgit v1.2.3 From 0d3546fbfe0c4fe35108193916ea3cc6c885314f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Jan 2020 00:37:39 +0100 Subject: Events.c: simplify nxagentInternalWindowsTree --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index e02f25288..e0acf354f 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); } } -- cgit v1.2.3 From 27e8913a57cc89f5a98f07875ce865f550f07ac5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 07:54:22 +0100 Subject: Screen.c: spelling fix --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 3745c0aec..8bbc68e13 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3333,7 +3333,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]; -- cgit v1.2.3 From 85d0717b0b149bd91686e176164dd8af824fdaab Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 21:29:07 +0100 Subject: Atoms.c: remove one obsolete FIXME The FIXME just described what the following function actually implements... --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index af6260d15..67e4d0c0a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -436,11 +436,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"); -- cgit v1.2.3 From 2594ca998798ac867b903083eb697c59f37e693c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 20:01:31 +0100 Subject: Atoms.c: add missing free not a real memleak since it is followed by a FatalError... --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 67e4d0c0a..c7b3882fc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -469,6 +469,8 @@ 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"); } -- cgit v1.2.3 From 8a5c1d3d89e14959ad9aa74d24e3544b50ef37e5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 20:52:37 +0100 Subject: Atoms.c: some code cleanup add else clauses, improve debugging, add comments --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 126 ++++++++++++++++------------- 1 file changed, 71 insertions(+), 55 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index c7b3882fc..b2d7cdc6f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -610,17 +610,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); @@ -635,6 +632,8 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) return local; } + AtomMap *current; + if ((current = nxagentFindAtomByLocalValue(local))) { /* @@ -643,8 +642,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. @@ -656,26 +654,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, True); - nxagentWriteAtom(local, remote, string, True); - - return remote; + return remote; + } } } @@ -693,6 +694,7 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) return None; } + /* no mapping required for built-in atoms */ if (local <= XA_LAST_PREDEFINED) { #ifdef DEBUG @@ -705,32 +707,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, True); - #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) @@ -743,6 +752,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) return None; } + /* no mapping required for built-in atoms */ if (remote <= XA_LAST_PREDEFINED) { #ifdef DEBUG @@ -774,41 +784,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, True); + + #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 -- cgit v1.2.3 From bed0d6ce2e3fac3bb85a8dae91ab6ef72e501e28 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 20:53:20 +0100 Subject: Atoms.c: always duplicate strings before storing them in privAtomMap Otherwise we will never be able to free the list because we do not know if free() is allowed or not. --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 37 +++++++++--------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index b2d7cdc6f..761ab1b4f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -374,7 +374,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 +396,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; + const char *s = strdup(string); - /* - * 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. - */ - - 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) { @@ -515,7 +500,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 { @@ -673,7 +658,7 @@ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) } else { - nxagentWriteAtom(local, remote, string, True); + nxagentWriteAtom(local, remote, string); return remote; } @@ -732,7 +717,7 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) return None; } - nxagentWriteAtom(local, remote, string, True); + nxagentWriteAtom(local, remote, string); #ifdef TEST fprintf(stderr, "%s: local [%d (%s)] -> remote [%d]\n", __func__, local, string, remote); @@ -809,7 +794,7 @@ Atom nxagentRemoteToLocalAtom(XlibAtom remote) local = None; } - nxagentWriteAtom(local, remote, string, True); + nxagentWriteAtom(local, remote, string); #ifdef TEST fprintf(stderr, "%s: remote [%d (%s)] -> local [%d]\n", __func__, remote, string, local); -- cgit v1.2.3 From 6136c49a0c0fc2ac0234d6deddea74be21b07668 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 20:55:33 +0100 Subject: Atoms.h: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index d04874f25..8dff0d5a7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h @@ -37,16 +37,14 @@ 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); @@ -71,8 +69,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); -- cgit v1.2.3 From e7cf23ba747292192e5ee448d076784957ead4b0 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 20:59:45 +0100 Subject: Atoms.c: remove unused return value of nxagentInitAtomsMap --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 761ab1b4f..7adcc1284 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); @@ -442,7 +442,7 @@ void nxagentResetAtomMap(void) * 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; @@ -487,7 +487,7 @@ 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++) @@ -530,7 +530,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) nxagentPrintAtomMapInfo("nxagentInitAtomMap: Exiting"); - return 1; + return; } /* -- cgit v1.2.3 From c49e41a4dea7ac8560d376f706c535fa10917903 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 21:00:27 +0100 Subject: Atoms.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 7adcc1284..78137a920 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -444,7 +444,6 @@ void nxagentResetAtomMap(void) static void nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) { - unsigned int i; int list_size = count + privLastAtom; nxagentPrintAtomMapInfo("nxagentInitAtomMap: Entering"); @@ -459,13 +458,13 @@ static void nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) 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; @@ -490,7 +489,7 @@ static void nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) 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])); -- cgit v1.2.3 From 18439f55a04501b93fe8617850b5c1510b0d4885 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 29 Jan 2020 23:29:27 +0100 Subject: Atoms.c: refine comment on NX_CUT_BUFFER_SERVER --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 78137a920..eecead6e1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -95,9 +95,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 */ -- cgit v1.2.3 From 66eea14c241cf0aebeccfb0d1f0d98e7dcbf4b73 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 Jan 2020 21:27:04 +0100 Subject: nxagent: Free atom map on termination --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 15 +++++++++++++-- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 2 ++ nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index eecead6e1..2e144bb0c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -364,7 +364,7 @@ int nxagentQueryAtoms(ScreenPtr pScreen) typedef struct { Atom local; XlibAtom remote; - const char *string; + char *string; int length; } AtomMap; @@ -397,7 +397,7 @@ static void nxagentExpandCache(void) static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string) { - const char *s = strdup(string); + char *s = strdup(string); #ifdef WARNING if (s == NULL) @@ -436,6 +436,17 @@ 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. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index 8dff0d5a7..a39c53c07 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h @@ -51,6 +51,8 @@ int nxagentQueryAtoms(ScreenPtr pScreen); void nxagentResetAtomMap(void); +void nxagentFreeAtomMap(void); + void nxagentWMDetect(void); #ifdef XlibAtom diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index ad9ce771f..ede0ffdcc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -580,6 +580,8 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio NXShadowDestroy(); } saveAgentState("TERMINATED"); + + nxagentFreeAtomMap(); #endif /* NXAGENT_SERVER */ KillAllClients(); -- cgit v1.2.3 From 06638575702dec2b58ea6c2a4098c2d5b4c30dd0 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 08:13:44 +0100 Subject: Screen.c: formatting fixes --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 8bbc68e13..4d5132d01 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3289,11 +3289,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 +3302,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 @@ -3349,7 +3350,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++; } @@ -4011,9 +4012,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 +4023,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); -- cgit v1.2.3 From beef0cd99e476188165425fd6516a0b02ce54a80 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 22:28:11 +0100 Subject: Drawable.c: refactor nxagentSynchronizeDrawableData move common code into helper function that also takes care of the ugly alloc/free stuff. --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 130 +++++++++++--------------- 1 file changed, 52 insertions(+), 78 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 7f1d2dec5..5527e5d67 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -191,45 +191,64 @@ 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) +{ + int success; + if (pDrawable -> type == DRAWABLE_PIXMAP) + { /* * Synchronize the whole pixmap if we need to download a fresh * copy with lossless compression turned off. @@ -237,33 +256,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; + success = reallySynchronizeDrawableData(pDrawable); goto nxagentSynchronizeDrawableDataEnd; } @@ -278,7 +276,6 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask if (pDrawable -> depth == 1) { #ifdef TEST - if (nxagentReconnectTrap == 1) { static int totalLength; @@ -287,44 +284,22 @@ 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; + success = reallySynchronizeDrawableData(pDrawable); goto nxagentSynchronizeDrawableDataEnd; } 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); @@ -345,7 +320,6 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask success = nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); nxagentSynchronizeDrawableDataEnd: - SAFE_free(data); return success; } -- cgit v1.2.3 From cc8d8f72de9d30beb1331ecedfa3b329cb4b36f9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 22:30:38 +0100 Subject: Drawable.c: get rid of goto code in nxagentSynchronizeDrawableData Now all cleanup code at the end of the function is gone so there's no need for the gotos anymore. Just return directly. --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 5527e5d67..6068b16bf 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -245,8 +245,6 @@ static int reallySynchronizeDrawableData(DrawablePtr pDrawable) int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner) { - int success; - if (pDrawable -> type == DRAWABLE_PIXMAP) { /* @@ -261,9 +259,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask __func__, (void *) pDrawable); #endif - success = reallySynchronizeDrawableData(pDrawable); - - goto nxagentSynchronizeDrawableDataEnd; + return reallySynchronizeDrawableData(pDrawable); } else if (nxagentReconnectTrap == 1) { @@ -291,9 +287,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask } #endif - success = reallySynchronizeDrawableData(pDrawable); - - goto nxagentSynchronizeDrawableDataEnd; + return reallySynchronizeDrawableData(pDrawable); } else { @@ -304,9 +298,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask nxagentMarkCorruptedRegion(pDrawable, NullRegion); - success = 1; - - goto nxagentSynchronizeDrawableDataEnd; + return 1; } } } @@ -317,11 +309,7 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask * the drawable. */ - success = nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); - -nxagentSynchronizeDrawableDataEnd: - - return success; + return nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); } /* -- cgit v1.2.3 From dfb18f8fe7c921584b5fcc48a88219151bed6ae3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 22:54:32 +0100 Subject: nxagent: simplify nxagentFreeRegion macro Does not require two parameters. It could be replaced by RegionDestroy() entirely but we leave it to have a match to nxagentCreateRegion(). --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 12 ++++++------ nx-X11/programs/Xserver/hw/nxagent/Drawable.h | 3 +-- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 18 +++++++++--------- nx-X11/programs/Xserver/hw/nxagent/Image.c | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Render.c | 8 ++++---- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 6068b16bf..266ea86da 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -941,7 +941,7 @@ nxagentSynchronizeRegionFree: if (clipRegion != NullRegion) { - nxagentFreeRegion(pDrawable, clipRegion); + nxagentFreeRegion(clipRegion); } SAFE_free(data); @@ -996,7 +996,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; } @@ -1009,7 +1009,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea nxagentSynchronizeRegion(pDrawable, pRegion, breakMask, NULL); - nxagentFreeRegion(pDrawable, pRegion); + nxagentFreeRegion(pRegion); } } @@ -1520,7 +1520,7 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) RegionUnion(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); - nxagentFreeRegion(pDrawable, pRegion); + nxagentFreeRegion(pRegion); } else { @@ -2321,7 +2321,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) { @@ -2528,7 +2528,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/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 5ac341990..9bce4af0d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -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/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/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 6113a419a..673b7114f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -1157,7 +1157,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion); - nxagentFreeRegion(pDst -> pDrawable, pDstRegion); + nxagentFreeRegion(pDstRegion); return; } @@ -1326,12 +1326,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 +1817,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) { -- cgit v1.2.3 From 39bf8d9d723c7e1fe39694e9d0da164692bcbdf9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Jan 2020 00:13:23 +0100 Subject: Rootless.c: undo overzealous scope improvement It is better to create the values array once and not on every iteration.. --- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 2adb254f6..77843b851 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -332,17 +332,17 @@ 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); + ConfigureWindow(toplevel[i], mask, values, pClient); nxagentScreenTrap = 0; #ifdef TEST -- cgit v1.2.3 From 919e4fad30fef7efaa8e80885e8caaa3561284aa Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Jan 2020 00:29:03 +0100 Subject: Render.c: replace two while loops by shorter for loops --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 673b7114f..8bbff5f5e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -360,19 +360,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 +381,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #endif images += bytesPerLine; - - height--; } } -- cgit v1.2.3 From 192112d880cc369daa3e253588200a4d4f7b308d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 27 Jan 2020 15:32:49 +0100 Subject: Render.c: describe function purpose (from nxagent changelog) --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 8bbff5f5e..597392bf1 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, -- cgit v1.2.3 From 238a4b68197bce7c99d37cbefedde2a1b824a9b2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 Jan 2020 19:55:02 +0100 Subject: Xext: Fix cursor reference counting hazard. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of this xorg-xserver patch: commit 3083c5d0c4386cdd7083b7a83ac72fdad2f1e61e Author: Michel Dänzer Date: Mon Mar 22 18:01:17 2010 +0100 Xext: Fix cursor reference counting hazard. Make sure the reference count of the new cursor is increased before the old one is decreased, otherwise bad things will happen if they're one and the same and the reference count is 1 initially. Not sure this can actually happen here, but better safe than sorry. Signed-off-by: Michel Dänzer Reviewed-by: Roland Scheidegger Signed-off-by: Keith Packard --- nx-X11/programs/Xserver/Xext/saver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c index 65c43f6b4..a068b25ee 100644 --- a/nx-X11/programs/Xserver/Xext/saver.c +++ b/nx-X11/programs/Xserver/Xext/saver.c @@ -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; -- cgit v1.2.3 From ad90098f107832c9e975fb9780ea3dbecb4a0d56 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 Jan 2020 19:58:46 +0100 Subject: Xext: rename saver's EventType to SaverEventType. Backport of this xorg-xserver commit: commit cfd3443fe81685e91a53063dee58e24a5684dc29 Author: Peter Hutterer Date: Wed Jan 28 13:34:10 2009 +1000 Xext: rename saver's EventType to SaverEventType. Avoid namespace clashing with the internal events. Signed-off-by: Peter Hutterer --- nx-X11/programs/Xserver/Xext/saver.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c index a068b25ee..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; -- cgit v1.2.3 From 3053d7a80694fefdbbfcc3edfeec80fbfa674127 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 14 Jan 2020 22:16:32 +0100 Subject: xkb/xkbUtils.c: add link to bugreport The problem we are fixing (or better "working around") here has also been seen in XQuartz, but no-one has found the reason yet. Point to bugreport so that anyone stumbling over this in future can check if there's a better fix and possibly implement that one. --- nx-X11/programs/Xserver/xkb/xkbUtils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3 From b1b02fe1c0e2a5a608446207985b98cecacfe12e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 17 Jan 2020 21:39:26 +0100 Subject: Splash.c: fix syntax error in TEST mode --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 91292470e..2974f98b1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -404,7 +404,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 -- cgit v1.2.3 From 7b669d7e0e46cc63afb1448fdb01a3e0334c9728 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 00:01:25 +0100 Subject: Splash.c: center logo was offset to the right and downwards before Fixes ArcticaProject/nx-libs#892 --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 182 ++++++++++++++++------------ 1 file changed, 104 insertions(+), 78 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 2974f98b1..06ac62a59 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -178,9 +178,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) { @@ -221,152 +218,181 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) 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); else XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); + + #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 + + /* + * Draw X2GO Logo + */ + +#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 */ + +#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 */ + +#define X(offset) (XSTART + (offset) * c) +#define Y(offset) (YSTART + (offset) * c) + /* * Start 'X'. */ - 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; + rect[0].x = X(1); rect[0].y = Y(0); + rect[1].x = X(0); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(5); rect[3].y = Y(8); 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; + rect[0].x = X(4); rect[0].y = Y(0); + rect[1].x = X(5); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'X'. */ +#undef X +#define X(offset) (XSTART + (SPC + WX + offset) * c) + /* * Start '2'. */ - 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; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(1); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(2); + rect[3].x = X(0); rect[3].y = Y(2); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - 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; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(1); + rect[3].x = X(0); rect[3].y = Y(1); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - 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; + rect[0].x = X(3); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(3); + rect[3].x = X(3); rect[3].y = Y(3); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - 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; + rect[0].x = X(4); rect[0].y = Y(3); + rect[1].x = X(3); rect[1].y = Y(3); + rect[2].x = X(0); rect[2].y = Y(7); + rect[3].x = X(1); rect[3].y = Y(7); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - 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; + rect[0].x = X(0); rect[0].y = Y(7); + rect[1].x = X(4); rect[1].y = Y(7); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + /* * End '2'. */ +#undef X +#define X(offset) (XSTART + (SPC + WX + SPC + W2 + offset) * c) + /* * Start 'G'. */ - 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; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(1); + rect[3].x = X(0); rect[3].y = Y(1); 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; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(1); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); 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; + rect[0].x = X(0); rect[0].y = Y(7); + rect[1].x = X(4); rect[1].y = Y(7); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); 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; + rect[0].x = X(3); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(2); + rect[3].x = X(3); rect[3].y = Y(2); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, 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; + rect[0].x = X(3); rect[0].y = Y(5); + rect[1].x = X(4); rect[1].y = Y(5); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(3); rect[3].y = Y(8); 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; + rect[0].x = X(2); rect[0].y = Y(4); + rect[1].x = X(4); rect[1].y = Y(4); + rect[2].x = X(4); rect[2].y = Y(5); + rect[3].x = X(2); rect[3].y = Y(5); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'G'. */ +#undef X +#define X(offset) (XSTART + (SPC + WX + SPC + W2 + SPC + WG + offset) * c) + /* * Start 'O'. */ - 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; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(1); + rect[3].x = X(0); rect[3].y = Y(1); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, 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; + rect[0].x = X(0); rect[0].y = Y(8); + rect[1].x = X(4); rect[1].y = Y(8); + rect[2].x = X(4); rect[2].y = Y(7); + rect[3].x = X(0); rect[3].y = Y(7); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - 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; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(1); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - 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; + rect[0].x = X(3); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(3); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'O'. */ - XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #ifdef NXAGENT_LOGO_DEBUG -- cgit v1.2.3 From 2cddd5c5e31f1d46b7a8370ef1c6af4dc33c5bfb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 28 Jan 2020 08:20:14 +0100 Subject: Splash.c: add nxagentHaveSplashWindow helper --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 5 +++++ nx-X11/programs/Xserver/hw/nxagent/Splash.h | 1 + nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index ede0ffdcc..1b4b2cc85 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -330,7 +330,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", diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 06ac62a59..26b897c91 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -160,6 +160,11 @@ void nxagentShowSplashWindow(Window parentWindow) #endif } +Bool nxagentHaveSplashWindow(void) +{ + return (nxagentSplashWindow != None); +} + void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) { int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index a43801469..bf3ccf5f9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -42,4 +42,5 @@ extern Window nxagentSplashWindow; extern void nxagentShowSplashWindow(Window); extern void nxagentRemoveSplashWindow(); +extern Bool nxagentHaveSplashWindow(void); #endif /* __Splash_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index d60be1aa7..a39cc035f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1447,7 +1447,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) * * else if (mask & CWStackMode) * { - * if (nxagentSplashWindow) + * if (nxagentHaveSplashWindow()) * { * valuemask = CWStackMode; * -- cgit v1.2.3 From ca531cce24f232cf702fe673b86a2b0934c1c6ef Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 28 Jan 2020 08:21:53 +0100 Subject: Splash.c: use more Xlib types --- nx-X11/programs/Xserver/hw/nxagent/Screen.h | 2 -- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 16 ++++++++-------- nx-X11/programs/Xserver/hw/nxagent/Splash.h | 9 ++++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h index 104da1cea..f74fd66b6 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; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 26b897c91..48ddda520 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -57,13 +57,13 @@ #define nxagentLogoDarkGray 0x222222 #define nxagentLogoLightGray 0xbbbbbb -Pixmap nxagentPixmapLogo; -Window nxagentSplashWindow = None; +XlibPixmap nxagentPixmapLogo; +XlibWindow nxagentSplashWindow = None; Bool nxagentWMPassed = False; -static void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height); +static void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int height); -void nxagentShowSplashWindow(Window parentWindow) +void nxagentShowSplashWindow(XlibWindow parentWindow) { XWindowAttributes getAttributes; XWindowChanges values; @@ -138,7 +138,7 @@ void nxagentShowSplashWindow(Window parentWindow) BlackPixel (nxagentDisplay, 0)); #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 @@ -165,7 +165,7 @@ Bool nxagentHaveSplashWindow(void) return (nxagentSplashWindow != None); } -void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) +void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int height) { int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); @@ -435,7 +435,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 @@ -446,6 +446,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 bf3ccf5f9..46655e039 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -37,10 +37,9 @@ 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__ */ -- cgit v1.2.3 From e44a93b0b99f25074d2a82f84b1530008feb5b73 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 00:27:59 +0100 Subject: Splash.c: some reformatting --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 48ddda520..645e421a3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -65,10 +65,6 @@ static void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, in 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(XlibWindow 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. */ @@ -145,9 +141,9 @@ void nxagentShowSplashWindow(XlibWindow parentWindow) XlibGC gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL); nxagentPaintLogo(nxagentSplashWindow, gc, 1, getAttributes.width, getAttributes.height); XMapRaised (nxagentDisplay, nxagentSplashWindow); - values.stack_mode = Above; + XWindowChanges values = {.stack_mode = Above}; XConfigureWindow(nxagentDisplay, nxagentSplashWindow, CWStackMode, &values); - attributes.override_redirect = True; + XSetWindowAttributes attributes = {.override_redirect = True}; XChangeWindowAttributes(nxagentDisplay, nxagentSplashWindow, CWOverrideRedirect, &attributes); XFreeGC(nxagentDisplay, gc); -- cgit v1.2.3 From 436eef46a28c8ad6100004bce2ac13d7e7437e04 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 14:42:21 +0100 Subject: Splash.c: use uppercase color defines --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 645e421a3..7e19d5c11 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -52,10 +52,10 @@ * 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 XlibPixmap nxagentPixmapLogo; XlibWindow nxagentSplashWindow = None; @@ -200,13 +200,13 @@ void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int heigh 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]; @@ -223,9 +223,9 @@ void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int heigh #endif if (blackRoot) - XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray); + XSetForeground(nxagentDisplay, gc, LOGODARKGRAY); else - XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); + XSetForeground(nxagentDisplay, gc, LOGOLIGHTGRAY); #ifdef NXAGENT_LOGO_DEBUG -- cgit v1.2.3 From 98c6c162e5752332652d3b05dbdb0d272aa89d1a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 14:44:13 +0100 Subject: Splash.c: make variables static They are not used from the outside. --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 7e19d5c11..1bb39910b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -57,9 +57,9 @@ #define LOGODARKGRAY 0x222222 #define LOGOLIGHTGRAY 0xbbbbbb -XlibPixmap nxagentPixmapLogo; -XlibWindow nxagentSplashWindow = None; -Bool nxagentWMPassed = False; +static XlibPixmap nxagentPixmapLogo; +static XlibWindow nxagentSplashWindow = None; +static Bool nxagentWMPassed = False; static void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int height); -- cgit v1.2.3 From 26ea6d33fb41f29254935cf9a7646492e920ed94 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 14:52:51 +0100 Subject: Splash.h: split out xdmcp parts into separate header file --- nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 1 + nx-X11/programs/Xserver/hw/nxagent/Splash.h | 11 ------- nx-X11/programs/Xserver/hw/nxagent/Xdmcp.h | 41 +++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 nx-X11/programs/Xserver/hw/nxagent/Xdmcp.h diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index fa6b9ce03..6901647e3 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" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 1b4b2cc85..39aec075d 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" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.h b/nx-X11/programs/Xserver/hw/nxagent/Splash.h index 46655e039..eae9c9dd1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.h @@ -26,17 +26,6 @@ #ifndef __Splash_H__ #define __Splash_H__ -#include "Windows.h" -#include "X11/Xdmcp.h" -#include - -#define XDM_TIMEOUT 20000 - -extern xdmcp_states XdmcpState; -extern int XdmcpTimeOutRtx; -extern int XdmcpStartTime; -extern int nxagentXdmcpUp; - #ifdef XlibWindow extern void nxagentShowSplashWindow(XlibWindow); #endif 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 */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* 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 + +#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__ */ -- cgit v1.2.3 From de46c64ec1036a91014f6b0384d9f5038cd30cc6 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 09:25:32 +0100 Subject: Splash.c: move the GC to nxagentPaintLogo It is not needed elsewhere. --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 1bb39910b..f4c25efc4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -61,7 +61,7 @@ static XlibPixmap nxagentPixmapLogo; static XlibWindow nxagentSplashWindow = None; static Bool nxagentWMPassed = False; -static void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int height); +static void nxagentPaintLogo(XlibWindow win, int scale, int width, int height); void nxagentShowSplashWindow(XlibWindow parentWindow) { @@ -138,14 +138,12 @@ void nxagentShowSplashWindow(XlibWindow parentWindow) nxagentSplashWindow); #endif - XlibGC gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL); - nxagentPaintLogo(nxagentSplashWindow, gc, 1, getAttributes.width, getAttributes.height); + nxagentPaintLogo(nxagentSplashWindow, 1, getAttributes.width, getAttributes.height); XMapRaised (nxagentDisplay, nxagentSplashWindow); XWindowChanges values = {.stack_mode = Above}; XConfigureWindow(nxagentDisplay, nxagentSplashWindow, CWStackMode, &values); XSetWindowAttributes attributes = {.override_redirect = True}; XChangeWindowAttributes(nxagentDisplay, nxagentSplashWindow, CWOverrideRedirect, &attributes); - XFreeGC(nxagentDisplay, gc); #ifdef NXAGENT_TIMESTAMP { @@ -161,8 +159,10 @@ Bool nxagentHaveSplashWindow(void) return (nxagentSplashWindow != None); } -void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int height) +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 @@ -396,6 +396,8 @@ void nxagentPaintLogo(XlibWindow win, XlibGC gc, int scale, int width, int heigh XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); + XFreeGC(nxagentDisplay, gc); + #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: end\n", __func__); #endif -- cgit v1.2.3 From 2e467efb20a3e22d7d9bb941be7375f10cb84f66 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 09:43:02 +0100 Subject: Splash.c: always paint background over the whole window Was wrong when scale was different from 1 --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index f4c25efc4..a34591d7a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -211,9 +211,9 @@ void nxagentPaintLogo(XlibWindow win, int scale, int width, int height) XPoint rect[4]; 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); -- cgit v1.2.3 From ae20e50c7318e8bf0d850c065847edecacbeb1ed Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 09:53:48 +0100 Subject: Splash.c: reduce number of Xlib calls --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 34 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index a34591d7a..f98e7082c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -124,14 +124,21 @@ void nxagentShowSplashWindow(XlibWindow 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 [0x%lx].\n", __func__, @@ -139,11 +146,18 @@ void nxagentShowSplashWindow(XlibWindow parentWindow) #endif nxagentPaintLogo(nxagentSplashWindow, 1, getAttributes.width, getAttributes.height); - XMapRaised (nxagentDisplay, nxagentSplashWindow); + 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); - XSetWindowAttributes attributes = {.override_redirect = True}; - XChangeWindowAttributes(nxagentDisplay, nxagentSplashWindow, CWOverrideRedirect, &attributes); +#endif #ifdef NXAGENT_TIMESTAMP { -- cgit v1.2.3 From ca2ec409ccf0a12b8d147f94de24cb199de609c6 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 10:49:48 +0100 Subject: Splash.c: reduce number of X calls for logo painting Instead of 17 XFillPolygon() calls we now use 5. --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 137 ++++------------------------ 1 file changed, 20 insertions(+), 117 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index f98e7082c..ea82513e6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -223,7 +223,7 @@ void nxagentPaintLogo(XlibWindow win, int scale, int width, int height) 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 = height; rect[2].x = width; rect[2].y = height; @@ -266,147 +266,50 @@ void nxagentPaintLogo(XlibWindow win, int scale, int width, int height) #define X(offset) (XSTART + (offset) * c) #define Y(offset) (YSTART + (offset) * c) +#define XY(xx,yy) {rect[cnt].x = X(xx); rect[cnt++].y = Y(yy);} + + int cnt; + /* - * Start 'X'. + * Paint 'X'. */ - rect[0].x = X(1); rect[0].y = Y(0); - rect[1].x = X(0); rect[1].y = Y(0); - rect[2].x = X(4); rect[2].y = Y(8); - rect[3].x = X(5); rect[3].y = Y(8); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + 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 = X(4); rect[0].y = Y(0); - rect[1].x = X(5); rect[1].y = Y(0); - rect[2].x = X(1); rect[2].y = Y(8); - rect[3].x = X(0); rect[3].y = Y(8); - 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); /* - * End 'X'. + * Paint '2'. */ #undef X #define X(offset) (XSTART + (SPC + WX + offset) * c) - /* - * Start '2'. - */ - - rect[0].x = X(0); rect[0].y = Y(0); - rect[1].x = X(1); rect[1].y = Y(0); - rect[2].x = X(1); rect[2].y = Y(2); - rect[3].x = X(0); rect[3].y = Y(2); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(0); rect[0].y = Y(0); - rect[1].x = X(4); rect[1].y = Y(0); - rect[2].x = X(4); rect[2].y = Y(1); - rect[3].x = X(0); rect[3].y = Y(1); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(3); rect[0].y = Y(0); - rect[1].x = X(4); rect[1].y = Y(0); - rect[2].x = X(4); rect[2].y = Y(3); - rect[3].x = X(3); rect[3].y = Y(3); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(4); rect[0].y = Y(3); - rect[1].x = X(3); rect[1].y = Y(3); - rect[2].x = X(0); rect[2].y = Y(7); - rect[3].x = X(1); rect[3].y = Y(7); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(0); rect[0].y = Y(7); - rect[1].x = X(4); rect[1].y = Y(7); - rect[2].x = X(4); rect[2].y = Y(8); - rect[3].x = X(0); rect[3].y = Y(8); - 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); /* - * End '2'. + * Paint 'G'. */ #undef X #define X(offset) (XSTART + (SPC + WX + SPC + W2 + offset) * c) - /* - * Start 'G'. - */ - - rect[0].x = X(0); rect[0].y = Y(0); - rect[1].x = X(4); rect[1].y = Y(0); - rect[2].x = X(4); rect[2].y = Y(1); - rect[3].x = X(0); rect[3].y = Y(1); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(0); rect[0].y = Y(0); - rect[1].x = X(1); rect[1].y = Y(0); - rect[2].x = X(1); rect[2].y = Y(8); - rect[3].x = X(0); rect[3].y = Y(8); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(0); rect[0].y = Y(7); - rect[1].x = X(4); rect[1].y = Y(7); - rect[2].x = X(4); rect[2].y = Y(8); - rect[3].x = X(0); rect[3].y = Y(8); - 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); - rect[0].x = X(3); rect[0].y = Y(0); - rect[1].x = X(4); rect[1].y = Y(0); - rect[2].x = X(4); rect[2].y = Y(2); - rect[3].x = X(3); rect[3].y = Y(2); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(3); rect[0].y = Y(5); - rect[1].x = X(4); rect[1].y = Y(5); - rect[2].x = X(4); rect[2].y = Y(8); - rect[3].x = X(3); rect[3].y = Y(8); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(2); rect[0].y = Y(4); - rect[1].x = X(4); rect[1].y = Y(4); - rect[2].x = X(4); rect[2].y = Y(5); - rect[3].x = X(2); rect[3].y = Y(5); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* - * End 'G'. + * Paint 'O'. */ #undef X #define X(offset) (XSTART + (SPC + WX + SPC + W2 + SPC + WG + offset) * c) - /* - * Start 'O'. - */ - - rect[0].x = X(0); rect[0].y = Y(0); - rect[1].x = X(4); rect[1].y = Y(0); - rect[2].x = X(4); rect[2].y = Y(1); - rect[3].x = X(0); rect[3].y = Y(1); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(0); rect[0].y = Y(8); - rect[1].x = X(4); rect[1].y = Y(8); - rect[2].x = X(4); rect[2].y = Y(7); - rect[3].x = X(0); rect[3].y = Y(7); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(0); rect[0].y = Y(0); - rect[1].x = X(1); rect[1].y = Y(0); - rect[2].x = X(1); rect[2].y = Y(8); - rect[3].x = X(0); rect[3].y = Y(8); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = X(3); rect[0].y = Y(0); - rect[1].x = X(4); rect[1].y = Y(0); - rect[2].x = X(4); rect[2].y = Y(8); - rect[3].x = X(3); rect[3].y = Y(8); - XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - /* - * End 'O'. - */ + 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); -- cgit v1.2.3 From 1d4d8da23d02fdc88515c0b6fcacf8664b682c0a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:12:24 +0100 Subject: Drop unused Xalloca.h --- debian/copyright | 1 - debian/copyright.in | 1 - debian/nx-x11proto-core-dev.install | 1 - nx-X11/include/Imakefile | 2 - nx-X11/include/Xalloca.h | 139 ------------------------------------ nx-libs.spec | 1 - 6 files changed, 145 deletions(-) delete mode 100644 nx-X11/include/Xalloca.h diff --git a/debian/copyright b/debian/copyright index 9537f2530..20ab5c97c 100644 --- a/debian/copyright +++ b/debian/copyright @@ -714,7 +714,6 @@ Copyright: 1999-2001, Brian Paul License: Expat Files: nx-X11/include/XWDFile.h - nx-X11/include/Xalloca.h nx-X11/include/Xauth.h nx-X11/include/Xfuncproto.h nx-X11/include/Xfuncs.h diff --git a/debian/copyright.in b/debian/copyright.in index bfbe86d90..00edd8ecf 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -8,7 +8,6 @@ Files: nx-X11/include/DECkeysym.h nx-X11/include/HPkeysym.h nx-X11/include/X.h nx-X11/include/XWDFile.h - nx-X11/include/Xalloca.h nx-X11/include/Xauth.h nx-X11/include/Xfuncproto.h nx-X11/include/Xfuncs.h diff --git a/debian/nx-x11proto-core-dev.install b/debian/nx-x11proto-core-dev.install index 16228d84e..32b0ac248 100644 --- a/debian/nx-x11proto-core-dev.install +++ b/debian/nx-x11proto-core-dev.install @@ -4,7 +4,6 @@ usr/include/*/nx-X11/Sunkeysym.h usr/include/*/nx-X11/X.h usr/include/*/nx-X11/XF86keysym.h usr/include/*/nx-X11/XWDFile.h -usr/include/*/nx-X11/Xalloca.h usr/include/*/nx-X11/Xarch.h usr/include/*/nx-X11/Xatom.h usr/include/*/nx-X11/Xdefs.h diff --git a/nx-X11/include/Imakefile b/nx-X11/include/Imakefile index 4ef28f913..5fdac47df 100644 --- a/nx-X11/include/Imakefile +++ b/nx-X11/include/Imakefile @@ -24,7 +24,6 @@ HEADERS = \ X.h \ XF86keysym.h \ XWDFile.h \ - Xalloca.h \ Xarch.h \ Xatom.h \ Xdefs.h \ @@ -59,7 +58,6 @@ MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) InstallDriverSDKNonExecFile(X.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(Xalloca.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xarch.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR)/X11) diff --git a/nx-X11/include/Xalloca.h b/nx-X11/include/Xalloca.h deleted file mode 100644 index ef1bf7b96..000000000 --- a/nx-X11/include/Xalloca.h +++ /dev/null @@ -1,139 +0,0 @@ - -/* - -Copyright 1995, 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. - -*/ - -/* - * The purpose of this header is to define the macros ALLOCATE_LOCAL and - * DEALLOCATE_LOCAL appropriately for the platform being compiled on. - * These macros are used to make fast, function-local memory allocations. - * Their characteristics are as follows: - * - * void *ALLOCATE_LOCAL(int size) - * Returns a pointer to size bytes of memory, or NULL if the allocation - * failed. The memory must be freed with DEALLOCATE_LOCAL before the - * function that made the allocation returns. You should not ask for - * large blocks of memory with this function, since on many platforms - * the memory comes from the stack, which may have limited size. - * - * void DEALLOCATE_LOCAL(void *) - * Frees the memory allocated by ALLOCATE_LOCAL. Omission of this - * step may be harmless on some platforms, but will result in - * memory leaks or worse on others. - * - * Before including this file, you should define two macros, - * ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the - * same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The - * header uses the fallbacks if it doesn't know a "better" way to define - * ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be: - * - * #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size) - * #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr) - * #include "Xalloca.h" - */ - -#ifndef XALLOCA_H -#define XALLOCA_H 1 - -#ifndef INCLUDE_ALLOCA_H -# if defined(__SUNPRO_C) /* Need to add more here to match Imake *.cf's */ -# define INCLUDE_ALLOCA_H -# endif -#endif - -#ifdef INCLUDE_ALLOCA_H -# include -#endif - -#ifndef NO_ALLOCA -/* - * os-dependent definition of local allocation and deallocation - * If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK - * for ALLOCATE/DEALLOCATE_LOCAL then you add that in here. - */ -# if defined(__HIGHC__) -# ifndef NCR - extern char *alloca(); -# if HCVERSION < 21003 -# define ALLOCATE_LOCAL(size) alloca((int)(size)) - pragma on(alloca); -# else /* HCVERSION >= 21003 */ -# define ALLOCATE_LOCAL(size) _Alloca((int)(size)) -# endif /* HCVERSION < 21003 */ -# else /* NCR */ -# define ALLOCATE_LOCAL(size) alloca(size) -# endif -# endif /* defined(__HIGHC__) */ - - -# ifdef __GNUC__ -# ifndef alloca -# define alloca __builtin_alloca -# endif /* !alloca */ -# define ALLOCATE_LOCAL(size) alloca((int)(size)) -# else /* ! __GNUC__ */ - -/* - * warning: old mips alloca (pre 2.10) is unusable, new one is built in - * Test is easy, the new one is named __builtin_alloca and comes - * from alloca.h which #defines alloca. - */ -# ifndef NCR -# if defined(vax) || defined(sun) || defined(apollo) || defined(stellar) || defined(alloca) -/* - * Some System V boxes extract alloca.o from /lib/libPW.a; if you - * decide that you don't want to use alloca, you might want to fix it here. - */ -/* alloca might be a macro taking one arg (hi, Sun!), so give it one. */ -# define __Xnullarg /* as nothing */ -# ifndef X_NOT_STDC_ENV - extern void *alloca(__Xnullarg); -# else - extern char *alloca(__Xnullarg); -# endif -# define ALLOCATE_LOCAL(size) alloca((int)(size)) -# endif /* who does alloca */ -# endif /* NCR */ -# endif /* __GNUC__ */ - -#endif /* NO_ALLOCA */ - -#if !defined(ALLOCATE_LOCAL) -# if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK) -# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size) -# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr) -# else /* no fallbacks supplied; error */ -# define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined! -# define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined! -# endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */ -#else -# if !defined(DEALLOCATE_LOCAL) -# define DEALLOCATE_LOCAL(_ptr) do {} while(0) -# endif -#endif /* defined(ALLOCATE_LOCAL) */ - -#endif /* XALLOCA_H */ diff --git a/nx-libs.spec b/nx-libs.spec index 344a59a9f..fb1847a9e 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -554,7 +554,6 @@ rm -f %{buildroot}%{_datadir}/man/man1/nxdialog.1* %{_includedir}/nx-X11/X.h %{_includedir}/nx-X11/XF86keysym.h %{_includedir}/nx-X11/XWDFile.h -%{_includedir}/nx-X11/Xalloca.h %{_includedir}/nx-X11/Xarch.h %{_includedir}/nx-X11/Xatom.h %{_includedir}/nx-X11/Xdefs.h -- cgit v1.2.3 From a59ad630b40aba05cd9b819861af655949fd3a50 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:15:55 +0100 Subject: Drop unused rgb.h --- debian/copyright | 1 - debian/copyright.in | 1 - nx-X11/programs/Xserver/include/rgb.h | 53 ----------------------------------- 3 files changed, 55 deletions(-) delete mode 100644 nx-X11/programs/Xserver/include/rgb.h diff --git a/debian/copyright b/debian/copyright index 20ab5c97c..40773e173 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1336,7 +1336,6 @@ Files: nx-X11/include/DECkeysym.h nx-X11/programs/Xserver/include/region.h nx-X11/programs/Xserver/include/regionstr.h nx-X11/programs/Xserver/include/resource.h - nx-X11/programs/Xserver/include/rgb.h nx-X11/programs/Xserver/include/screenint.h nx-X11/programs/Xserver/include/scrnintstr.h nx-X11/programs/Xserver/include/selection.h diff --git a/debian/copyright.in b/debian/copyright.in index 00edd8ecf..dd09390a4 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -380,7 +380,6 @@ Files: nx-X11/include/DECkeysym.h nx-X11/programs/Xserver/include/region.h nx-X11/programs/Xserver/include/regionstr.h nx-X11/programs/Xserver/include/resource.h - nx-X11/programs/Xserver/include/rgb.h nx-X11/programs/Xserver/include/screenint.h nx-X11/programs/Xserver/include/scrnintstr.h nx-X11/programs/Xserver/include/selection.h 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 */ -- cgit v1.2.3 From 0943abfaf1ffce1315288b876e45232b31ff4747 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:18:43 +0100 Subject: Drop unused XWDFile.h --- debian/copyright | 3 +- debian/copyright.in | 1 - debian/nx-x11proto-core-dev.install | 1 - nx-X11/include/Imakefile | 1 - nx-X11/include/XWDFile.h | 113 ------------------------------------ nx-libs.spec | 1 - 6 files changed, 1 insertion(+), 119 deletions(-) delete mode 100644 nx-X11/include/XWDFile.h diff --git a/debian/copyright b/debian/copyright index 40773e173..63f1ad29e 100644 --- a/debian/copyright +++ b/debian/copyright @@ -713,8 +713,7 @@ Copyright: 1999-2001, Brian Paul 2005, Brian Paul License: Expat -Files: nx-X11/include/XWDFile.h - nx-X11/include/Xauth.h +Files: nx-X11/include/Xauth.h nx-X11/include/Xfuncproto.h nx-X11/include/Xfuncs.h nx-X11/include/Xos.h diff --git a/debian/copyright.in b/debian/copyright.in index dd09390a4..a4484f91d 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -7,7 +7,6 @@ Disclaimer: Autogenerated by CDBS Files: nx-X11/include/DECkeysym.h nx-X11/include/HPkeysym.h nx-X11/include/X.h - nx-X11/include/XWDFile.h nx-X11/include/Xauth.h nx-X11/include/Xfuncproto.h nx-X11/include/Xfuncs.h diff --git a/debian/nx-x11proto-core-dev.install b/debian/nx-x11proto-core-dev.install index 32b0ac248..703b311e6 100644 --- a/debian/nx-x11proto-core-dev.install +++ b/debian/nx-x11proto-core-dev.install @@ -3,7 +3,6 @@ usr/include/*/nx-X11/HPkeysym.h usr/include/*/nx-X11/Sunkeysym.h usr/include/*/nx-X11/X.h usr/include/*/nx-X11/XF86keysym.h -usr/include/*/nx-X11/XWDFile.h usr/include/*/nx-X11/Xarch.h usr/include/*/nx-X11/Xatom.h usr/include/*/nx-X11/Xdefs.h diff --git a/nx-X11/include/Imakefile b/nx-X11/include/Imakefile index 5fdac47df..89a5833b1 100644 --- a/nx-X11/include/Imakefile +++ b/nx-X11/include/Imakefile @@ -23,7 +23,6 @@ HEADERS = \ Sunkeysym.h \ X.h \ XF86keysym.h \ - XWDFile.h \ Xarch.h \ Xatom.h \ Xdefs.h \ diff --git a/nx-X11/include/XWDFile.h b/nx-X11/include/XWDFile.h deleted file mode 100644 index b5c2349c5..000000000 --- a/nx-X11/include/XWDFile.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - -Copyright 1985, 1986, 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. - -*/ - -/* - * XWDFile.h MIT Project Athena, X Window system window raster - * image dumper, dump file format header file. - * - * Author: Tony Della Fera, DEC - * 27-Jun-85 - * - * Modifier: William F. Wyatt, SAO - * 18-Nov-86 - version 6 for saving/restoring color maps - */ - -#ifndef XWDFILE_H -#define XWDFILE_H - -#include - -#define XWD_FILE_VERSION 7 -#define sz_XWDheader 100 -#define sz_XWDColor 12 - -typedef CARD32 xwdval; /* for old broken programs */ - -/* Values in the file are most significant byte first. */ - -typedef struct _xwd_file_header { - /* header_size = SIZEOF(XWDheader) + length of null-terminated - * window name. */ - CARD32 header_size B32; - - CARD32 file_version B32; /* = XWD_FILE_VERSION above */ - CARD32 pixmap_format B32; /* ZPixmap or XYPixmap */ - CARD32 pixmap_depth B32; /* Pixmap depth */ - CARD32 pixmap_width B32; /* Pixmap width */ - CARD32 pixmap_height B32; /* Pixmap height */ - CARD32 xoffset B32; /* Bitmap x offset, normally 0 */ - CARD32 byte_order B32; /* of image data: MSBFirst, LSBFirst */ - - /* bitmap_unit applies to bitmaps (depth 1 format XY) only. - * It is the number of bits that each scanline is padded to. */ - CARD32 bitmap_unit B32; - - CARD32 bitmap_bit_order B32; /* bitmaps only: MSBFirst, LSBFirst */ - - /* bitmap_pad applies to pixmaps (non-bitmaps) only. - * It is the number of bits that each scanline is padded to. */ - CARD32 bitmap_pad B32; - - CARD32 bits_per_pixel B32; /* Bits per pixel */ - - /* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps) - * or bitmap_pad (pixmaps). It is the delta (in bytes) to get - * to the same x position on an adjacent row. */ - CARD32 bytes_per_line B32; - CARD32 visual_class B32; /* Class of colormap */ - CARD32 red_mask B32; /* Z red mask */ - CARD32 green_mask B32; /* Z green mask */ - CARD32 blue_mask B32; /* Z blue mask */ - CARD32 bits_per_rgb B32; /* Log2 of distinct color values */ - CARD32 colormap_entries B32; /* Number of entries in colormap; not used? */ - CARD32 ncolors B32; /* Number of XWDColor structures */ - CARD32 window_width B32; /* Window width */ - CARD32 window_height B32; /* Window height */ - CARD32 window_x B32; /* Window upper left X coordinate */ - CARD32 window_y B32; /* Window upper left Y coordinate */ - CARD32 window_bdrwidth B32; /* Window border width */ -} XWDFileHeader; - -/* Null-terminated window name follows the above structure. */ - -/* Next comes XWDColor structures, at offset XWDFileHeader.header_size in - * the file. XWDFileHeader.ncolors tells how many XWDColor structures - * there are. - */ - -typedef struct { - CARD32 pixel B32; - CARD16 red B16; - CARD16 green B16; - CARD16 blue B16; - CARD8 flags; - CARD8 pad; -} XWDColor; - -/* Last comes the image data in the format described by XWDFileHeader. */ - -#endif /* XWDFILE_H */ - diff --git a/nx-libs.spec b/nx-libs.spec index fb1847a9e..d933606cc 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -553,7 +553,6 @@ rm -f %{buildroot}%{_datadir}/man/man1/nxdialog.1* %{_includedir}/nx-X11/Sunkeysym.h %{_includedir}/nx-X11/X.h %{_includedir}/nx-X11/XF86keysym.h -%{_includedir}/nx-X11/XWDFile.h %{_includedir}/nx-X11/Xarch.h %{_includedir}/nx-X11/Xatom.h %{_includedir}/nx-X11/Xdefs.h -- cgit v1.2.3 From 37de96c617a8f93d190a9b7762bc16157a6bc92f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:32:48 +0100 Subject: Drop unused scrnsaver.h --- debian/copyright | 1 - debian/copyright.in | 1 - debian/nx-x11proto-scrnsaver-dev.install | 1 - nx-X11/include/extensions/Imakefile | 2 +- nx-X11/include/extensions/scrnsaver.h | 131 ------------------------------- nx-libs.spec | 1 - 6 files changed, 1 insertion(+), 136 deletions(-) delete mode 100644 nx-X11/include/extensions/scrnsaver.h diff --git a/debian/copyright b/debian/copyright index 63f1ad29e..a67118810 100644 --- a/debian/copyright +++ b/debian/copyright @@ -2184,7 +2184,6 @@ License: Expat Files: nx-X11/include/extensions/saver.h nx-X11/include/extensions/saverproto.h - nx-X11/include/extensions/scrnsaver.h nx-X11/programs/Xserver/Xext/saver.c Copyright: 1992, X Consortium License: Expat~NoAdvert diff --git a/debian/copyright.in b/debian/copyright.in index a4484f91d..7beee8a27 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -2113,7 +2113,6 @@ License: GENERATED FILE Files: nx-X11/include/extensions/saver.h nx-X11/include/extensions/saverproto.h - nx-X11/include/extensions/scrnsaver.h nx-X11/programs/Xserver/Xext/saver.c Copyright: 1992, X Consortium License: MIT/X11 (BSD like) diff --git a/debian/nx-x11proto-scrnsaver-dev.install b/debian/nx-x11proto-scrnsaver-dev.install index 5a04b360b..1ce5992d0 100644 --- a/debian/nx-x11proto-scrnsaver-dev.install +++ b/debian/nx-x11proto-scrnsaver-dev.install @@ -1,3 +1,2 @@ usr/include/*/nx-X11/extensions/saver.h usr/include/*/nx-X11/extensions/saverproto.h -usr/include/*/nx-X11/extensions/scrnsaver.h diff --git a/nx-X11/include/extensions/Imakefile b/nx-X11/include/extensions/Imakefile index 29f3b97fa..4c9a6e9e4 100644 --- a/nx-X11/include/extensions/Imakefile +++ b/nx-X11/include/extensions/Imakefile @@ -1,7 +1,7 @@ NULL = #if BuildScreenSaverExt -SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h +SCREENSAVERHEADERS = saver.h saverproto.h #endif #if BuildXF86BigfontExt diff --git a/nx-X11/include/extensions/scrnsaver.h b/nx-X11/include/extensions/scrnsaver.h deleted file mode 100644 index 38e5e24df..000000000 --- a/nx-X11/include/extensions/scrnsaver.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * $XConsortium: scrnsaver.h,v 1.6 94/04/17 20:59:34 keith Exp $ - * -Copyright (c) 1992 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -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 -X CONSORTIUM 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 X Consortium 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 X Consortium. - * - * Author: Keith Packard, MIT X Consortium - */ -/* $XFree86$ */ - -#ifndef _SCRNSAVER_H_ -#define _SCRNSAVER_H_ - -#include -#include -#include - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came frome a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* screen saver window */ - Window root; /* root window of event screen */ - int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverCycle*/ - int kind; /* ScreenSaverBlanked, ...Internal, ...External */ - Bool forced; /* extents of new region */ - Time time; /* event timestamp */ -} XScreenSaverNotifyEvent; - -typedef struct { - Window window; /* screen saver window - may not exist */ - int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverDisabled*/ - int kind; /* ScreenSaverBlanked, ...Internal, ...External */ - unsigned long til_or_since; /* time til or since screen saver */ - unsigned long idle; /* total time since last user input */ - unsigned long eventMask; /* currently selected events for this client */ -} XScreenSaverInfo; - -_XFUNCPROTOBEGIN - -extern Bool XScreenSaverQueryExtension ( - Display* /* display */, - int* /* event_base */, - int* /* error_base */ -); - -extern Status XScreenSaverQueryVersion ( - Display* /* display */, - int* /* major_version */, - int* /* minor_version */ -); - -extern XScreenSaverInfo *XScreenSaverAllocInfo ( - void -); - -extern Status XScreenSaverQueryInfo ( - Display* /* display */, - Drawable /* drawable */, - XScreenSaverInfo* /* info */ -); - -extern void XScreenSaverSelectInput ( - Display* /* display */, - Drawable /* drawable */, - unsigned long /* eventMask */ -); - -extern void XScreenSaverSetAttributes ( - Display* /* display */, - Drawable /* drawable */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int /* border_width */, - int /* depth */, - unsigned int /* class */, - Visual * /* visual */, - unsigned long /* valuemask */, - XSetWindowAttributes * /* attributes */ -); - -extern void XScreenSaverUnsetAttributes ( - Display* /* display */, - Drawable /* drawable */ -); - -extern Status XScreenSaverRegister ( - Display* /* display */, - int /* screen */, - XID /* xid */, - Atom /* type */ -); - -extern Status XScreenSaverUnregister ( - Display* /* display */, - int /* screen */ -); - -extern Status XScreenSaverGetRegistered ( - Display* /* display */, - int /* screen */, - XID* /* xid */, - Atom* /* type */ -); - -_XFUNCPROTOEND - -#endif /* _SCRNSAVER_H_ */ diff --git a/nx-libs.spec b/nx-libs.spec index d933606cc..55f448a9f 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -584,7 +584,6 @@ rm -f %{buildroot}%{_datadir}/man/man1/nxdialog.1* %{_includedir}/nx-X11/extensions/renderproto.h %{_includedir}/nx-X11/extensions/saver.h %{_includedir}/nx-X11/extensions/saverproto.h -%{_includedir}/nx-X11/extensions/scrnsaver.h %{_includedir}/nx-X11/extensions/security.h %{_includedir}/nx-X11/extensions/securstr.h %{_includedir}/nx-X11/extensions/shapeconst.h -- cgit v1.2.3 From d3fa41a1a0040dcbe9d58c5e3d13dd4889ba63ed Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 14:37:34 +0100 Subject: Drop unused screensaver xpm See ArcticaProject/nx-libs#263 for discussion --- nx-X11/programs/Xserver/hw/nxagent/screensaver | 711 ------------------------- 1 file changed, 711 deletions(-) delete mode 100644 nx-X11/programs/Xserver/hw/nxagent/screensaver 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 */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* 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}; -- cgit v1.2.3 From 38528c9a9663a606c0916241af3637b109d0b3d2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:23:25 +0100 Subject: XKBsrv.h: remove unused externs --- nx-X11/include/extensions/XKBsrv.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nx-X11/include/extensions/XKBsrv.h b/nx-X11/include/extensions/XKBsrv.h index db9c1d59e..81a07a588 100644 --- a/nx-X11/include/extensions/XKBsrv.h +++ b/nx-X11/include/extensions/XKBsrv.h @@ -70,11 +70,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "inputstr.h" -#ifdef NXAGENT_SERVER -extern char *_NXGetXkbBasePath(const char *path); -extern char *_NXGetXkbCompPath(const char *path); -#endif - typedef struct _XkbInterest { DeviceIntPtr dev; ClientPtr client; -- cgit v1.2.3 From cf461c367d9e2f77896a485f3f6ad5b89a2fc7e2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:25:42 +0100 Subject: XKBsrv.h: remove XKBSRV_NEED_FILE_FUNCS stuff Follow-up for 2a5364d5f --- debian/copyright | 2 - debian/copyright.in | 2 - nx-X11/include/extensions/Imakefile | 2 +- nx-X11/include/extensions/XKBfile.h | 492 ----------------------------------- nx-X11/include/extensions/XKBrules.h | 199 -------------- nx-X11/include/extensions/XKBsrv.h | 85 ------ 6 files changed, 1 insertion(+), 781 deletions(-) delete mode 100644 nx-X11/include/extensions/XKBfile.h delete mode 100644 nx-X11/include/extensions/XKBrules.h diff --git a/debian/copyright b/debian/copyright index a67118810..324eb31ba 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1475,10 +1475,8 @@ License: MIT~X11 Files: nx-X11/include/extensions/XKB.h nx-X11/include/extensions/XKBconfig.h - nx-X11/include/extensions/XKBfile.h nx-X11/include/extensions/XKBgeom.h nx-X11/include/extensions/XKBproto.h - nx-X11/include/extensions/XKBrules.h nx-X11/include/extensions/XKBsrv.h nx-X11/include/extensions/XKBstr.h nx-X11/include/extensions/XKM.h diff --git a/debian/copyright.in b/debian/copyright.in index 7beee8a27..315d1b1cf 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -1514,10 +1514,8 @@ License: NTP (legal disclaimer) Files: nx-X11/include/extensions/XKB.h nx-X11/include/extensions/XKBconfig.h - nx-X11/include/extensions/XKBfile.h nx-X11/include/extensions/XKBgeom.h nx-X11/include/extensions/XKBproto.h - nx-X11/include/extensions/XKBrules.h nx-X11/include/extensions/XKBsrv.h nx-X11/include/extensions/XKBstr.h nx-X11/include/extensions/XKM.h diff --git a/nx-X11/include/extensions/Imakefile b/nx-X11/include/extensions/Imakefile index 4c9a6e9e4..277ca634f 100644 --- a/nx-X11/include/extensions/Imakefile +++ b/nx-X11/include/extensions/Imakefile @@ -33,7 +33,7 @@ DAMAGEHEADERS = damagewire.h damageproto.h XRESHEADERS = XResproto.h #endif -XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h XKBfile.h XKBrules.h +XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h EXTRAHEADERS = \ $(SCREENSAVERHEADERS) \ diff --git a/nx-X11/include/extensions/XKBfile.h b/nx-X11/include/extensions/XKBfile.h deleted file mode 100644 index 045193813..000000000 --- a/nx-X11/include/extensions/XKBfile.h +++ /dev/null @@ -1,492 +0,0 @@ - -#ifndef _XKBFILE_H_ -#define _XKBFILE_H_ 1 - -/************************************************************ - Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. - - 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 Silicon Graphics not be - used in advertising or publicity pertaining to distribution - of the software without specific prior written permission. - Silicon Graphics makes no representation about the suitability - of this software for any purpose. It is provided "as is" - without any express or implied warranty. - - SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - GRAPHICS 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. - - ********************************************************/ - -/***====================================================================***/ - -#define XkbXKMFile 0 -#define XkbCFile 1 -#define XkbXKBFile 2 -#define XkbMessage 3 - -#define XkbMapDefined (1<<0) -#define XkbStateDefined (1<<1) - -typedef struct _XkbFileInfo { - unsigned type; - unsigned defined; - XkbDescPtr xkb; -} XkbFileInfo,*XkbFileInfoPtr; - -typedef void (*XkbFileAddOnFunc)( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - int /* fileSection */, - void * /* priv */ -); - -/***====================================================================***/ - -#define _XkbSuccess 0 -#define _XkbErrMissingNames 1 -#define _XkbErrMissingTypes 2 -#define _XkbErrMissingReqTypes 3 -#define _XkbErrMissingSymbols 4 -#define _XkbErrMissingVMods 5 -#define _XkbErrMissingIndicators 6 -#define _XkbErrMissingCompatMap 7 -#define _XkbErrMissingSymInterps 8 -#define _XkbErrMissingGeometry 9 -#define _XkbErrIllegalDoodad 10 -#define _XkbErrIllegalTOCType 11 -#define _XkbErrIllegalContents 12 -#define _XkbErrEmptyFile 13 -#define _XkbErrFileNotFound 14 -#define _XkbErrFileCannotOpen 15 -#define _XkbErrBadValue 16 -#define _XkbErrBadMatch 17 -#define _XkbErrBadTypeName 18 -#define _XkbErrBadTypeWidth 19 -#define _XkbErrBadFileType 20 -#define _XkbErrBadFileVersion 21 -#define _XkbErrBadFileFormat 22 -#define _XkbErrBadAlloc 23 -#define _XkbErrBadLength 24 -#define _XkbErrXReqFailure 25 -#define _XkbErrBadImplementation 26 - -extern char * _XkbErrMessages[]; -extern unsigned _XkbErrCode; -extern char * _XkbErrLocation; -extern unsigned _XkbErrData; - -/***====================================================================***/ - -_XFUNCPROTOBEGIN - -extern char * XkbIndentText( - unsigned /* size */ -); - -extern char * XkbAtomText( - Display * /* dpy */, - Atom /* atm */, - unsigned /* format */ -); - -extern char * XkbKeysymText( - KeySym /* sym */, - unsigned /* format */ -); - -extern char * XkbStringText( - char * /* str */, - unsigned /* format */ -); - -extern char * XkbKeyNameText( - char * /* name */, - unsigned /* format */ -); - -extern char * -XkbModIndexText( - unsigned /* ndx */, - unsigned /* format */ -); - -extern char * -XkbModMaskText( - unsigned /* mask */, - unsigned /* format */ -); - -extern char * XkbVModIndexText( - Display * /* dpy */, - XkbDescPtr /* xkb */, - unsigned /* ndx */, - unsigned /* format */ -); - -extern char * XkbVModMaskText( - Display * /* dpy */, - XkbDescPtr /* xkb */, - unsigned /* modMask */, - unsigned /* mask */, - unsigned /* format */ -); - -extern char * XkbConfigText( - unsigned /* config */, - unsigned /* format */ -); - -extern char * XkbSIMatchText( - unsigned /* type */, - unsigned /* format */ -); - -extern char * XkbIMWhichStateMaskText( - unsigned /* use_which */, - unsigned /* format */ -); - -extern char * XkbAccessXDetailText( - unsigned /* state */, - unsigned /* format */ -); - -extern char * XkbNKNDetailMaskText( - unsigned /* detail */, - unsigned /* format */ -); - -extern char * XkbControlsMaskText( - unsigned /* ctrls */, - unsigned /* format */ -); - -extern char * XkbGeomFPText( - int /* val */, - unsigned /* format */ -); - -extern char * XkbDoodadTypeText( - unsigned /* type */, - unsigned /* format */ -); - -extern char * XkbActionTypeText( - unsigned /* type */, - unsigned /* format */ -); - -extern char * XkbActionText( - Display * /* dpy */, - XkbDescPtr /* xkb */, - XkbAction * /* action */, - unsigned /* format */ -); - -extern char * XkbBehaviorText( - XkbDescPtr /* xkb */, - XkbBehavior * /* behavior */, - unsigned /* format */ -); - -/***====================================================================***/ - -#define _XkbKSLower (1<<0) -#define _XkbKSUpper (1<<1) - -#define XkbKSIsLower(k) (_XkbKSCheckCase(k)&_XkbKSLower) -#define XkbKSIsUpper(k) (_XkbKSCheckCase(k)&_XkbKSUpper) -#define XkbKSIsKeypad(k) (((k)>=XK_KP_Space)&&((k)<=XK_KP_Equal)) -#define XkbKSIsDeadKey(k) \ - (((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound)) - -extern unsigned _XkbKSCheckCase( - KeySym /* sym */ -); - -extern int XkbFindKeycodeByName( - XkbDescPtr /* xkb */, - char * /* name */, - Bool /* use_aliases */ -); - -extern Bool XkbLookupGroupAndLevel( - XkbDescPtr /* xkb */, - int /* key */, - int * /* mods_inout */, - int * /* grp_inout */, - int * /* lvl_rtrn */ -); - -/***====================================================================***/ - -#ifndef XKB_IN_SERVER - -extern Bool XkbLookupCanonicalRGBColor( - char * /* def */, - XColor * /* color */ -); - -#endif - -/***====================================================================***/ - -extern char * XkbAtomGetString( - Display * /* dpy */, - Atom /* atm */ -); - -extern Atom XkbInternAtom( - Display * /* dpy */, - char * /* name */, - Bool /* onlyIfExists */ -); - -extern Status XkbChangeKbdDisplay( - Display * /* newDpy */, - XkbFileInfo * /* result */ -); - -extern Atom XkbChangeAtomDisplay( - Display * /* oldDpy */, - Display * /* newDpy */, - Atom /* atm */ -); - -extern void XkbInitAtoms( - Display * /* dpy */ -); - -/***====================================================================***/ - -#ifdef _XKBGEOM_H_ - -#define XkbDW_Unknown 0 -#define XkbDW_Doodad 1 -#define XkbDW_Section 2 -typedef struct _XkbDrawable { - int type; - int priority; - union { - XkbDoodadPtr doodad; - XkbSectionPtr section; - } u; - struct _XkbDrawable * next; -} XkbDrawableRec,*XkbDrawablePtr; - -extern XkbDrawablePtr -XkbGetOrderedDrawables( - XkbGeometryPtr /* geom */, - XkbSectionPtr /* section */ -); - -extern void -XkbFreeOrderedDrawables( - XkbDrawablePtr /* draw */ -); - -#endif - -/***====================================================================***/ - -extern unsigned XkbConvertGetByNameComponents( - Bool /* toXkm */, - unsigned /* orig */ -); - -extern unsigned XkbConvertXkbComponents( - Bool /* toXkm */, - unsigned /* orig */ -); - -extern Bool XkbDetermineFileType( - XkbFileInfo * /* xkb */, - int /* format */, - int * /* opts_missing */ -); - -extern Bool XkbNameMatchesPattern( - char * /* name */, - char * /* pattern */ -); - -/***====================================================================***/ - -extern Bool XkbWriteXKBKeycodes( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBKeyTypes( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBCompatMap( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBSymbols( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBGeometry( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBSemantics( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBLayout( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBKeymap( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteXKBFile( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -); - -extern Bool XkbWriteCFile( - FILE * /* file */, - char * /* name */, - XkbFileInfo * /* info */ -); - -extern Bool XkbWriteXKMFile( - FILE * /* file */, - XkbFileInfo * /* result */ -); - -extern Bool XkbWriteToServer( - XkbFileInfo * /* result */ -); - -extern void XkbEnsureSafeMapName( - char * /* name */ -); - -extern Bool XkbWriteXKBKeymapForNames( - FILE * /* file */, - XkbComponentNamesPtr /* names */, - Display * /* dpy */, - XkbDescPtr /* xkb */, - unsigned /* want */, - unsigned /* need */ -); - -extern Status XkbMergeFile( - XkbDescPtr /* xkb */, - XkbFileInfo /* finfo */ -); - -/***====================================================================***/ - -extern Bool XkmProbe( - FILE * /* file */ -); - -extern unsigned XkbReadFromServer( - Display * /* dpy */, - unsigned /* need */, - unsigned /* want */, - XkbFileInfo * /* result */ -); - -extern unsigned XkmReadFile( - FILE * /* file */, - unsigned /* need */, - unsigned /* want */, - XkbFileInfo * /* result */ -); - -#ifdef _XKMFORMAT_H_ - -extern Bool XkmReadTOC( - FILE * /* file */, - xkmFileInfo * /* file_info */, - int /* max_toc */, - xkmSectionInfo * /* toc */ -); - -extern xkmSectionInfo *XkmFindTOCEntry( - xkmFileInfo * /* finfo */, - xkmSectionInfo * /* toc */, - unsigned /* type */ -); - -extern Bool XkmReadFileSection( - FILE * /* file */, - xkmSectionInfo * /* toc */, - XkbFileInfo * /* result */, - unsigned * /* loaded_rtrn */ -); - -extern char * XkmReadFileSectionName( - FILE * /* file */, - xkmSectionInfo * /* toc */ -); - -#endif /* _XKMFORMAT_H */ - -_XFUNCPROTOEND - -#endif /* _XKBFILE_H_ */ diff --git a/nx-X11/include/extensions/XKBrules.h b/nx-X11/include/extensions/XKBrules.h deleted file mode 100644 index 59d11cd88..000000000 --- a/nx-X11/include/extensions/XKBrules.h +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef _XKBRULES_H_ -#define _XKBRULES_H_ 1 - -/************************************************************ - Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. - - 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 Silicon Graphics not be - used in advertising or publicity pertaining to distribution - of the software without specific prior written permission. - Silicon Graphics makes no representation about the suitability - of this software for any purpose. It is provided "as is" - without any express or implied warranty. - - SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - GRAPHICS 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. - - ********************************************************/ - -/***====================================================================***/ - -typedef struct _XkbRF_VarDefs { - char * model; - char * layout; - char * variant; - char * options; - unsigned short sz_extra; - unsigned short num_extra; - char * extra_names; - char ** extra_values; -} XkbRF_VarDefsRec,*XkbRF_VarDefsPtr; - -typedef struct _XkbRF_VarDesc { - char * name; - char * desc; -} XkbRF_VarDescRec, *XkbRF_VarDescPtr; - -typedef struct _XkbRF_DescribeVars { - int sz_desc; - int num_desc; - XkbRF_VarDescPtr desc; -} XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr; - -typedef struct _XkbRF_Rule { - int number; - int layout_num; - int variant_num; - char * model; - char * layout; - char * variant; - char * option; - /* yields */ - char * keycodes; - char * symbols; - char * types; - char * compat; - char * geometry; - char * keymap; - unsigned flags; -} XkbRF_RuleRec,*XkbRF_RulePtr; - -typedef struct _XkbRF_Group { - int number; - char * name; - char * words; -} XkbRF_GroupRec, *XkbRF_GroupPtr; - -#define XkbRF_PendingMatch (1L<<1) -#define XkbRF_Option (1L<<2) -#define XkbRF_Append (1L<<3) -#define XkbRF_Normal (1L<<4) -#define XkbRF_Invalid (1L<<5) - -typedef struct _XkbRF_Rules { - XkbRF_DescribeVarsRec models; - XkbRF_DescribeVarsRec layouts; - XkbRF_DescribeVarsRec variants; - XkbRF_DescribeVarsRec options; - unsigned short sz_extra; - unsigned short num_extra; - char ** extra_names; - XkbRF_DescribeVarsPtr extra; - - unsigned short sz_rules; - unsigned short num_rules; - XkbRF_RulePtr rules; - unsigned short sz_groups; - unsigned short num_groups; - XkbRF_GroupPtr groups; -} XkbRF_RulesRec, *XkbRF_RulesPtr; - -/***====================================================================***/ - -_XFUNCPROTOBEGIN - -extern Bool XkbRF_GetComponents( - XkbRF_RulesPtr /* rules */, - XkbRF_VarDefsPtr /* var_defs */, - XkbComponentNamesPtr /* names */ -); - -extern XkbRF_RulePtr XkbRF_AddRule( - XkbRF_RulesPtr /* rules */ -); - -extern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr rules); - -extern Bool XkbRF_LoadRules( - FILE * /* file */, - XkbRF_RulesPtr /* rules */ -); - -extern Bool XkbRF_LoadRulesByName( - char * /* base */, - char * /* locale */, - XkbRF_RulesPtr /* rules */ -); - -/***====================================================================***/ - -extern XkbRF_VarDescPtr XkbRF_AddVarDesc( - XkbRF_DescribeVarsPtr /* vars */ -); - -extern XkbRF_VarDescPtr XkbRF_AddVarDescCopy( - XkbRF_DescribeVarsPtr /* vars */, - XkbRF_VarDescPtr /* copy_from */ -); - -extern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe( - XkbRF_RulesPtr /* rules */, - char * /* name */ -); - -extern Bool XkbRF_LoadDescriptions( - FILE * /* file */, - XkbRF_RulesPtr /* rules */ -); - -extern Bool XkbRF_LoadDescriptionsByName( - char * /* base */, - char * /* locale */, - XkbRF_RulesPtr /* rules */ -); - -extern XkbRF_RulesPtr XkbRF_Load( - char * /* base */, - char * /* locale */, - Bool /* wantDesc */, - Bool /* wantRules */ -); - -extern XkbRF_RulesPtr XkbRF_Create( - int /* sz_rules */, - int /* sz_extra */ -); - -/***====================================================================***/ - -extern void XkbRF_Free( - XkbRF_RulesPtr /* rules */, - Bool /* freeRules */ -); - - -/***====================================================================***/ - -#define _XKB_RF_NAMES_PROP_ATOM "_XKB_RULES_NAMES" -#define _XKB_RF_NAMES_PROP_MAXLEN 1024 - -#ifndef XKB_IN_SERVER - -extern Bool XkbRF_GetNamesProp( - Display * /* dpy */, - char ** /* rules_file_rtrn */, - XkbRF_VarDefsPtr /* var_defs_rtrn */ -); - -extern Bool XkbRF_SetNamesProp( - Display * /* dpy */, - char * /* rules_file */, - XkbRF_VarDefsPtr /* var_defs */ -); - -#endif - -_XFUNCPROTOEND - -#endif /* _XKBRULES_H_ */ diff --git a/nx-X11/include/extensions/XKBsrv.h b/nx-X11/include/extensions/XKBsrv.h index 81a07a588..6d369e2b2 100644 --- a/nx-X11/include/extensions/XKBsrv.h +++ b/nx-X11/include/extensions/XKBsrv.h @@ -1106,91 +1106,6 @@ extern void XkbSendNewKeyboardNotify( xkbNewKeyboardNotify * /* pNKN */ ); -#ifdef XKBSRV_NEED_FILE_FUNCS - -#include -#include -#include - -#define _XkbListKeymaps 0 -#define _XkbListKeycodes 1 -#define _XkbListTypes 2 -#define _XkbListCompat 3 -#define _XkbListSymbols 4 -#define _XkbListGeometry 5 -#define _XkbListNumComponents 6 - -typedef struct _XkbSrvListInfo { - int szPool; - int nPool; - char * pool; - - int maxRtrn; - int nTotal; - - char * pattern[_XkbListNumComponents]; - int nFound[_XkbListNumComponents]; -} XkbSrvListInfoRec,*XkbSrvListInfoPtr; - -char * -XkbGetRulesDflts( - XkbRF_VarDefsPtr /* defs */ -); - -extern void XkbSetRulesUsed( - XkbRF_VarDefsPtr /* defs */ -); - - -extern Status XkbDDXList( - DeviceIntPtr /* dev */, - XkbSrvListInfoPtr /* listing */, - ClientPtr /* client */ -); - -extern unsigned int XkbDDXLoadKeymapByNames( - DeviceIntPtr /* keybd */, - XkbComponentNamesPtr /* names */, - unsigned int /* want */, - unsigned int /* need */, - XkbFileInfoPtr /* finfoRtrn */, - char * /* keymapNameRtrn */, - int /* keymapNameRtrnLen */ -); - -extern Bool XkbDDXNamesFromRules( - DeviceIntPtr /* keybd */, - char * /* rules */, - XkbRF_VarDefsPtr /* defs */, - XkbComponentNamesPtr /* names */ -); - -extern FILE *XkbDDXOpenConfigFile( - char * /* mapName */, - char * /* fileNameRtrn */, - int /* fileNameRtrnLen */ -); - -extern Bool XkbDDXApplyConfig( - XPointer /* cfg_in */, - XkbSrvInfoPtr /* xkbi */ -); - -extern XPointer XkbDDXPreloadConfig( - char ** /* rulesFileRtrn */, - XkbRF_VarDefsPtr /* defs */, - XkbComponentNamesPtr /* names */, - DeviceIntPtr /* dev */ -); - -extern int _XkbStrCaseCmp( - char * /* str1 */, - char * /* str2 */ -); - -#endif /* XKBSRV_NEED_FILE_FUNCS */ - - _XFUNCPROTOEND #define XkbAtomGetString(d,s) NameForAtom(s) -- cgit v1.2.3 From 91925d70d901b180fffa1f40e0afafbc4b6c560e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 22:32:07 +0100 Subject: Clarify use of and need for mffs vs. ffs Backport of this xorg-xserver commit: commit 75c51c67b340548286efd41a53882e2acaf74ab5 Author: Alan Coopersmith Date: Thu Jun 18 09:49:12 2009 -0700 Clarify use of and need for mffs vs. ffs Signed-off-by: Alan Coopersmith --- nx-X11/programs/Xserver/os/WaitFor.c | 4 +++- nx-X11/programs/Xserver/os/connection.c | 2 +- nx-X11/programs/Xserver/os/osdep.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c index 3d53335b3..82462b926 100644 --- a/nx-X11/programs/Xserver/os/WaitFor.c +++ b/nx-X11/programs/Xserver/os/WaitFor.c @@ -106,6 +106,8 @@ static unsigned long startTimeInMillis; 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) @@ -480,7 +482,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; diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 8ebef9c33..4d30dd86f 100644 --- a/nx-X11/programs/Xserver/os/connection.c +++ b/nx-X11/programs/Xserver/os/connection.c @@ -908,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); -- cgit v1.2.3 From 8558e321f8cc27a7ecb0bc9db2ec87feed3cf877 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:57:24 +0100 Subject: dix: also compile ffs.c File was missing in Imakefile. We are not using the ffs function, but nevertheless it's a part of dix. --- nx-X11/programs/Xserver/dix/Imakefile | 2 ++ 1 file changed, 2 insertions(+) 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 \ -- cgit v1.2.3 From 679e11182c22bcb2408daf784d32586537a9580b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 13:49:22 +0100 Subject: Init.c Use dpmsstubs.c instead of an own copy Derived from commit 978f3b496b9951ee8120a0efcc5cd12503e26770 Author: Roland Mainz Date: Sat Mar 5 21:38:29 2005 +0000 xc/programs/Xserver/Imakefile xc/programs/Xserver/hw/xnest/Imakefile //bugs.freedesktop.org/show_bug.cgi?id=2653) attachment #2020 (https://bugs.freedesktop.org/attachment.cgi?id=2020): Cleanup Xnest usage of the DPMS dummy stub functions from dpmsstubs.c instead of using it's own copy of these functions. Fixes ArcticaProject/nx-libs#901 --- nx-X11/programs/Xserver/Xext/Imakefile | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Init.c | 25 ------------------------- 2 files changed, 2 insertions(+), 27 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/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index cf156c35f..b4d8a270c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -98,15 +98,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. */ @@ -625,19 +616,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 -- cgit v1.2.3 From 6d96798865838744966b897bca6cc2db2d6cfaff Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 14:03:54 +0100 Subject: Literals.h: always include in compilation This change ensures Literals.h is always referenced during compilation, effectively hiding it from "unused file" detection we do occasionally to clean up the source code. --- nx-X11/programs/Xserver/hw/nxagent/Literals.h | 3 ++- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 -- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 2 -- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 2 -- 4 files changed, 2 insertions(+), 7 deletions(-) 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 39aec075d..626584fc8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -162,9 +162,7 @@ void nxagentListRemoteFonts(const char *, int); #include "unistd.h" #endif -#ifdef TEST #include "Literals.h" -#endif #ifdef VIEWPORT_FRAME diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 76a375db2..cc5f08227 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. diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 83deb74c4..33f093ba2 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); -- cgit v1.2.3 From b7169bdcaf320e219dec23e79882176bc4b69d4c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 15:24:20 +0100 Subject: nxagent: make all traps Booleans and use True/False instead of 1/0 --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 20 ++++---- nx-X11/programs/Xserver/hw/nxagent/Events.c | 36 ++++++------- nx-X11/programs/Xserver/hw/nxagent/GC.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXglxext.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 8 +-- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 16 +++--- nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c | 8 +-- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 18 +++---- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Render.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/Trap.c | 70 +++++++++++--------------- nx-X11/programs/Xserver/hw/nxagent/Trap.h | 8 +++ 14 files changed, 100 insertions(+), 102 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 266ea86da..ba6d48fa5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -160,15 +160,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) { @@ -495,11 +495,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); @@ -839,9 +839,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned nxagentSynchronizeRegionStop: - nxagentSplitTrap = 0; + nxagentSplitTrap = False; - nxagentFBTrap = 0; + nxagentFBTrap = False; nxagentGCTrap = saveTrap; @@ -2412,7 +2412,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) int saveTrap = nxagentGCTrap; - nxagentGCTrap = 1; + nxagentGCTrap = True; if (nxagentDrawableStatus(pDrawable) == Synchronized) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index e0acf354f..73c5d7c36 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1142,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 @@ -1712,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 && @@ -2006,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; } } @@ -2037,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) @@ -2262,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)) @@ -2900,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; @@ -3199,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/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 9bce4af0d..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() \ 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/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index cc5f08227..bcb64edcd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -1766,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; } @@ -1793,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/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 33f093ba2..a38baac6a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -171,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; } @@ -439,11 +439,11 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) { PixmapPtr result; - nxagentShmPixmapTrap = 1; + nxagentShmPixmapTrap = True; result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr); - nxagentShmPixmapTrap = 0; + nxagentShmPixmapTrap = False; return result; } @@ -465,11 +465,11 @@ ProcShmDispatch (register ClientPtr client) } #endif - nxagentShmTrap = 1; + nxagentShmTrap = True; result = xorg_ProcShmDispatch(client); - nxagentShmTrap = 0; + nxagentShmTrap = False; return result; } @@ -488,11 +488,11 @@ SProcShmDispatch (register ClientPtr client) } #endif - nxagentShmTrap = 1; + nxagentShmTrap = True; 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..c1ca9bc2f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -157,7 +157,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 +773,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 +1095,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 +1124,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..515ffefa0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -340,7 +340,7 @@ void nxagentInitializeRecLossyLevel(void) void nxagentInitReconnector(void) { - nxagentReconnectTrap = 0; + nxagentReconnectTrap = False; reconnectLossyLevel[DISPLAY_STEP] = malloc(sizeof(int)); reconnectLossyLevel[SCREEN_STEP] = malloc(sizeof(int)); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 597392bf1..f38319858 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -532,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); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 77843b851..da386d845 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -341,9 +341,9 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) Mask mask = CWSibling | CWStackMode; values[0] = pWin -> drawable.id; ClientPtr pClient = wClient(toplevel[i]); - nxagentScreenTrap = 1; + nxagentScreenTrap = True; ConfigureWindow(toplevel[i], mask, values, pClient); - nxagentScreenTrap = 0; + nxagentScreenTrap = False; #ifdef TEST fprintf(stderr, "%s: Restacked window [%p].\n", __func__, (void*) toplevel[i]); 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 + /* - * 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. -- cgit v1.2.3 From afceb7ebaed13dd680a1acfb8354b736a1fd2cc3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 18:20:00 +0100 Subject: Dialog.c: show configured keystrokes in dialogs Instead of hardcoding the keystrokes in Dialog.h determine the currently configured keystrokes for the action and insert them into the dialog strings. Fixes ArcticaProject/nx-libs#438 --- nx-X11/programs/Xserver/hw/nxagent/Dialog.c | 26 ++++- nx-X11/programs/Xserver/hw/nxagent/Dialog.h | 19 ++-- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 129 ++++++++++++++++++++----- nx-X11/programs/Xserver/hw/nxagent/Keystroke.h | 3 + 4 files changed, 144 insertions(+), 33 deletions(-) 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 #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..2f503bc62 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h @@ -174,7 +174,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 +187,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 +204,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 +216,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 +228,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 +240,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/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index ea139b10f..2f89195f5 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 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 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 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 */ -- cgit v1.2.3 From ad0219fe573b417c77b9d01c4614eb07a3586578 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 19:43:30 +0100 Subject: README.md: remove embarassing planned release dates... --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index a46267c69..e1223d4cf 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,10 @@ This source tree is maintained on Github: https://github.com/ArcticaProject/nx-libs (3.6.x branch) For the the post-NoMachine era of nx-libs, we will focus on two release -phases for the upcoming two years (06/2015 - 06/2017). +phases for the upcoming two years. ## Release series 3.6.0.x -Scheduled for end of Q2/2016. - Release goals (phase 1) for nx-libs release series 3.6.0.x: * CVE security audit (complete) @@ -56,8 +54,6 @@ Release goals (phase 1) for nx-libs release series 3.6.0.x: ## Release series 3.7.0.x -Scheduled for end of Q2/2017. - Release goals (phase 2) for nx-libs release series 3.7.0.x (not branched-off, yet): * rebase Xserver code against latest X.Org server (work in progress) -- cgit v1.2.3 From fbf18cfdc8fc77f38fdf1559a8f1659f43ba9574 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 20:57:58 +0100 Subject: hw/nxagent/Imakefile: explain more macros and remove obsolete NX_SPLASH --- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index e37f97e84..128dc3764 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -190,34 +190,36 @@ 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) (default: nx_) +# NXAGENT_RANDR_MODE_PREFIX Prefix for RandR display modes (i.e., nx_x) (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= 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 value has no effect because the code uses +# NX_TRANS_WAKEUP in os/WaitFor.c instead. +# 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= -# NXAGENT_ONSTART -# NXAGENT_SPLASH -# NXAGENT_ARTSD # ### Debug macros: # # DEBUG_COLORMAP -# DEBUG_TREE +# DEBUG_TREE Include code that activates the keystroke to print the current window tree # NXAGENT_DEBUG # 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 +230,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 = \ -- cgit v1.2.3 From d282724c4abda9e59a029c2c485d7d046ff647db Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 21:59:58 +0100 Subject: os/Waitfor.c: simplify macro handling 1. indent ifdefs 2. add some logic at start that unset NX_TRANS_WAKEUP and NX_TRANS_DEBUG if NX_TRANS_SOCKET is unset. This way we only have to check for one macro and not all three. 3. remove redundant macro checks 4. decouple debug printfs by always running the original code and adding the identical check in #ifdef NX_TRANS_DEBUG --- nx-X11/programs/Xserver/os/WaitFor.c | 115 +++++++++++++++++------------------ 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c index 82462b926..c76f8619c 100644 --- a/nx-X11/programs/Xserver/os/WaitFor.c +++ b/nx-X11/programs/Xserver/os/WaitFor.c @@ -96,10 +96,21 @@ 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 @@ -171,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 */ @@ -224,44 +233,44 @@ 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 a short (NX_TRANS_WAKEUP) + * 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 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 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); -#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) { @@ -274,38 +283,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 " @@ -317,14 +321,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"); @@ -334,17 +338,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); @@ -352,31 +355,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) { @@ -398,18 +399,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) { @@ -490,9 +487,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; } -- cgit v1.2.3 From 92ac0d27737cf94e72208817cfd261a412a0e428 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 22:09:44 +0100 Subject: WaitFor.c Implement the intended NX_WAKEUP functionality NX_WAKEUP had been non-effective and its effect had been tied to NX_TRANS_WAKEUP. --- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 4 ++-- nx-X11/programs/Xserver/os/Imakefile | 2 +- nx-X11/programs/Xserver/os/WaitFor.c | 20 +++++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 128dc3764..6e412a0bb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -202,8 +202,8 @@ INCLUDES = \ # NXAGENT_ONSTART communicate about startup phase to the original nxclient by NoMachine via selections # NXAGENT_WAKEUP= 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 value has no effect because the code uses -# NX_TRANS_WAKEUP in os/WaitFor.c instead. +# 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 # 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 c76f8619c..9e887c726 100644 --- a/nx-X11/programs/Xserver/os/WaitFor.c +++ b/nx-X11/programs/Xserver/os/WaitFor.c @@ -237,13 +237,15 @@ WaitForSomething(int *pClientsReady) /* * If caller has marked the first element of pClientsReady[], - * bail out of select after a short (NX_TRANS_WAKEUP) - * 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 existing 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) @@ -257,7 +259,7 @@ WaitForSomething(int *pClientsReady) timeoutInMillis = GetTimeInMillis(); - if (timeoutInMillis - startTimeInMillis >= NX_TRANS_WAKEUP) + if (timeoutInMillis - startTimeInMillis >= pClientsReady[1]) { #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n"); @@ -265,7 +267,7 @@ WaitForSomething(int *pClientsReady) return 0; } - timeoutInMillis = NX_TRANS_WAKEUP - (timeoutInMillis - startTimeInMillis); + timeoutInMillis = pClientsReady[1] - (timeoutInMillis - startTimeInMillis); #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n", -- cgit v1.2.3 From 8199ec319f9bebc2a2407d6e5d38f87943b3382c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 12:18:41 +0100 Subject: Keystroke.c: fix typo make compilation work with -DNX_DEBUG_INPUT --- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index 2f89195f5..a2cb03379 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -647,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; -- cgit v1.2.3 From c135bbcfea95d7468c18a672266c98dffde8597f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 12:42:31 +0100 Subject: NXdixfonts.c: call dix version of SetDefaultFontPath --- nx-X11/programs/Xserver/dix/dixfonts.c | 6 +- nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 73 +------------------------ 2 files changed, 6 insertions(+), 73 deletions(-) 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/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index 992a6674f..2204ca60d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -99,7 +99,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. @@ -982,78 +982,9 @@ 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; -- cgit v1.2.3 From 4ad501b3f0b2d2176e7312e544ee4b330286a16e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 12:51:36 +0100 Subject: NXdixfonts.c: drop NXAGENT_DEBUG and use DEBUG like everywhere else. There were already some TEST lines using this scheme. Also indent DEBUG and TEST lines to make the code more readable --- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 1 - nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 70 ++++++++++++------------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 6e412a0bb..a713467ae 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -215,7 +215,6 @@ INCLUDES = \ # # DEBUG_COLORMAP # DEBUG_TREE Include code that activates the keystroke to print the current window tree -# NXAGENT_DEBUG # NXAGENT_FIXKEYS_DEBUG # NXAGENT_FONTCACHE_DEBUG # NXAGENT_FONTMATCH_DEBUG diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index 2204ca60d..4c288a18c 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]; @@ -116,17 +117,17 @@ static 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; } @@ -253,8 +254,9 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (void *) c); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] sleeping.\n", client); + #endif #endif } return TRUE; @@ -328,9 +330,9 @@ bail: if (c->slept) { ClientWakeup(c->client); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] wakeup.\n", client); -#endif + #endif } for (i = 0; i < c->num_fpes; i++) { FreeFPE(c->fpe_list[i]); @@ -403,9 +405,9 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont (1): client [%lx] sleeping.\n", client); -#endif + #endif } return TRUE; } @@ -460,12 +462,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); c->slept = TRUE; -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client); -#endif -#ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client); -#endif + #endif } return TRUE; } @@ -647,9 +647,9 @@ bail: if (c->slept) { ClientWakeup(client); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client); -#endif + #endif } for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); @@ -772,9 +772,9 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (1): client [%lx] sleeping.\n", client); -#endif + #endif } return TRUE; } @@ -800,9 +800,9 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (2): client [%lx] sleeping.\n", client); -#endif + #endif } return TRUE; } @@ -965,9 +965,9 @@ bail: if (c->slept) { ClientWakeup(client); -#ifdef NXAGENT_DEBUG + #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo: client [%lx] wakeup.\n", client); -#endif + #endif } for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); @@ -1055,9 +1055,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; } @@ -1090,9 +1090,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; } @@ -1115,9 +1115,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; } @@ -1283,9 +1283,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]); -- cgit v1.2.3 From aecebe41db40a2c62e9fca2b8f9c9b5f94e76941 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 13:56:47 +0100 Subject: NXdixfonts.c: mark NX changes Also add original code to make NX changes obvious. Also change some lines to match original code. --- nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 159 ++++++++++++++++-------- 1 file changed, 107 insertions(+), 52 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index 4c288a18c..f351f5c3b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -157,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. @@ -191,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) @@ -254,6 +256,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (void *) c); +#ifdef NXAGENT_SERVER #ifdef DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] sleeping.\n", client); #endif @@ -286,15 +289,22 @@ doOpenFont(ClientPtr client, OFclosurePtr c) pScr = screenInfo.screens[i]; if (pScr->RealizeFont) { - +#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; } } @@ -304,6 +314,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) err = AllocError; goto bail; } +#ifdef NXAGENT_SERVER if( nxagentFontPriv(pfont) -> mirrorID == 0 ) { extern RESTYPE RT_NX_FONT; @@ -315,12 +326,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) { @@ -328,12 +348,16 @@ bail: c->fontid, FontToXError(err)); } if (c->slept) +#ifdef NXAGENT_SERVER { ClientWakeup(c->client); #ifdef DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] wakeup.\n", client); #endif } +#else + ClientWakeup(c->client); +#endif for (i = 0; i < c->num_fpes; i++) { FreeFPE(c->fpe_list[i]); } @@ -355,7 +379,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) int nnames; int stringLens; int i; - xListFontsReply reply = {0}; + xListFontsReply reply; char *bufptr; char *bufferStart; int aliascount = 0; @@ -405,9 +429,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); +#ifdef NXAGENT_SERVER #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont (1): client [%lx] sleeping.\n", client); #endif +#endif } return TRUE; } @@ -462,10 +488,12 @@ 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); fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client); #endif +#endif } return TRUE; } @@ -593,13 +621,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 +645,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]; @@ -645,12 +679,16 @@ finish: bail: if (c->slept) +#ifdef NXAGENT_SERVER { - ClientWakeup(client); + ClientWakeup(client); #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client); #endif } +#else + ClientWakeup(client); +#endif for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); @@ -689,11 +727,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 +780,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) xFontProp *pFP; int i; int aliascount = 0; - xListFontsWithInfoReply finalReply = {0}; + xListFontsWithInfoReply finalReply; if (client->clientGone) { @@ -772,9 +818,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; +#ifdef NXAGENT_SERVER #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (1): client [%lx] sleeping.\n", client); #endif +#endif } return TRUE; } @@ -800,9 +848,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; +#ifdef NXAGENT_SERVER #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (2): client [%lx] sleeping.\n", client); #endif +#endif } return TRUE; } @@ -887,23 +937,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 +968,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 +1014,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 +1022,16 @@ finish: WriteSwappedDataToClient(client, length, &finalReply); bail: if (c->slept) +#ifdef NXAGENT_SERVER { ClientWakeup(client); #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo: client [%lx] wakeup.\n", client); #endif } +#else + ClientWakeup(client); +#endif for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->reply); @@ -991,17 +1054,12 @@ typedef struct OFclosurePtr oc; } nxFs,*nxFsPtr; +/* this is derived from doListFontsAndAliases */ 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; @@ -1009,7 +1067,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) @@ -1303,13 +1361,10 @@ finish: return doOpenFont(client, oc); } + +/* this is derived from 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; -- cgit v1.2.3 From f3856e9c750f82ae86dcf2e398926b6a1a7df66f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 19 Jan 2020 15:34:38 +0100 Subject: (NX)property.c: harmonize function name Use the "xorg_" prefix as everywhere else, not "Xorg_". --- nx-X11/programs/Xserver/dix/property.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index dc2f5b07f..fb751ed28 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -229,7 +229,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); } /***************** -- cgit v1.2.3 From bd6ff1949014852e1c9c00e9a6e5aca1ccdfe514 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 16:03:35 +0100 Subject: Screen.h: improve NXAGENT_ARTSD prototype definition --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 3 --- nx-X11/programs/Xserver/hw/nxagent/Screen.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 4d5132d01..bf4d415f1 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; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h index f74fd66b6..6d775e1cc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h @@ -138,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. -- cgit v1.2.3 From 07b9e9370ecb48efd474a1a14511f6f85a9af2f2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 08:10:57 +0100 Subject: NXdispatch.c: whitespace fix --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 626584fc8..f71b0342b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -417,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) -- cgit v1.2.3 From 8c5a3b8226a99e6b4c2e06bee1fa1ee31a4dcac3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 12 Jan 2020 17:12:41 +0100 Subject: NXdispatch.c: some cleanup --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 48 ++++++++++++------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index f71b0342b..8dc30bf57 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -800,12 +800,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, @@ -837,10 +837,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. */ @@ -849,7 +848,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 @@ -861,8 +860,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 } @@ -889,11 +888,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 @@ -911,12 +910,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, @@ -938,11 +937,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) @@ -961,8 +959,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 } -- cgit v1.2.3 From 5c90f28dbd53da73947bda561f74710c72f207ce Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 22:41:12 +0100 Subject: NXdispatch.c: fix invalid number of character '(' As reported by static analyzer. Attributes ArcticaProject/nx-libs#905 --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 8dc30bf57..27d962796 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -745,7 +745,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 || -- cgit v1.2.3 From 434d50853d65d79bd10f742e1f4c6fa4e9f0e3c6 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 23:33:08 +0100 Subject: NXdispatch.c, Reconnect.c: fix format specifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix these warnings with NX_DEBUG_INPUT enabled: NXdispatch.c: In function ‘Dispatch’: NXdispatch.c:350:74: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘CARD32’ {aka ‘unsigned int’} [-Wformat=] fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", ~~^ %u GetTimeAsString(), GetTimeInMillis()); Reconnect.c: In function ‘nxagentHandleConnectionStates’: Reconnect.c:303:74: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘CARD32’ {aka ‘unsigned int’} [-Wformat=] fprintf(stderr, "Session: Session suspended at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); ~~^ ~~~~~~~~~~~~~~~~~ %u Reconnect.c: In function ‘nxagentReconnectSession’: Reconnect.c:673:66: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘CARD32’ {aka ‘unsigned int’} [-Wformat=] fprintf(stderr, "Session: Session resumed at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); ~~^ ~~~~~~~~~~~~~~~~~ %u --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 27d962796..dc3b2dcd9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -345,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", diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 515ffefa0..9858924d3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -301,7 +301,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 @@ -674,7 +674,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 -- cgit v1.2.3 From 9b56675dd10aee122c2a6a0c2351b8199a4aa3ba Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 22:55:00 +0100 Subject: Rootless.c: fix common realloc mistake As reported by static analyzer: (error) Common realloc mistake: 'ptr' nulled but not freed upon failure Attributes ArcticaProject/nx-libs#905 --- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index da386d845..b0fda2fa2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -151,10 +151,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) { -- cgit v1.2.3 From 891f24c6521d8c84ab900810b85f41affba9a42e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 23:05:14 +0100 Subject: Display.c: fix common realloc mistake As reported by static analyzer: (error) Common realloc mistake: 'nxagentVisuals' nulled but not freed upon failure --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index c8ad891be..bc85d821d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -1494,8 +1494,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); -- cgit v1.2.3 From f09d3f52167c748083391bb489e591e78e494149 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 23:13:56 +0100 Subject: Display.c: fix implicit declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Display.c: In function ‘nxagentResetDisplayHandlers’: Display.c:901:5: warning: implicit declaration of function ‘nxagentReleaseAllSplits’; did you mean ‘nxagentWakeupBySplit’? [-Wimplicit-function-declaration] nxagentReleaseAllSplits(); ^~~~~~~~~~~~~~~~~~~~~~~ nxagentWakeupBySplit --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index bc85d821d..e3221fb4e 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 #include "compext/Compext.h" -- cgit v1.2.3 From 7a8eea1f187aa806d1f7df64ccaa5039f1b9140f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 23:30:50 +0100 Subject: NXproperty.c: fix implicit declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning with NX_DEBUG_INPUT: NXproperty.c: In function ‘ProcChangeProperty’: NXproperty.c:210:7: warning: implicit declaration of function ‘nxagentGuessDumpInputInfo’; did you mean ‘nxagentGuessClientHint’? [-Wimplicit-function-declaration] nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]); ^~~~~~~~~~~~~~~~~~~~~~~~~ nxagentGuessClientHint --- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index fb751ed28..24772119e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -101,6 +101,10 @@ extern WindowPtr nxagentGetClipboardWindow(Atom); extern Atom mcop_local_atom; #endif +#ifdef NX_DEBUG_INPUT +extern void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data); +#endif + int ProcChangeProperty(ClientPtr client) { -- cgit v1.2.3 From b4ef65d6693981617456cbf647453394abdb6cc5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 26 Jan 2020 00:57:52 +0100 Subject: NXresource.c: rework marked nx code Improve visibility by unindenting. Also move the ifdefs _before_ the according comments. Finally merge ifdefs to fewer blocks. --- nx-X11/programs/Xserver/hw/nxagent/NXresource.c | 90 ++++++++----------------- 1 file changed, 29 insertions(+), 61 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index e05b36877..5777f7bb9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -248,14 +248,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 +272,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; @@ -293,11 +291,9 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) 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 +309,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 +345,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 +377,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 +401,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 +418,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 +430,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 +451,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 +474,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 +493,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 +505,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 +526,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 } } } -- cgit v1.2.3 From 026ddd8e1a3aee5587fb1b71fbb4ab26c9d366ff Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 25 Jan 2020 22:47:57 +0100 Subject: NXresource.c: Fix uninitialized variable Static analyzer reported: (error) Uninitialized variable: elements Attributes ArcticaProject/nx-libs#905 --- nx-X11/programs/Xserver/hw/nxagent/NXresource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index 5777f7bb9..ca2175752 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -287,7 +287,7 @@ 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 -- cgit v1.2.3 From dfcb5d0b016f5d740aae5b1a877b91a0ab9bbc73 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 26 Jan 2020 00:59:57 +0100 Subject: NXresource.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/NXresource.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index ca2175752..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) -- cgit v1.2.3 From 5d2dbfaa2be7b4ccc24511edf103c43be5c38052 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 29 Jan 2020 22:23:54 +0100 Subject: Window.c: scope improvements plus some whitespace improvements --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 108 +++++++++++----------------- 1 file changed, 42 insertions(+), 66 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index a39cc035f..a3f3e411a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -764,10 +764,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 +783,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); @@ -1411,10 +1409,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) { @@ -1622,7 +1619,6 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) case ParentRelative: { attributes.background_pixmap = ParentRelative; - break; } case BackgroundPixmap: @@ -1665,7 +1661,6 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) case BackgroundPixel: { mask &= ~CWBackPixmap; - break; } } @@ -1987,8 +1982,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); @@ -2017,6 +2010,7 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) * so we need to clip ourselves. */ + RegionRec temp; RegionInit(&temp, NullBox, 1); RegionIntersect(&temp, pRegion, &pWin -> clipList); nxagentFrameBufferPaintWindow(pWin, &temp, what); @@ -2025,14 +2019,13 @@ 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. */ + RegionRec temp; RegionInit(&temp, NullBox, 1); RegionIntersect(&temp, pRegion, &pWin -> borderClip); nxagentFrameBufferPaintWindow(pWin, &temp, what); @@ -2148,8 +2141,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 +2172,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); @@ -2300,9 +2292,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 +2302,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 +2328,6 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) void nxagentShapeWindow(WindowPtr pWin) { - Region reg; - BoxPtr pBox; - if (NXDisplayError(nxagentDisplay) == 1) { return; @@ -2379,8 +2365,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 +2424,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++) @@ -2640,8 +2626,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 +2691,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 @@ -3061,7 +3046,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,11 +3055,11 @@ 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 @@ -3087,7 +3071,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 +3091,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 +3147,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 +3290,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 +3374,6 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) Bool nxagentIsIconic(WindowPtr pWin) { - int iReturn; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; Atom atomReturnType; @@ -3408,9 +3385,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 +3711,6 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence) { - StaticResizedWindowStruct *index; StaticResizedWindowStruct *ret = NULL; if (nxagentStaticResizedWindowList == NULL) @@ -3742,7 +3718,7 @@ StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence return NULL; } - index = nxagentStaticResizedWindowList; + StaticResizedWindowStruct *index = nxagentStaticResizedWindowList; while (index && index -> sequence > sequence) { -- cgit v1.2.3 From fba279d351740656f1cbf610405a802aebe5b7a9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 29 Jan 2020 22:47:21 +0100 Subject: NXproperty.c: fix comment/formatting --- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 24772119e..b55392690 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -451,7 +451,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 @@ -506,7 +506,6 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, pProp = pProp->next; } - if (!pProp) { #ifdef DEBUG -- cgit v1.2.3 From d1e91fae60721687943f622b910221da47df28d2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 29 Jan 2020 22:49:02 +0100 Subject: Windows.h, Window.c*: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 124 +++++++++++---------------- nx-X11/programs/Xserver/hw/nxagent/Windows.h | 38 ++++---- 2 files changed, 67 insertions(+), 95 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index a3f3e411a..a898f8592 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -99,8 +99,7 @@ Bool nxagentVisibilityStop = False; #undef DEBUG /* - * Useful to test the window configuration - * failures. + * Useful to test the window configuration failures. */ #ifdef TEST @@ -128,8 +127,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 +335,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 +412,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 +426,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 +478,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 +701,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; @@ -834,8 +827,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); @@ -879,8 +872,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); @@ -1165,11 +1158,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}; @@ -1624,10 +1616,9 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) 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. */ @@ -1645,8 +1636,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, @@ -1708,9 +1698,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) @@ -1719,8 +1708,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) { @@ -1762,8 +1750,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) { @@ -1789,9 +1776,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) { @@ -2005,9 +1991,8 @@ 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; @@ -2020,9 +2005,8 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { /* - * 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; @@ -2239,8 +2223,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; @@ -2567,9 +2551,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) @@ -2579,8 +2562,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, @@ -2756,9 +2738,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) @@ -2975,14 +2956,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)) @@ -3025,9 +3004,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)) @@ -3062,8 +3040,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer &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 && diff --git a/nx-X11/programs/Xserver/hw/nxagent/Windows.h b/nx-X11/programs/Xserver/hw/nxagent/Windows.h index aa4629b47..a5f20343b 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); -- cgit v1.2.3 From 762bfb50425428dddf5dd7df87836c52d21eb064 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 30 Jan 2020 22:45:18 +0100 Subject: nxagent: Fix double variables nxagentCorrupted* were defined twice! Fixes ArcticaProject/nx-libs#907 (1/3) --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 5 +++++ nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 3 --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 6 ------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index ba6d48fa5..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; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index c1ca9bc2f..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. */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index a898f8592..4885a1957 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -75,12 +75,6 @@ int nxagentWindowPrivateIndex; -/* - * Number of windows which need synchronization. - */ - -int nxagentCorruptedWindows; - /* * Used to track nxagent window's visibility. */ -- cgit v1.2.3 From fdde5b125fb514a3d1db5203bf468ab8e14157a4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 30 Jan 2020 22:46:40 +0100 Subject: nxagent: move variable definitions from headers to source files Fixes ArcticaProject/nx-libs#907 (2/3) --- nx-X11/programs/Xserver/hw/nxagent/Cursor.c | 2 ++ nx-X11/programs/Xserver/hw/nxagent/Cursor.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Visual.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Window.c | 3 +++ nx-X11/programs/Xserver/hw/nxagent/Windows.h | 3 --- 5 files changed, 7 insertions(+), 5 deletions(-) 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/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 4885a1957..e6b9c03df 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -83,6 +83,9 @@ int nxagentVisibility = VisibilityUnobscured; unsigned long nxagentVisibilityTimeout = 0; Bool nxagentVisibilityStop = False; +ConfiguredWindowStruct *nxagentConfiguredWindowList; +StaticResizedWindowStruct *nxagentStaticResizedWindowList; + /* * Set here the required log level. */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Windows.h b/nx-X11/programs/Xserver/hw/nxagent/Windows.h index a5f20343b..8666ebec9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Windows.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Windows.h @@ -288,7 +288,6 @@ typedef struct _ConfiguredWindow unsigned int valuemask; } ConfiguredWindowStruct; -ConfiguredWindowStruct *nxagentConfiguredWindowList; typedef struct _StaticResizedWindow { @@ -300,8 +299,6 @@ typedef struct _StaticResizedWindow int offY; } StaticResizedWindowStruct; -StaticResizedWindowStruct *nxagentStaticResizedWindowList; - void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); void nxagentFlushConfigureWindow(void); -- cgit v1.2.3 From 042f848875f04f1c28cf9692ff13a1847013c10a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 1 Feb 2020 13:31:59 +0100 Subject: dixfont.h: add missing extern Fixes ArcticaProject/nx-libs#907 (3/3) --- nx-X11/programs/Xserver/include/dixfont.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ -- cgit v1.2.3 From e9f628fd250dc943f2d7ae5005f790c7f6a27b5f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Feb 2020 19:06:33 +0100 Subject: XlibInt.c: simplify handling of NX_TRANS_{CHANGE,DEBUG} macros --- nx-X11/lib/src/XlibInt.c | 85 +++++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/nx-X11/lib/src/XlibInt.c b/nx-X11/lib/src/XlibInt.c index 36e650193..02c1394d2 100644 --- a/nx-X11/lib/src/XlibInt.c +++ b/nx-X11/lib/src/XlibInt.c @@ -142,6 +142,17 @@ static struct timeval retry; extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); #endif +#else +/* + * unifdef to simplify subsequent checks. IF NX_TRANS_CHANGE is set it + * is safe to assume NX_TRANS_SOCKET is also set. Same for NX_TRANS_DEBUG. + */ +# ifdef NX_TRANS_CHANGE +# undef NX_TRANS_CHANGE +# endif +# ifdef NX_TRANS_DEBUG +# undef NX_TRANS_DEBUG +# endif #endif /* #ifdef NX_TRANS_SOCKET */ /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX @@ -434,15 +445,15 @@ _XWaitForWritable( #endif /* #ifdef NX_TRANS_SOCKET */ UnlockDisplay(dpy); #ifdef USE_POLL -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XWaitForWritable: Calling poll().\n"); #endif nfound = poll (&filedes, 1, -1); #else /* USE_POLL */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XWaitForWritable: Calling select() after [%ld] ms.\n", NXTransTime()); -#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ +#endif /* ifdef NX_TRANS_DEBUG */ #ifdef NX_TRANS_SOCKET /* * Give a chance to the callback to detect @@ -460,7 +471,7 @@ _XWaitForWritable( #else /* NX_TRANS_SOCKET */ nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); #endif /* NX_TRANS_SOCKET */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XWaitForWritable: Out of select() with [%d] after [%ld] ms.\n", nfound, NXTransTime()); @@ -479,16 +490,16 @@ _XWaitForWritable( fprintf(stderr, "_XWaitForWritable: Descriptor [%d] has become writable.\n\n", dpy->fd); } -#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ +#endif /* ifdef NX_TRANS_DEBUG */ #endif /* USE_POLL */ InternalLockDisplay(dpy, cv != NULL); #ifdef NX_TRANS_SOCKET -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } -#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) */ +#endif /* ifdef NX_TRANS_CHANGE */ if (nfound <= 0) { if ((nfound == -1 && !(ECHECK(EINTR) || ETEST())) || (_NXDisplayErrorFunction != NULL && @@ -681,7 +692,7 @@ _XWaitForReadable( int highest_fd = fd; #endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE int congestion; #endif #ifdef NX_TRANS_SOCKET @@ -721,14 +732,14 @@ _XWaitForReadable( #endif /* USE_POLL */ UnlockDisplay(dpy); #ifdef USE_POLL -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XWaitForReadable: Calling poll().\n"); #endif result = poll(filedes, (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length, -1); #else /* USE_POLL */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XWaitForReadable: Calling select().\n"); #endif #ifdef NX_TRANS_SOCKET @@ -757,12 +768,12 @@ _XWaitForReadable( result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); #endif /* NX_TRANS_SOCKET */ #endif /* USE_POLL */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XWaitForReadable: Out of select with result [%d] and errno [%d].\n", result, (result < 0 ? errno : 0)); #endif InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); @@ -971,11 +982,11 @@ static void _XFlushInt( register int write_stat; register char *bufindex; _XExtension *ext; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE int congestion; #endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n", (dpy->bufptr - dpy->buffer)); #endif @@ -986,7 +997,7 @@ static void _XFlushInt( */ if (dpy->flags & XlibDisplayIOError) { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); #endif dpy->bufptr = dpy->buffer; @@ -1124,7 +1135,7 @@ _XEventsQueued( if (dpy->qlen) return(dpy->qlen); } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG if (dpy->flags & XlibDisplayIOError) { fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n", dpy->qlen); @@ -1170,7 +1181,7 @@ _XEventsQueued( } #endif /* XTHREADS*/ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n"); #endif if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) @@ -1199,14 +1210,14 @@ _XEventsQueued( dpy->conn_checker = 0; #ifdef USE_POLL -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XEventsQueued: Calling poll().\n"); #endif filedes.fd = dpy->fd; filedes.events = POLLIN; if ((result = poll(&filedes, 1, 0))) #else -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XEventsQueued: Calling select().\n"); #endif FD_ZERO(&r_mask); @@ -1254,7 +1265,7 @@ _XEventsQueued( { UnlockNextEventReader(dpy); } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); #endif return(dpy->qlen); @@ -1450,7 +1461,7 @@ void _XReadEvents( #ifdef NX_TRANS_SOCKET if (dpy->flags & XlibDisplayIOError) { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n"); #endif return; @@ -1536,14 +1547,14 @@ int _XRead( #ifdef XTHREADS int original_size = size; #endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE int congestion; #endif if ((dpy->flags & XlibDisplayIOError) || size == 0) return 0; ESET(0); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE while (1) { /* * Need to check the congestion state @@ -1664,7 +1675,7 @@ void _XReadPad( #ifdef XTHREADS int original_size; #endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE int congestion; #endif @@ -1684,7 +1695,7 @@ void _XReadPad( original_size = size; #endif ESET(0); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE while (1) { bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2); if (_NXDisplayCongestionFunction != NULL && @@ -1782,12 +1793,12 @@ _XSend ( long skip, dbufsize, padsize, total, todo; _XExtension *ext; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) +#ifdef NX_TRANS_CHANGE int congestion; #endif #ifdef NX_TRANS_SOCKET -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", (dpy->bufptr - dpy->buffer)); #endif @@ -1795,7 +1806,7 @@ _XSend ( { if (dpy->flags & XlibDisplayIOError) { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XSend: Returning with I/O error detected.\n"); #endif dpy->bufptr = dpy->buffer; @@ -2145,7 +2156,7 @@ _XReply ( #ifdef XTHREADS struct _XCVList *cvl; #endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XReply: Going to wait for an X reply.\n"); #endif @@ -2176,7 +2187,7 @@ _XReply ( XThread_Self(), cvl); #endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XReply: Going to flush the display buffer.\n"); #endif _XFlushInt(dpy, cvl ? cvl->cv : NULL); @@ -2476,7 +2487,7 @@ _XRegisterInternalConnection( struct _XConnWatchInfo *watchers; XPointer *wd; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XRegisterInternalConnection: Got called.\n"); #endif new_conni = Xmalloc(sizeof(struct _XConnectionInfo)); @@ -2526,7 +2537,7 @@ _XUnregisterInternalConnection( struct _XConnWatchInfo *watch; XPointer *wd; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n"); #endif for (prev = &dpy->im_fd_info; (info_list = *prev); @@ -2567,7 +2578,7 @@ XInternalConnectionNumbers( struct _XConnectionInfo *info_list; int *fd_list; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "XInternalConnectionNumbers: Got called.\n"); #endif LockDisplay(dpy); @@ -2628,7 +2639,7 @@ XProcessInternalConnection( { struct _XConnectionInfo *info_list; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "XProcessInternalConnection: Got called.\n"); #endif @@ -2660,7 +2671,7 @@ XAddConnectionWatch( struct _XConnectionInfo *info_list; XPointer *wd_array; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "XAddConnectionWatch: Got called.\n"); #endif LockDisplay(dpy); @@ -2719,7 +2730,7 @@ XRemoveConnectionWatch( struct _XConnectionInfo *conni; int counter = 0; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "XRemoveConnectionWatch: Got called.\n"); #endif LockDisplay(dpy); @@ -2760,7 +2771,7 @@ void _XEatData( #define SCRATCHSIZE 2048 char buf[SCRATCHSIZE]; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#ifdef NX_TRANS_DEBUG fprintf(stderr, "_XEatData: Going to eat [%ld] bytes of data from descriptor [%d].\n", n, dpy->fd); #endif -- cgit v1.2.3 From 17ab45b921c2e17437d585cb3e9d62ca73ab04c5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Feb 2020 19:15:31 +0100 Subject: XlibInt.c: reformat some comments --- nx-X11/lib/src/XlibInt.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/nx-X11/lib/src/XlibInt.c b/nx-X11/lib/src/XlibInt.c index 02c1394d2..0c27f34da 100644 --- a/nx-X11/lib/src/XlibInt.c +++ b/nx-X11/lib/src/XlibInt.c @@ -128,14 +128,12 @@ xthread_t (*_Xthread_self_fn)(void) = NULL; static struct timeval retry; /* - * From Xtranssock.c. Presently the congestion state - * is reported by the proxy to the application, by - * invoking the callback directly. The function will - * be possibly used in the future, to be able to track - * the bandwidth usage even when the NX transport is - * not running. Note that in this sample implementation - * the congestion state is checked very often and can - * be surely optimized. + * From Xtranssock.c. Presently the congestion state is reported by + * the proxy to the application, by invoking the callback + * directly. The function will be possibly used in the future, to be + * able to track the bandwidth usage even when the NX transport is not + * running. Note that in this sample implementation the congestion + * state is checked very often and can be surely optimized. */ #ifdef NX_TRANS_CHANGE @@ -2207,9 +2205,8 @@ _XReply ( #ifdef NX_TRANS_SOCKET /* - * We are going to block waiting for the remote - * X server. Be sure that the proxy has flushed - * all the data. + * We are going to block waiting for the remote X server. Be sure + * that the proxy has flushed all the data. */ #ifdef NX_TRANS_TEST @@ -2283,8 +2280,8 @@ _XReply ( UnlockNextReplyReader(dpy); #ifdef NX_TRANS_SOCKET /* - * The original code has provision - * for returning already. + * The original code has provision for returning + * already. */ #endif _XIOError (dpy); @@ -2413,8 +2410,7 @@ _XAsyncReply( #ifdef NX_TRANS_SOCKET /* - * The original code has provision - * for returning already. + * The original code has provision for returning already. */ #endif @@ -3726,11 +3722,10 @@ _XIOError ( _XDefaultIOError(dpy); #ifdef NX_TRANS_SOCKET /* - * Check if we are supposed to return in the case - * of a display failure. The client which originated - * the X operation will have to check the value of - * the XlibDisplayIOError flag and handle appropria- - * tely the display disconnection. + * Check if we are supposed to return in the case of a display + * failure. The client which originated the X operation will have + * to check the value of the XlibDisplayIOError flag and handle + * appropriately the display disconnection. */ if (_NXHandleDisplayError == 0) -- cgit v1.2.3 From 52a458282a50bf54b54eacf071a15a26ab6e8547 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Feb 2020 19:15:47 +0100 Subject: XlibInt.c: simplify NX code insertion --- nx-X11/lib/src/XlibInt.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/nx-X11/lib/src/XlibInt.c b/nx-X11/lib/src/XlibInt.c index 0c27f34da..5a481c9ab 100644 --- a/nx-X11/lib/src/XlibInt.c +++ b/nx-X11/lib/src/XlibInt.c @@ -530,7 +530,6 @@ _XWaitForWritable( #ifdef NX_TRANS_SOCKET { _XIOError(dpy); - return; } #else /* NX_TRANS_SOCKET */ @@ -996,7 +995,7 @@ static void _XFlushInt( if (dpy->flags & XlibDisplayIOError) { #ifdef NX_TRANS_DEBUG - fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); + fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); #endif dpy->bufptr = dpy->buffer; dpy->last_req = (char *)&_dummy_request; @@ -1186,7 +1185,6 @@ _XEventsQueued( #ifdef NX_TRANS_SOCKET { _XIOError(dpy); - return (dpy->qlen); } #else @@ -1229,7 +1227,6 @@ _XEventsQueued( #ifdef NX_TRANS_SOCKET { _XIOError(dpy); - return (dpy->qlen); } #else @@ -1591,12 +1588,10 @@ int _XRead( else if (bytes_read == 0) { /* Read failed because of end of file! */ ESET(EPIPE); -#ifdef NX_TRANS_SOCKET - _XIOError(dpy); - return -1; -#else _XIOError(dpy); +#ifdef NX_TRANS_SOCKET + return -1; #endif } @@ -1797,8 +1792,8 @@ _XSend ( #ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_DEBUG - fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", - (dpy->bufptr - dpy->buffer)); + fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", + (dpy->bufptr - dpy->buffer)); #endif if (!size || (dpy->flags & XlibDisplayIOError)) { -- cgit v1.2.3 From f3473e38ca4b4132303cb76e06fe06889ae5c131 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 5 Feb 2020 23:56:08 +0100 Subject: XlibInt.c: scope improvements/reformat --- nx-X11/lib/src/XlibInt.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/nx-X11/lib/src/XlibInt.c b/nx-X11/lib/src/XlibInt.c index 5a481c9ab..bd97ed0bc 100644 --- a/nx-X11/lib/src/XlibInt.c +++ b/nx-X11/lib/src/XlibInt.c @@ -263,28 +263,22 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set t_readfds, t_writefds; struct timeval t_timeout; - int n, r, e; - #ifdef NX_TRANS_TEST - if (exceptfds != NULL) { fprintf(stderr, "_XSelect: WARNING! Can't handle exception fds in select.\n"); } - #endif if (readfds == NULL) { FD_ZERO(&t_readfds); - readfds = &t_readfds; } if (writefds == NULL) { FD_ZERO(&t_writefds); - writefds = &t_writefds; } @@ -292,11 +286,10 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, { t_timeout.tv_sec = 10; t_timeout.tv_usec = 0; - timeout = &t_timeout; } - n = maxfds; + int n = maxfds; /* * If the transport is gone avoid @@ -305,17 +298,17 @@ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, if (NXTransPrepare(&n, readfds, writefds, timeout) != 0) { - NXTransSelect(&r, &e, &n, readfds, writefds, timeout); + int r, e; - NXTransExecute(&r, &e, &n, readfds, writefds, timeout); + NXTransSelect(&r, &e, &n, readfds, writefds, timeout); + NXTransExecute(&r, &e, &n, readfds, writefds, timeout); + errno = e; - errno = e; - - return r; + return r; } else { - return 0; + return 0; } } else -- cgit v1.2.3 From ab1e10197774d0f0dfa4cf06ce1ef94442d50833 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 12 Feb 2020 23:21:25 +0100 Subject: NX.h: Add missing NX_CHANNEL_SLAVE type to description --- nxcomp/include/NX.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nxcomp/include/NX.h b/nxcomp/include/NX.h index 7ec79b4b1..cc1cfb280 100644 --- a/nxcomp/include/NX.h +++ b/nxcomp/include/NX.h @@ -341,6 +341,9 @@ extern int NXTransFlush(int fd); * NX_CHANNEL_FONT: The channel will forward a X font server * connection. * + * NX_CHANNEL_SLAVE: The channel will forward data to a remote slave + * command (see NX_SLAVE_CMD envrionment variable) + * * Only a proxy running at the NX server/X client side will be able * to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy running * at the NX client/X server side can create font server connections. -- cgit v1.2.3 From 32930b9b77e542e59a24356d17e621893b5962ad Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 21:32:10 +0100 Subject: Clipboard.c: rearrange Atoms in debugging output ensure same order for internal and external Atoms --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 1d5054fbb..12473344f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -359,6 +359,8 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, "Atoms (server side)\n"); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS); fprintf(stderr, " serverTARGETS [% 4d][%s]\n", serverTARGETS, validateString(s)); + SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); + fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTEXT); fprintf(stderr, " serverTEXT [% d][%s]\n", serverTEXT, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverCOMPOUND_TEXT); @@ -370,9 +372,6 @@ void nxagentPrintClipboardStat(char *header) 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, "Atoms (inside nxagent)\n"); fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS)); fprintf(stderr, " clientTIMESTAMP [% 4d][%s]\n", clientTIMESTAMP, NameForAtom(clientTIMESTAMP)); -- cgit v1.2.3 From ebe5f05cb02bb306665aa7e512988837ad4920a4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 21:34:10 +0100 Subject: Clipboard.c: use validateString in debugging output --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 12473344f..7f1fef982 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -331,9 +331,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) [% 4d][%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) [% 4d][%s]\n", lastServerTarget, validateString(s)); fprintf(stderr, " lastServerTime (Time) [%u]\n", lastServerTime); fprintf(stderr, "lastClient\n"); @@ -360,17 +360,17 @@ void nxagentPrintClipboardStat(char *header) SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS); fprintf(stderr, " serverTARGETS [% 4d][%s]\n", serverTARGETS, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); - fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s); + fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTEXT); - fprintf(stderr, " serverTEXT [% d][%s]\n", serverTEXT, s); + fprintf(stderr, " serverTEXT [% d][%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 [% d][%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 [% 4d][%s]\n", serverUTF8_STRING, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransToAgentProperty); - fprintf(stderr, " serverTransToAgentProperty [% 4d][%s]\n", serverTransFromAgentProperty, s); + fprintf(stderr, " serverTransToAgentProperty [% 4d][%s]\n", serverTransFromAgentProperty, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty); - fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, s); + fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, validateString(s)); fprintf(stderr, "Atoms (inside nxagent)\n"); fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS)); -- cgit v1.2.3 From 2e18dff8b4cd55a1447470fa999c3cfa367af483 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 21:38:08 +0100 Subject: Clipboard.c: fix compilation with DEBUG --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 7f1fef982..5a0fa0460 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -188,7 +188,9 @@ const char * GetClientSelectionStageString(int stage) #else #define SetClientSelectionStage(stage) do {lastClientStage = SelectionStage##stage;} while (0) #define PrintClientSelectionStage() +#endif +#ifdef DEBUG /* * see also nx-X11/lib/src/ErrDes.c * -- cgit v1.2.3 From dd74cad8385e43577d41f21f49f6e34969ad9adb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 21:38:36 +0100 Subject: Clipboard.c: rename nxagentLastRequestedSelection and correctly print its value in debugging output --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 5a0fa0460..ecad84d5c 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) @@ -373,6 +373,8 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, " serverTransToAgentProperty [% 4d][%s]\n", serverTransFromAgentProperty, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty); fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, validateString(s)); + SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverLastRequestedSelection); + fprintf(stderr, " serverLastRequestedSelection [% 4d][%s]\n", serverLastRequestedSelection, validateString(s)); fprintf(stderr, "Atoms (inside nxagent)\n"); fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS)); @@ -382,7 +384,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"); @@ -887,7 +888,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); @@ -2112,7 +2113,7 @@ 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) -- cgit v1.2.3 From c889c27deea49e3a87323ec4963f410d736b02fa Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 21:42:44 +0100 Subject: Clipboard.c: fix/improve debugging output --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index ecad84d5c..6b7a289bc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -276,18 +276,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 [% 4d][%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, @@ -358,7 +351,7 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, "CLIPBOARD\n"); nxagentPrintSelectionStat(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)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); -- cgit v1.2.3 From d2f66923a5e97a260e40919dc942b8a061e521db Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 21:48:08 +0100 Subject: Clipboard.c: fix some format specifiers --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 6b7a289bc..f906c8e60 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -279,7 +279,7 @@ void nxagentPrintSelectionStat(int sel) print the selection name. selection is _always_ a a remote Atom! */ SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lOwner.selection); - fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (%s)\n", lOwner.selection, validateString(s), lOwner.client ? "inside nxagent" : "remote X server"); + 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", @@ -326,9 +326,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, validateString(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, validateString(s)); + fprintf(stderr, " lastServerTarget (Atom) [% 4ld][%s]\n", lastServerTarget, validateString(s)); fprintf(stderr, " lastServerTime (Time) [%u]\n", lastServerTime); fprintf(stderr, "lastClient\n"); @@ -353,21 +353,21 @@ void nxagentPrintClipboardStat(char *header) 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 [% 4d][%s]\n", serverTIMESTAMP, validateString(s)); + fprintf(stderr, " serverTIMESTAMP [% 4ld][%s]\n", serverTIMESTAMP, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTEXT); - fprintf(stderr, " serverTEXT [% d][%s]\n", serverTEXT, validateString(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, validateString(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, validateString(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, validateString(s)); + fprintf(stderr, " serverTransToAgentProperty [% 4ld][%s]\n", serverTransFromAgentProperty, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty); - fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, validateString(s)); + fprintf(stderr, " serverTransFromAgentProperty [% 4ld][%s]\n", serverTransToAgentProperty, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverLastRequestedSelection); - fprintf(stderr, " serverLastRequestedSelection [% 4d][%s]\n", serverLastRequestedSelection, validateString(s)); + fprintf(stderr, " serverLastRequestedSelection [% 4ld][%s]\n", serverLastRequestedSelection, validateString(s)); fprintf(stderr, "Atoms (inside nxagent)\n"); fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS)); @@ -519,7 +519,7 @@ 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; } @@ -1425,7 +1425,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, @@ -1929,7 +1929,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, @@ -1938,7 +1938,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 @@ -2112,7 +2112,7 @@ WindowPtr nxagentGetClipboardWindow(Atom property) 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 -- cgit v1.2.3 From c0e8cb06943e1a7c6bf280fbd2cee71757349b91 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 22:01:30 +0100 Subject: Clipboard.c: print if selection owner is inside nagent in debugging output --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index f906c8e60..074219097 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -257,6 +257,7 @@ void nxagentPrintSelectionStat(int 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, -- cgit v1.2.3 From a92467f3c69d5d68190308fc6ce87a4c38ce8e76 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 22:10:47 +0100 Subject: Clipboard.h: add missing externs --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h index a7d22ab97..96821b482 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h @@ -61,9 +61,15 @@ 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 nxagentClearSelection(XEvent *X); +extern void nxagentRequestSelection(XEvent *X); +extern void nxagentHandleSelectionNotifyFromXServer(XEvent *X); +#else +extern void nxagentClearSelection(); +extern void nxagentRequestSelection(); +extern void nxagentHandleSelectionNotifyFromXServer(); +#endif -int nxagentFindCurrentSelectionIndex(Atom sel); +extern int nxagentFindCurrentSelectionIndex(Atom sel); #endif /* __Clipboard_H__ */ -- cgit v1.2.3 From 96bd8748a0745e864fc96cfdc4a0f406f0d44032 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 22:11:40 +0100 Subject: Clipboard.h: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h index 96821b482..e802a9929 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h @@ -41,18 +41,15 @@ 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); -- cgit v1.2.3 From c6aed6ad1db4d6bb01c5c5f8f53e5f2d42d443bb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 23:22:52 +0100 Subject: Clipboard.c: clear windowPtr in ClearSelectionOwner There were two location where the windowPtr was not cleared after calling ClearSelectionOwner(). One was nxagentInitClipboard where it was set to NULL before and the second one was nxagentClearSelection() where it really should be reset. So we can safely move this to where it really belongs. --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 074219097..4ccd2e45c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -539,8 +539,8 @@ void nxagentClearSelectionOwner(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) @@ -579,9 +579,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) (void *) pClient, (void *) pWindow); #endif - /* FIXME: why is windowPtr not cleared in the function? */ nxagentClearSelectionOwner(i); - lastSelectionOwner[i].windowPtr = NULL; lastClientWindowPtr = NULL; SetClientSelectionStage(None); @@ -1510,7 +1508,6 @@ void nxagentResetSelectionOwner(void) #endif nxagentClearSelectionOwner(i); - lastSelectionOwner[i].windowPtr = NULL; } lastClientWindowPtr = NULL; -- cgit v1.2.3 From 34109b856807a264e40aa7a87b3963e876ce3bbf Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Feb 2020 23:39:02 +0100 Subject: Clipboard.c: deactivate unused code For now deactivate nxagentResetSelectionOwner. Must do some research before removing it completely. --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 4ccd2e45c..302181b5e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -238,7 +238,9 @@ static void endTransfer(Bool success); #define SELECTION_FAULT False void nxagentTransferSelection(int resource); void nxagentCollectPropertyEvent(int resource); +#if 0 void nxagentResetSelectionOwner(void); +#endif WindowPtr nxagentGetClipboardWindow(Atom property); void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, Atom selection, Atom target, Time time); @@ -1473,6 +1475,8 @@ 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 @@ -1516,6 +1520,7 @@ void nxagentResetSelectionOwner(void) /* Hmm, this is already None when reaching this */ lastServerRequestor = None; } +#endif #ifdef NXAGENT_CLIPBOARD -- cgit v1.2.3 From fad1b5f0c9a819b500b1c7a82dc0a87c6a296e2f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 14 Feb 2020 00:13:08 +0100 Subject: Clipboard.{c,h}: cleanup prototypes --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 22 ++++++++++------------ nx-X11/programs/Xserver/hw/nxagent/Clipboard.h | 11 ++++++++++- nx-X11/programs/Xserver/hw/nxagent/Events.h | 7 ------- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 6 +----- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 5 +---- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 302181b5e..b456b7113 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -232,19 +232,17 @@ XFixesAgentInfoRec nxagentXFixesInfo = { -1, -1, -1, 0 }; extern Display *nxagentDisplay; -Bool nxagentValidServerTargets(XlibAtom target); +static Bool nxagentValidServerTargets(XlibAtom target); static void endTransfer(Bool success); #define SELECTION_SUCCESS True #define SELECTION_FAULT False -void nxagentTransferSelection(int resource); -void nxagentCollectPropertyEvent(int resource); +static void nxagentTransferSelection(int resource); #if 0 void nxagentResetSelectionOwner(void); #endif -WindowPtr nxagentGetClipboardWindow(Atom property); -void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, - Atom selection, Atom target, Time time); -int nxagentSendNotify(xEvent *event); +static void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, + Atom selection, Atom target, Time time); +static void nxagentSetSelectionOwner(Selection *pSelection); void nxagentPrintClipboardStat(char *); @@ -475,7 +473,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 nxagentValidServerTargets(XlibAtom target) { if (target == XA_STRING) { @@ -1012,7 +1010,7 @@ static void endTransfer(Bool success) SetClientSelectionStage(None); } -void nxagentTransferSelection(int resource) +static void nxagentTransferSelection(int resource) { if (lastClientClientPtr -> index != resource) { @@ -1603,7 +1601,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 nxagentSetSelectionOwner(Selection *pSelection) { if (!agentClipboardInitialized) { @@ -1687,8 +1685,8 @@ FIXME */ } -void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, - Atom selection, Atom target, Time time) +static void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, + Atom selection, Atom target, Time time) { /* * Check if the client is still valid. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h index e802a9929..e34150986 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h @@ -54,7 +54,6 @@ extern Bool nxagentInitClipboard(WindowPtr pWindow); 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); @@ -69,4 +68,14 @@ 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); + #endif /* __Clipboard_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h index 6df5725d4..1f64279d9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h @@ -149,13 +149,6 @@ 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. 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/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index b55392690..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,10 +94,6 @@ nxagentWMStateRec; #undef TEST #undef DEBUG -#ifdef NXAGENT_CLIPBOARD -extern WindowPtr nxagentGetClipboardWindow(Atom); -#endif - #ifdef NXAGENT_ARTSD extern Atom mcop_local_atom; #endif -- cgit v1.2.3 From 649c17524918f90789b92911ef3be57dad0af0b8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 14 Feb 2020 23:27:46 +0100 Subject: Clipboard.c: rename static helpers and macros drop the nxagent prefix to emphasize they are not called from the outside. Also make them static and add prototypes, if missing. --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 201 +++++++++++++------------ 1 file changed, 108 insertions(+), 93 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index b456b7113..88251adad 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -169,7 +169,7 @@ static char szAgentCLIPBOARD[] = "CLIPBOARD"; */ #ifdef DEBUG -const char * GetClientSelectionStageString(int stage) +static const char * getClientSelectionStageString(int stage) { switch(stage) { @@ -181,13 +181,13 @@ 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 @@ -197,7 +197,7 @@ const char * GetClientSelectionStageString(int stage) * 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) { @@ -232,17 +232,32 @@ XFixesAgentInfoRec nxagentXFixesInfo = { -1, -1, -1, 0 }; extern Display *nxagentDisplay; -static Bool nxagentValidServerTargets(XlibAtom target); +static Bool validServerTargets(XlibAtom target); static void endTransfer(Bool success); #define SELECTION_SUCCESS True #define SELECTION_FAULT False -static void nxagentTransferSelection(int resource); +static void transferSelection(int resource); #if 0 -void nxagentResetSelectionOwner(void); +static void resetSelectionOwner(void); #endif -static void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, - Atom selection, Atom target, Time time); -static void nxagentSetSelectionOwner(Selection *pSelection); +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); +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); +static void printSelectionStat(int sel); +static void replyRequestSelection(XEvent *X, Bool success); void nxagentPrintClipboardStat(char *); @@ -251,7 +266,7 @@ extern unsigned long startTime; #endif #ifdef DEBUG -void nxagentPrintSelectionStat(int sel) +static void printSelectionStat(int sel) { SelectionOwner lOwner = lastSelectionOwner[sel]; Selection curSel = CurrentSelections[sel]; @@ -345,12 +360,12 @@ 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 (remote X server)\n"); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS); @@ -398,7 +413,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; @@ -422,7 +437,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 { @@ -436,17 +451,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; @@ -465,7 +480,7 @@ int SendSelectionNotifyEventToClient(ClientPtr client, CLINDEX(client)); #endif - return SendEventToClient(client, &x); + return sendEventToClient(client, &x); } /* @@ -473,7 +488,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. */ -static Bool nxagentValidServerTargets(XlibAtom target) +static Bool validServerTargets(XlibAtom target) { if (target == XA_STRING) { @@ -525,7 +540,7 @@ static Bool nxagentValidServerTargets(XlibAtom target) return False; } -void nxagentInitSelectionOwner(int index, Atom selection) +static void initSelectionOwner(int index, Atom selection) { lastSelectionOwner[index].selection = selection; lastSelectionOwner[index].client = NullClient; @@ -535,7 +550,7 @@ 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; @@ -543,7 +558,7 @@ void nxagentClearSelectionOwner(int index) lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); } -void nxagentStoreSelectionOwner(int index, Selection *sel) +static void storeSelectionOwner(int index, Selection *sel) { lastSelectionOwner[index].client = sel->client; lastSelectionOwner[index].window = sel->window; @@ -551,7 +566,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)); @@ -572,17 +587,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 - nxagentClearSelectionOwner(i); + clearSelectionOwner(i); lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); lastServerRequestor = None; } @@ -591,7 +606,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) if (pWindow && pWindow == lastClientWindowPtr) { lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); } nxagentPrintClipboardStat("after nxagentClearClipboard"); @@ -668,7 +683,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); } /* @@ -679,11 +694,11 @@ 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); + setClientSelectionStage(None); nxagentPrintClipboardStat("after nxagentClearSelection"); } @@ -692,7 +707,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, @@ -710,7 +725,7 @@ void nxagentReplyRequestSelection(XEvent *X, Bool success) eventSelection.property = None; } - SendSelectionNotifyEventToServer(&eventSelection); + sendSelectionNotifyEventToServer(&eventSelection); } /* @@ -760,7 +775,7 @@ void nxagentRequestSelection(XEvent *X) fprintf(stderr, "%s: denying additional request during transfer phase.\n", __func__); #endif - nxagentReplyRequestSelection(X, False); + replyRequestSelection(X, False); return; } @@ -773,13 +788,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) { @@ -826,7 +841,7 @@ void nxagentRequestSelection(XEvent *X) (unsigned char*)&targets, numTargets); - nxagentReplyRequestSelection(X, True); + replyRequestSelection(X, True); } else if (X->xselectionrequest.target == serverTIMESTAMP) { @@ -855,19 +870,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; } @@ -949,7 +964,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]" \ @@ -963,7 +978,7 @@ void nxagentRequestSelection(XEvent *X) else { /* deny the request */ - nxagentReplyRequestSelection(X, False); + replyRequestSelection(X, False); } } } @@ -996,7 +1011,7 @@ static void endTransfer(Bool success) CLINDEX(lastClientClientPtr)); #endif - SendSelectionNotifyEventToClient(lastClientClientPtr, + sendSelectionNotifyEventToClient(lastClientClientPtr, lastClientTime, lastClientRequestor, lastClientSelection, @@ -1007,10 +1022,10 @@ static void endTransfer(Bool success) * Enable further requests from clients. */ lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); } -static void nxagentTransferSelection(int resource) +static void transferSelection(int resource) { if (lastClientClientPtr -> index != resource) { @@ -1030,7 +1045,7 @@ static void nxagentTransferSelection(int resource) { int result; - PrintClientSelectionStage(); + printClientSelectionStage(); /* * Don't get data yet, just get size. We skip this stage in @@ -1071,7 +1086,7 @@ static void nxagentTransferSelection(int resource) return; } - SetClientSelectionStage(WaitSize); + setClientSelectionStage(WaitSize); NXFlushDisplay(nxagentDisplay, NXFlushLink); @@ -1081,7 +1096,7 @@ static void nxagentTransferSelection(int resource) { int result; - PrintClientSelectionStage(); + printClientSelectionStage(); /* * Request the selection data now. @@ -1125,7 +1140,7 @@ static 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 */ @@ -1137,7 +1152,7 @@ static 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; @@ -1198,7 +1213,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)); @@ -1222,15 +1237,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)); @@ -1272,7 +1287,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; } @@ -1310,7 +1325,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) } #endif - PrintClientSelectionStage(); + printClientSelectionStage(); if (lastClientWindowPtr != NULL) { @@ -1341,10 +1356,10 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) * tions. */ - SetClientSelectionStage(QueryData); + setClientSelectionStage(QueryData); lastClientPropertySize = 262144; - nxagentTransferSelection(lastClientClientPtr -> index); + transferSelection(lastClientClientPtr -> index); } else { @@ -1382,7 +1397,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) @@ -1398,7 +1413,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 || @@ -1465,7 +1480,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) (void *)eventSelection.requestor); #endif - SendSelectionNotifyEventToServer(&eventSelection); + sendSelectionNotifyEventToServer(&eventSelection); lastServerRequestor = None; /* allow further request */ } @@ -1480,7 +1495,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) * 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) { @@ -1509,11 +1524,11 @@ void nxagentResetSelectionOwner(void) fprintf(stderr, "%s: Reset selection state for selection [%d].\n", __func__, i); #endif - nxagentClearSelectionOwner(i); + clearSelectionOwner(i); } lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); /* Hmm, this is already None when reaching this */ lastServerRequestor = None; @@ -1571,9 +1586,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) @@ -1601,7 +1616,7 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, * This is called from the nxagentSetSelectionCallback, so it is using * internal Atoms */ -static void nxagentSetSelectionOwner(Selection *pSelection) +static void setSelectionOwner(Selection *pSelection) { if (!agentClipboardInitialized) { @@ -1656,11 +1671,11 @@ static 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; @@ -1677,7 +1692,7 @@ FIXME lastSelectionOwnerWindowPtr = pSelection->pWin; lastClientWindowPtr = NULL; - SetClientSelectionStage(None); + setClientSelectionStage(None); lastServerRequestor = None; } @@ -1685,7 +1700,7 @@ FIXME */ } -static void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, +static void notifyConvertFailure(ClientPtr client, Window requestor, Atom selection, Atom target, Time time) { /* @@ -1700,7 +1715,7 @@ static void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, return; } - SendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); + sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); } /* @@ -1759,11 +1774,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 { @@ -1777,7 +1792,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; } @@ -1828,7 +1843,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; } @@ -1864,7 +1879,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; } @@ -1902,7 +1917,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 @@ -1963,7 +1978,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; } @@ -2094,7 +2109,7 @@ int nxagentSendNotify(xEvent *event) NameForAtom(event->u.selectionNotify.property)); #endif - SendSelectionNotifyEventToServer(&eventSelection); + sendSelectionNotifyEventToServer(&eventSelection); return 1; } @@ -2156,8 +2171,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 { @@ -2267,13 +2282,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); -- cgit v1.2.3 From a94fef86c9ee72d646813f58bf947f7f245ebbca Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 14 Feb 2020 23:59:45 +0100 Subject: Clipboard.c: rename some exported functions to make them all fit in the same naming scheme that better describes their purpose. --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 16 +++++++++------- nx-X11/programs/Xserver/hw/nxagent/Clipboard.h | 8 ++++---- nx-X11/programs/Xserver/hw/nxagent/Events.c | 4 ++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 88251adad..70fc43fb5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -256,7 +256,9 @@ static int sendSelectionNotifyEventToClient(ClientPtr client, 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 *); @@ -647,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) { @@ -699,7 +701,7 @@ void nxagentClearSelection(XEvent *X) lastClientWindowPtr = NULL; setClientSelectionStage(None); - nxagentPrintClipboardStat("after nxagentClearSelection"); + nxagentPrintClipboardStat("after nxagentHandleSelectionClearFromXServer"); } /* @@ -735,7 +737,7 @@ static void replyRequestSelection(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 { @@ -758,7 +760,7 @@ void nxagentRequestSelection(XEvent *X) } #endif - nxagentPrintClipboardStat("before nxagentRequestSelection"); + nxagentPrintClipboardStat("before nxagentHandleSelectionRequestFromXServer"); if (!agentClipboardInitialized) { @@ -982,7 +984,7 @@ void nxagentRequestSelection(XEvent *X) } } } - nxagentPrintClipboardStat("after nxagentRequestSelection"); + nxagentPrintClipboardStat("after nxagentHandleSelectionRequestFromXServer"); } /* @@ -1820,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) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h index e34150986..b741ef286 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h @@ -58,12 +58,12 @@ extern int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom select Window requestor, Atom property, Atom target, Time time); #ifdef XEvent -extern void nxagentClearSelection(XEvent *X); -extern void nxagentRequestSelection(XEvent *X); +extern void nxagentHandleSelectionClearFromXServer(XEvent *X); +extern void nxagentHandleSelectionRequestFromXServer(XEvent *X); extern void nxagentHandleSelectionNotifyFromXServer(XEvent *X); #else -extern void nxagentClearSelection(); -extern void nxagentRequestSelection(); +extern void nxagentHandleSelectionClearFromXServer(); +extern void nxagentHandleSelectionRequestFromXServer(); extern void nxagentHandleSelectionNotifyFromXServer(); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 73c5d7c36..4421e9844 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -893,7 +893,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) fprintf(stderr, "%s: Going to handle new SelectionClear event.\n", __func__); #endif - nxagentClearSelection(&X); + nxagentHandleSelectionClearFromXServer(&X); break; } @@ -903,7 +903,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) fprintf(stderr, "%s: Going to handle new SelectionRequest event.\n", __func__); #endif - nxagentRequestSelection(&X); + nxagentHandleSelectionRequestFromXServer(&X); break; } -- cgit v1.2.3 From f38ecc6ffef14de748ea56ea2a5df32e04eb0e0d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 17 Feb 2020 23:21:06 +0100 Subject: dix/dispatch.c: fix buggy callback invocation Looks like a copy'n'paste error. --- nx-X11/programs/Xserver/dix/dispatch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index 6d0d61a15..57806f99d 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -3960,7 +3960,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; -- cgit v1.2.3 From c73ddd3118f37449155fdd30128f6f1d67f70c7e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 18 Feb 2020 22:07:37 +0100 Subject: dix/dispatch.c: Fix copy/paste error from before git history in UpdateCurrentTimeIf() Backport from this commit: commit 8dfd98245d2c44a1eb4c8b7c275e6cfc10fe40f1 Author: Chase Douglas Date: Wed Apr 11 11:14:51 2012 -0700 Fix copy/paste error from before git history in UpdateCurrentTimeIf() See UpdateCurrentTime() for reference. I don't know what bug this might trigger, but it wouldn't hurt to fix this. Signed-off-by: Chase Douglas Reviewed-by: Peter Hutterer --- nx-X11/programs/Xserver/dix/dispatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index 57806f99d..cd832319d 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; } -- cgit v1.2.3 From 7921cf79fe2fc1c193bf0726bbc4818a94da3e20 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 18 Feb 2020 22:28:20 +0100 Subject: Handlers.c: slight cosmetics no functional change --- nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index 6901647e3..dffdcaf14 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -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) @@ -1077,7 +1070,6 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) if (!SmartScheduleSignalEnable) { - if (client -> index != nxagentDispatch.client) { #ifdef DEBUG @@ -1122,9 +1114,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) } #endif } - } - } /* @@ -1168,12 +1158,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) -- cgit v1.2.3 From 0d9d21287cd3a7db7695efdb4ff85c53234536f2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 18 Feb 2020 22:35:19 +0100 Subject: Client.c: mask unused clientBytes stuff The only place where this was referenced outside Client.c was a commented section in Handlers.c. For now lets mask all that by an (unset) define. --- nx-X11/programs/Xserver/hw/nxagent/Client.c | 4 ++++ nx-X11/programs/Xserver/hw/nxagent/Client.h | 4 ++++ nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 2 ++ 3 files changed, 10 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 0b8331b79..33841f436 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -111,7 +111,9 @@ void nxagentInitClientPrivates(ClientPtr client) if (nxagentClientPriv(client)) { nxagentClientPriv(client) -> clientState = 0; +#ifdef COUNT_CLIENT_BYTES nxagentClientPriv(client) -> clientBytes = 0; +#endif nxagentClientPriv(client) -> clientHint = UNKNOWN; } } @@ -284,6 +286,7 @@ void nxagentWakeupByReset(ClientPtr client) } } +#ifdef COUNT_CLIENT_BYTES if (client -> index < MAX_CONNECTIONS) { #ifdef TEST @@ -293,6 +296,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..094e45257 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.h @@ -59,11 +59,15 @@ extern int nxagentClientPrivateIndex; void nxagentInitClientPrivates(ClientPtr); +#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) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index dffdcaf14..411dfe933 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -1041,6 +1041,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) in, client -> index); #endif +#ifdef COUNT_CLIENT_BYTES /* * This is presently unused. * @@ -1052,6 +1053,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) * #endif * */ +#endif nxagentBytesIn += in; -- cgit v1.2.3 From 7835204928959c644ca3b8fdcc20390adc713f1e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 19 Feb 2020 00:07:35 +0100 Subject: Client.c: use nxagentClientHint macro everywhere --- nx-X11/programs/Xserver/hw/nxagent/Client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 33841f436..1e4182599 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -130,7 +130,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) { @@ -153,7 +153,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) @@ -175,7 +175,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) { @@ -209,7 +209,7 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) void nxagentCheckIfShadowAgent(ClientPtr client) { - if (nxagentClientPriv(client) -> clientHint == NXAGENT_SHADOW) + if (nxagentClientHint(client) == NXAGENT_SHADOW) { #ifdef TEST fprintf(stderr, "nxagentCheckIfShadowAgent: nxagentShadowCounter [%d].\n", -- cgit v1.2.3 From 067031a3b3036670ccc858be732264215a7d14ba Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 15 Feb 2020 23:50:03 +0100 Subject: nxagent: use Xorg's callback mechanism for init/free of client privates --- nx-X11/programs/Xserver/dix/dispatch.c | 4 -- nx-X11/programs/Xserver/hw/nxagent/Client.c | 76 ++++++++++++++++++++++++- nx-X11/programs/Xserver/hw/nxagent/Client.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Init.c | 6 ++ nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 23 +------- 5 files changed, 83 insertions(+), 28 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index cd832319d..ac5d07281 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -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; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 1e4182599..020f90c91 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -68,6 +68,10 @@ #undef TEST #undef DEBUG +void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args); +static void initClientPrivates(ClientPtr client); +static void freeClientPrivates(ClientPtr client); + /* * Returns the last signal delivered to the process. */ @@ -106,8 +110,78 @@ int nxagentClientPrivateIndex; int nxagentShadowCounter = 0; -void nxagentInitClientPrivates(ClientPtr client) +/* + * 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: + { + 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; + } +} + +static void freeClientPrivates(ClientPtr client) +{ + #ifdef DEBUG + fprintf(stderr, "%s: called\n", __func__); + #endif + if (nxagentClientPriv(client)) { nxagentClientPriv(client) -> clientState = 0; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.h b/nx-X11/programs/Xserver/hw/nxagent/Client.h index 094e45257..2115e6b6d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.h @@ -57,7 +57,7 @@ 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 diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index b4d8a270c..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 #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 #include "compext/Compext.h" @@ -386,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(); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index dc3b2dcd9..58dd71f60 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -1009,29 +1009,8 @@ CloseDownClient(register ClientPtr client) */ 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; + xorg_CloseDownClient(client); } -- cgit v1.2.3 From 7358581d7726c132a2c0b0d80b1e12b282b0aca3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 17 Feb 2020 14:36:11 +0100 Subject: NXdispatch.c: move nxagentClearClipboard to client callback --- nx-X11/programs/Xserver/hw/nxagent/Client.c | 2 ++ nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 15 +++------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 020f90c91..78b9d46ec 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. @@ -150,6 +151,7 @@ void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *ar } case ClientStateGone: { + nxagentClearClipboard(client, NULL); freeClientPrivates(client); break; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 58dd71f60..8d0fa7549 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -989,23 +989,14 @@ 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. + * Check if the client is a shadow nxagent. */ nxagentCheckIfShadowAgent(client); -- cgit v1.2.3 From 8e1d97732bc889659209406e99360972e2efb73d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 17 Feb 2020 14:45:54 +0100 Subject: NXdispatch.c: move nxagentCheckIfShadowAgent to client callback --- nx-X11/programs/Xserver/hw/nxagent/Client.c | 9 ++++++++- nx-X11/programs/Xserver/hw/nxagent/Client.h | 14 ++++---------- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 7 ------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 78b9d46ec..9b0f2c5e6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -72,6 +72,7 @@ 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. @@ -152,6 +153,12 @@ void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *ar case ClientStateGone: { nxagentClearClipboard(client, NULL); + + /* + * Check if the client is a shadow nxagent. + */ + checkIfShadowAgent(client); + freeClientPrivates(client); break; } @@ -283,7 +290,7 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) } } -void nxagentCheckIfShadowAgent(ClientPtr client) +static void checkIfShadowAgent(ClientPtr client) { if (nxagentClientHint(client) == NXAGENT_SHADOW) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.h b/nx-X11/programs/Xserver/hw/nxagent/Client.h index 2115e6b6d..38a02aed1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.h @@ -76,8 +76,7 @@ extern void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, v (nxagentClientHint(pClient) == NXCLIENT_DIALOG) /* - * The actual reason why the client - * is sleeping. + * The actual reason why the client is sleeping. */ #define SleepingBySplit 1 @@ -94,19 +93,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); @@ -123,8 +118,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/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 8d0fa7549..5315f86bc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -994,13 +994,6 @@ CloseDownClient(register ClientPtr client) */ nxagentWakeupByReset(client); - - /* - * Check if the client is a shadow nxagent. - */ - - nxagentCheckIfShadowAgent(client); - #endif xorg_CloseDownClient(client); -- cgit v1.2.3 From 13f97cbc84c5fcc92cc7a82e79ddcb84d85c61ff Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 16 Feb 2020 00:01:38 +0100 Subject: Client.c: add clientInfoString to client privates This is a string that contains the address, the index, the PID and the process name of the client. The string can be used in debugging messages to identify the client. --- nx-X11/programs/Xserver/hw/nxagent/Client.c | 47 +++++++++++++++++++++++++++++ nx-X11/programs/Xserver/hw/nxagent/Client.h | 5 ++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 9b0f2c5e6..83554e573 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -112,6 +112,14 @@ int nxagentClientPrivateIndex; int nxagentShadowCounter = 0; +/* + * 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. @@ -182,6 +190,42 @@ static void initClientPrivates(ClientPtr client) 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 + } } } @@ -198,6 +242,9 @@ static void freeClientPrivates(ClientPtr client) nxagentClientPriv(client) -> clientBytes = 0; #endif nxagentClientPriv(client) -> clientHint = UNKNOWN; + + if (client->index != 0) + SAFE_free(nxagentClientPriv(client) -> clientInfoString); } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.h b/nx-X11/programs/Xserver/hw/nxagent/Client.h index 38a02aed1..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; @@ -75,6 +75,9 @@ extern void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, v #define nxagentClientIsDialog(pClient) \ (nxagentClientHint(pClient) == NXCLIENT_DIALOG) +#define nxagentClientInfoString(pClient) \ + (nxagentClientPriv(pClient) -> clientInfoString) + /* * The actual reason why the client is sleeping. */ -- cgit v1.2.3 From d9e4526b388b23cda787cabe5d9aaf047cef075a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 19 Feb 2020 22:48:12 +0100 Subject: Display.c: filter remote Pixmap formats before doing the compatiblity check Fixes: ArcticaProject/nx-libs#635 --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 80 ++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index e3221fb4e..55e40b461 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -1553,6 +1553,7 @@ void nxagentInitPixmapFormats(void) */ nxagentNumPixmapFormats = 0; + nxagentRemoteNumPixmapFormats = 0; /* XXX: Some X server doesn't list 1 among available depths... @@ -1602,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). + */ + + int tmpnum = 0; + XPixmapFormatValues *tmp = XListPixmapFormats(nxagentDisplay, &tmpnum); - if (nxagentRemotePixmapFormats == NULL) + 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) -- cgit v1.2.3 From 27933a8d87d759e42a1c2d58a54af1ba99f8455c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 24 Jun 2019 15:45:20 +0200 Subject: Improve clipboard/xfixes related debug output --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 70fc43fb5..4eba8d6e5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -1571,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) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 4421e9844..83091eff4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2868,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); -- cgit v1.2.3 From b65dd4e3094247560cae56ad00377387064c0627 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 2 Dec 2019 23:30:42 +0100 Subject: NXshm.c: simplify Dispatch functions --- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index a38baac6a..c84e8e5a9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -448,26 +448,21 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr) 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 = True; - result = xorg_ProcShmDispatch(client); + int result = xorg_ProcShmDispatch(client); nxagentShmTrap = False; @@ -477,20 +472,18 @@ 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 = True; - result = xorg_SProcShmDispatch(client); + int result = xorg_SProcShmDispatch(client); nxagentShmTrap = False; -- cgit v1.2.3 From fe39d8a38b7e0d9e634758cd1d22e6954f30fd0f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 2 Dec 2019 22:55:50 +0100 Subject: NXshm.c: slight simplification --- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index c84e8e5a9..4784f4657 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -190,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); @@ -227,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); -- cgit v1.2.3 From ba5a85fb819e8007f79753b2f2acd7f5c18156e2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 6 Mar 2018 22:24:10 +0100 Subject: Screen.c: fix wrong debug statement --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index bf4d415f1..49886432b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3918,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? */ -- cgit v1.2.3 From f85e71a6ee2fa5229534ab595b9c7a9445412de1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 Apr 2020 18:41:58 +0200 Subject: Dialog.h: Fix incomplete macro nxagentNoDialogIsRunning The autograb stuff had been forgotten. --- nx-X11/programs/Xserver/hw/nxagent/Dialog.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h index 2f503bc62..0b8295158 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" : \ -- cgit v1.2.3 From b4b0a1a775b324c85ecf1361cb87e5e275cf0108 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 Apr 2020 18:42:53 +0200 Subject: Dialog.h: reformat comment --- nx-X11/programs/Xserver/hw/nxagent/Dialog.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h index 0b8295158..b11df5045 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h @@ -98,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 \ -- cgit v1.2.3 From 92589f41a1d1df9fcd2d33a97199f015b5482d67 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 3 Dec 2019 00:00:03 +0100 Subject: NXshm.c: cleanup nxagent_fbShmCreatePixmap ... to match it as closely as possible to the upstream version. --- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 37 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 4784f4657..e72a37494 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -389,7 +389,7 @@ ProcShmPutImage(client) return (client->noClientException); } - +/* derived from Xext/shm.c */ static PixmapPtr nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr) ScreenPtr pScreen; @@ -400,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; } @@ -434,14 +427,24 @@ 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; - result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr); + PixmapPtr result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr); nxagentShmPixmapTrap = False; + #ifdef WARNING + if (result == NullPixmap) + { + fprintf(stderr, "%s: Return Null Pixmap.\n", __func__); + } + #endif + return result; } -- cgit v1.2.3 From acd45283bc7c7405a73015e0579f85e7aeea2d71 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 18:32:43 +0200 Subject: Font.c: cleanup reformat, whitespace, code simplification, FIXMEs --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 2147 ++++++++++++++--------------- 1 file changed, 1071 insertions(+), 1076 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index ddae19cf0..9df7380d6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -113,15 +113,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 +130,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,10 +152,10 @@ 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}; /* @@ -164,519 +164,521 @@ static struct _nxagentFailedToReconnectFonts void nxagentFreeFontCache(void) { - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: Freeing nxagent font cache\n"); - #endif - - if (CACHE_INDEX == 0) - return; + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: Freeing nxagent font cache\n"); + #endif - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: Freeing nxagent font cache, there are [%d] entries.\n", CACHE_INDEX); - #endif + if (CACHE_INDEX == 0) + return; - 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_ENTRY_PTR); - CACHE_ENTRY_PTR = NULL; - CACHE_INDEX = 0; - CACHE_SIZE = 0; + SAFE_free(CACHE_NAME(i)); + SAFE_free(CACHE_ENTRY(i)); + } - #ifdef NXAGENT_FONTCACHE_DEBUG - fprintf(stderr, "Font: nxagent font cache fully freed\n"); - #endif + SAFE_free(CACHE_ENTRY_PTR); + CACHE_ENTRY_PTR = NULL; + CACHE_INDEX = 0; + CACHE_SIZE = 0; - return; + #ifdef NXAGENT_FONTCACHE_DEBUG + fprintf(stderr, "Font: nxagent font cache fully freed\n"); + #endif + + 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) + { + /* FIXME: if realloc fails the pointer is lost! */ + nxagentRemoteFontList.list = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) + * (nxagentRemoteFontList.listSize + 1000)); - nxagentRemoteFontList.listSize += 1000; - } + if (nxagentRemoteFontList.list == 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.listSize += 1000; + } - 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)))) + { + 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 name memory allocation failed!.\n"); - SAFE_free(nxagentRemoteFontList.list[pos]); - return; + fprintf(stderr, "Font: remote list record memory allocation failed!.\n"); + 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 + 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); + } } 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) + { + /* FIXME: if realloc fails the pointer is lost */ + CACHE_ENTRY_PTR = realloc(CACHE_ENTRY_PTR, sizeof(nxCacheFontEntryRecPtr) * (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 + if (CACHE_ENTRY_PTR == NULL) + { + FatalError("Font: Cache list memory re-allocation failed.\n"); + } - if (CACHE_INDEX == CACHE_SIZE) - { - CACHE_ENTRY_PTR = realloc(CACHE_ENTRY_PTR, sizeof(nxCacheFontEntryRecPtr) * (CACHE_SIZE + 100)); + CACHE_SIZE += 100; + } - 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 +686,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 +724,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 +736,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 +806,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 +815,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 +837,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 +856,883 @@ 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) + { + nxagentFailedToReconnectFonts.size *= 2; - #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; + /* FIXME: if realloc fails the pointer is lost */ + nxagentFailedToReconnectFonts.font = realloc(nxagentFailedToReconnectFonts.font, + nxagentFailedToReconnectFonts.size * + sizeof(FontPtr)); - nxagentFailedToReconnectFonts.font = realloc(nxagentFailedToReconnectFonts.font, - nxagentFailedToReconnectFonts.size * - sizeof(FontPtr)); + nxagentFailedToReconnectFonts.id = realloc(nxagentFailedToReconnectFonts.id, + nxagentFailedToReconnectFonts.size * + sizeof(XID)); - nxagentFailedToReconnectFonts.id = realloc(nxagentFailedToReconnectFonts.id, - nxagentFailedToReconnectFonts.size * - sizeof(XID)); + if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) + { + 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"); + #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--); + + /* + * 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; + 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)) - { - fprintf(stderr, "\tXID %lx - %s\n", CACHE_FSTRUCT(i) -> fid, CACHE_NAME(i)); - } - else + for (int i = 0; i < CACHE_INDEX; i++) { - 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; - - reconnectFlexibility = *((int *) p0); + char fontServerPath[256] = ""; - #ifdef NXAGENT_RECONNECT_FONT_DEBUG - fprintf(stderr, "nxagentReconnectFailedFonts: \n"); - #endif + reconnectFlexibility = *((int *) p0); - 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; + XFontStruct* fs = (XFontStruct *) malloc (sizeof (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; - } - - 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. - */ + return (XFontStruct *) NULL; + } - if (fs -> n_properties > 0) - { - register long nbytes; + 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. */ - 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; + } - 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; + memmove(fs -> properties, pFont -> info.props, nbytes); + } + + xCharInfo *xcip = (xCharInfo *) &pFont -> info.ink_minbounds; + + 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; - xcip = (xCharInfo *) &pFont -> info.ink_maxbounds; + xcip = (xCharInfo *) &pFont -> info.ink_maxbounds; - 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; + 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; - 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 -> 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; + 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); + } + + if (next == NULL) + { + next = string + len; + last = 1; + } - int fieldlen = next - current; + int fieldlen = next - current; - if (i < nfields) - { - fields[i] = strndup(current, fieldlen); - } - else - { - fields[i] = NULL; - } + 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; } -- cgit v1.2.3 From 58b3c8cdd7e1d31147ce52c2cd28714ac6d0039c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 18:57:10 +0200 Subject: Font.c: fix realloc bugs --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 43 +++++++++++++++++-------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 9df7380d6..369ae3b2c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -192,7 +192,6 @@ void nxagentFreeFontCache(void) } SAFE_free(CACHE_ENTRY_PTR); - CACHE_ENTRY_PTR = NULL; CACHE_INDEX = 0; CACHE_SIZE = 0; @@ -289,16 +288,16 @@ void nxagentListRemoteAddName(const char *name, int status) if (nxagentRemoteFontList.length == nxagentRemoteFontList.listSize) { - /* FIXME: if realloc fails the pointer is lost! */ - nxagentRemoteFontList.list = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) - * (nxagentRemoteFontList.listSize + 1000)); + int num = nxagentRemoteFontList.listSize + 1000; + nxagentFontRecPtr *tmp1 = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) * num); - if (nxagentRemoteFontList.list == NULL) + if (tmp1 == NULL) { FatalError("Font: remote list memory re-allocation failed!.\n"); } - nxagentRemoteFontList.listSize += 1000; + nxagentRemoteFontList.list = tmp1; + nxagentRemoteFontList.listSize = num; } if (pos < nxagentRemoteFontList.length) @@ -542,15 +541,18 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) if (CACHE_INDEX == CACHE_SIZE) { - /* FIXME: if realloc fails the pointer is lost */ - CACHE_ENTRY_PTR = realloc(CACHE_ENTRY_PTR, sizeof(nxCacheFontEntryRecPtr) * (CACHE_SIZE + 100)); + int num = CACHE_SIZE + 100; - if (CACHE_ENTRY_PTR == NULL) + nxCacheFontEntryRecPtr *tmp1 = realloc(CACHE_ENTRY_PTR, + sizeof(nxCacheFontEntryRecPtr) * num); + + if (tmp1 == NULL) { FatalError("Font: Cache list memory re-allocation failed.\n"); } - CACHE_SIZE += 100; + CACHE_ENTRY_PTR = tmp1; + CACHE_SIZE = num; } CACHE_ENTRY(CACHE_INDEX) = malloc(sizeof(nxCacheFontEntryRec)); @@ -888,22 +890,23 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id) } else if (nxagentFailedToReconnectFonts.index == nxagentFailedToReconnectFonts.size - 1) { - nxagentFailedToReconnectFonts.size *= 2; - - /* FIXME: if realloc fails the pointer is lost */ - nxagentFailedToReconnectFonts.font = realloc(nxagentFailedToReconnectFonts.font, - nxagentFailedToReconnectFonts.size * - sizeof(FontPtr)); + int num = 2 * nxagentFailedToReconnectFonts.size; - nxagentFailedToReconnectFonts.id = realloc(nxagentFailedToReconnectFonts.id, - nxagentFailedToReconnectFonts.size * - sizeof(XID)); + FontPtr *tmp1 = realloc(nxagentFailedToReconnectFonts.font, num * sizeof(FontPtr)); + XID *tmp2 = realloc(nxagentFailedToReconnectFonts.id, num * sizeof(XID)); - if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) + if (tmp1 == NULL || tmp2 == NULL) { + SAFE_free(tmp1); + SAFE_free(tmp2); + 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 -- cgit v1.2.3 From 99f541c1e4499ff8fda65c67c2038d5b65c15e67 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 19:08:11 +0200 Subject: Font.c: add hint of deliberate pointer misuse --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 4 ++++ nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 369ae3b2c..200a6fa61 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -452,6 +452,10 @@ Bool nxagentFontLookUp(const char *name) } } +/* + * 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) { #ifdef HAS_XFONT2 diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index f351f5c3b..d563dee34 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -290,9 +290,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (pScr->RealizeFont) { #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. - */ + /* + * 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 -- cgit v1.2.3 From 13536693d89077daa3cde370bb43decbf24ec212 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 19:10:00 +0200 Subject: NXdispatch.c: free font data on exit helps to avoid valgrind warnings --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 9 ++++++++- nx-X11/programs/Xserver/hw/nxagent/Font.h | 1 + nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 200a6fa61..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; @@ -158,6 +157,14 @@ static struct _nxagentFailedToReconnectFonts 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(). */ 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/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 5315f86bc..8f806093e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -581,6 +581,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio saveAgentState("TERMINATED"); nxagentFreeAtomMap(); + nxagentFreeFontData(); #endif /* NXAGENT_SERVER */ KillAllClients(); -- cgit v1.2.3 From b0b0efc98d6f720d7ea104d059e3f014bdd0f5a3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 20:23:46 +0200 Subject: Keyboard.c: free remote keybord names once no longer needed --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 -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 -- cgit v1.2.3 From 2e50ee079f758c7ea0b066a49674f15c5fa137fa Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 22:15:12 +0200 Subject: NXdixfonts.c: fix debugging output --- nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index d563dee34..58cfe53c1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -467,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; } @@ -491,7 +496,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) c->slept = TRUE; #ifdef NXAGENT_SERVER #ifdef DEBUG - fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client); fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client); #endif #endif -- cgit v1.2.3 From 2f61c9296441843c4f62c638d052d88f2b275817 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 22:15:41 +0200 Subject: NXdixfonts.c: some code cleanups reformat, extend comments, simplify ifdef --- nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index 58cfe53c1..6bb4ea306 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -684,16 +684,14 @@ finish: bail: if (c->slept) -#ifdef NXAGENT_SERVER { ClientWakeup(client); +#ifdef NXAGENT_SERVER #ifdef DEBUG fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client); #endif - } -#else - ClientWakeup(client); #endif + } for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); @@ -1059,7 +1057,7 @@ typedef struct OFclosurePtr oc; } nxFs,*nxFsPtr; -/* this is derived from doListFontsAndAliases */ +/* this is derived from doListFontsAndAliases above */ static Bool nxdoListFontsAndAliases(ClientPtr client, nxFsPtr fss) { @@ -1201,20 +1199,20 @@ nxdoListFontsAndAliases(ClientPtr client, nxFsPtr 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; } } @@ -1308,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 { @@ -1367,13 +1364,13 @@ finish: } -/* this is derived from OpenFont() */ +/* this is derived from dix/dixfonts.c:OpenFont() */ int 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; @@ -1428,7 +1425,8 @@ nxOpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfont free(fss); return BadAlloc; } - c->fpe_list = (FontPathElementPtr *) + + c->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { free(c); -- cgit v1.2.3 From 2578471e82641e41f23a8b2b8b9ae0f33c7a6aa6 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Apr 2020 22:51:14 +0200 Subject: Keystroke.c: whitespace fixes --- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index a2cb03379..73a5901f8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -576,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) @@ -704,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; -- cgit v1.2.3 From 0a714774742dd37295d39680934db1aefbfc0957 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 23 Apr 2020 18:54:43 +0200 Subject: Clipboard.c: fix typo --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 4eba8d6e5..d51f066a9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -811,7 +811,7 @@ void nxagentHandleSelectionRequestFromXServer(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}; -- cgit v1.2.3 From fb6e43e30f011c6b40932d148f2162e6a08a1584 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 23 Apr 2020 21:07:52 +0200 Subject: Rootless.c: add some comments --- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index b0fda2fa2..c62db115a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -417,6 +417,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, @@ -792,6 +797,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, @@ -842,6 +852,7 @@ void nxagentImportProperty(Window window, /* * 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); -- cgit v1.2.3 From 8604b18e03557f145be2218bf89fa2597cee1a68 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 23 Apr 2020 21:08:49 +0200 Subject: Rootless.c: improve TEST output more output, correct format specifiers --- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index c62db115a..b63d40802 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -724,7 +724,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 @@ -826,7 +826,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 @@ -838,15 +838,15 @@ 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 /* @@ -858,10 +858,14 @@ void nxagentImportProperty(Window window, 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 } @@ -874,7 +878,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 } @@ -1079,7 +1083,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 @@ -1090,7 +1094,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 @@ -1136,7 +1140,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 @@ -1172,7 +1176,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 @@ -1218,7 +1222,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 -- cgit v1.2.3 From 5c99ec51ad000189a30ad9a19326bff7b12adbcf Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 23 Apr 2020 21:10:06 +0200 Subject: Rootless.c: do not import private properties In rootless mode some properties are private (or internal or adminitrative). They are only required for the windows on the real X server side that represent nxagent's windows. Those properties should never be cloned from there to the the nxagent windows so we filter them. Fixes ArcticaProject/nx-libs#920 --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 4 +++ nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 36 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 2e144bb0c..358d46519 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -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 */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index b63d40802..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" @@ -890,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 || -- cgit v1.2.3 From 310eadb3a5ccd4d78ecc3a87e9c5507f72745ede Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 6 May 2020 00:03:50 +0200 Subject: Reconnect.c: reformat saveAgentState() --- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 9858924d3..93e9ab432 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); } } -- cgit v1.2.3 From cf2bd1cf3859641d7394a1bfcf951af7c2f9ef04 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 6 May 2020 01:48:20 +0200 Subject: Screen.c: fix missing type in DEBUG mode --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 49886432b..2bdc4bde5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -4079,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) { @@ -4091,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 -- cgit v1.2.3 From 64c95c0a006e7d32cfd200a93aa5a9697c14649d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 6 May 2020 01:50:16 +0200 Subject: Reconnect.c: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 34 +++++++++++--------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 93e9ab432..17b46ad10 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -236,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; @@ -364,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. */ @@ -426,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; @@ -503,16 +500,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); @@ -682,10 +678,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 @@ -798,9 +793,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); -- cgit v1.2.3 From 7de7cb094034c7bb341ea422df19be60f6e81007 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 6 May 2020 01:52:12 +0200 Subject: Reconnect.c: save some lines --- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 17b46ad10..90e796772 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -460,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; } @@ -485,7 +483,6 @@ Bool nxagentReconnectSession(void) if (nxagentReconnectFailedFonts(reconnectLossyLevel[FONT_STEP]) == 0) { failedStep = FONT_STEP; - goto nxagentReconnectError; } else @@ -528,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; } @@ -551,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; } } @@ -573,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; } @@ -616,7 +605,6 @@ Bool nxagentReconnectSession(void) #endif failedStep = WINDOW_STEP; - goto nxagentReconnectError; } } @@ -856,4 +844,3 @@ void nxagentHandleConnectionChanges(void) } } } - -- cgit v1.2.3 From c69d2ad0fc5f69163c4babc7a356a783aa7ae411 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 6 May 2020 21:56:19 +0200 Subject: Events.h: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/Events.h | 37 ++++++++++++----------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h index 1f64279d9..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,8 +144,7 @@ extern void nxagentUngrabPointerAndKeyboard(XEvent *X); extern void nxagentDeactivatePointerGrab(void); /* - * Synchronize expose events between agent and - * the real X server. + * Synchronize expose events between agent and the real X server. */ typedef struct _ExposuresRec @@ -198,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; -- cgit v1.2.3