diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-05-07 16:00:44 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-05-07 16:00:44 +0200 |
commit | e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0 (patch) | |
tree | a8fbc3bfb442ef8222367b9a5b2285c9e6408fda /nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | |
parent | 424c0e8ee3986b886bf2d7617897577a6b84aaed (diff) | |
parent | c69d2ad0fc5f69163c4babc7a356a783aa7ae411 (diff) | |
download | nx-libs-e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0.tar.gz nx-libs-e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0.tar.bz2 nx-libs-e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0.zip |
Merge branch 'uli42-pr/various4' into 3.6.x
Attributes GH PR #896: https://github.com/ArcticaProject/nx-libs/pull/896
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 103 |
1 files changed, 33 insertions, 70 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index ad9ce771f..8f806093e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -117,6 +117,7 @@ Equipment Corporation. #include "Atoms.h" #include "Splash.h" +#include "Xdmcp.h" #include "Client.h" #include "Clipboard.h" #include "Reconnect.h" @@ -161,9 +162,7 @@ void nxagentListRemoteFonts(const char *, int); #include "unistd.h" #endif -#ifdef TEST #include "Literals.h" -#endif #ifdef VIEWPORT_FRAME @@ -330,7 +329,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio clientReady[0] = 0; - if (nxagentSplashWindow != None || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0)) + if (nxagentHaveSplashWindow() || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0)) { #ifdef TEST fprintf(stderr, "******Dispatch: Requesting a timeout of [%d] Ms.\n", @@ -346,7 +345,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio (nxagentOption(Xdmcp) == 0 || nxagentXdmcpUp == 1)) { #ifdef NX_DEBUG_INPUT - fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", + fprintf(stderr, "Session: Session started at '%s' timestamp [%u].\n", GetTimeAsString(), GetTimeInMillis()); #else fprintf(stderr, "Session: Session started at '%s'.\n", @@ -418,7 +417,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio isItTimeToYield = FALSE; #ifdef NXAGENT_SERVER - nxagentRequestingClient = client; + nxagentRequestingClient = client; #endif start_tick = SmartScheduleTime; while (!isItTimeToYield) @@ -580,6 +579,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio NXShadowDestroy(); } saveAgentState("TERMINATED"); + + nxagentFreeAtomMap(); + nxagentFreeFontData(); #endif /* NXAGENT_SERVER */ KillAllClients(); @@ -744,7 +746,7 @@ ProcConvertSelection(register ClientPtr client) #ifdef NXAGENT_SERVER (CurrentSelections[i].window != None) && (CurrentSelections[i].client != NullClient) #else - (CurrentSelections[i].window != None)) + (CurrentSelections[i].window != None) #endif #ifdef XCSECURITY && (!client->CheckAccess || @@ -799,12 +801,12 @@ ProcOpenFont(register ClientPtr client) #ifdef NXAGENT_SERVER char fontReq[256]; - memcpy(fontReq,(char *)&stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); - fontReq[stuff->nbytes]=0; - if (strchr(fontReq,'*') || strchr(fontReq,'?')) + memcpy(fontReq,(char *)&stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255); + fontReq[stuff->nbytes] = '\0'; + if (strchr(fontReq, '*') || strchr(fontReq, '?')) { #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Dispatch: ProcOpenFont try to find a common font with font pattern=%s\n",fontReq); + fprintf(stderr, "%s: try to find a common font with font pattern [%s]\n", __func__, fontReq); #endif nxagentListRemoteFonts(fontReq, nxagentMaxFontNames); err = nxOpenFont(client, stuff->fid, (Mask) 0, @@ -836,10 +838,9 @@ ProcCloseFont(register ClientPtr client) #ifdef NXAGENT_SERVER /* - * When a client closes a font the resource - * should not be lost if the reference counter - * is not 0, otherwise the server will not be - * able to find this font looping through the + * When a client closes a font the resource should not be lost + * if the reference counter is not 0, otherwise the server + * will not be able to find this font looping through the * resources. */ @@ -848,7 +849,7 @@ ProcCloseFont(register ClientPtr client) if (nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont) == 0) { #ifdef TEST - fprintf(stderr, "ProcCloseFont: Switching resource for font at [%p].\n", + fprintf(stderr, "%s: Switching resource for font at [%p].\n", __func__, (void *) pFont); #endif @@ -860,8 +861,8 @@ ProcCloseFont(register ClientPtr client) #ifdef TEST else { - fprintf(stderr, "ProcCloseFont: Found duplicated font at [%p], " - "resource switching skipped.\n", (void *) pFont); + fprintf(stderr, "%s: Found duplicated font at [%p], " + "resource switching skipped.\n", __func__, (void *) pFont); } #endif } @@ -888,11 +889,11 @@ ProcListFonts(register ClientPtr client) #ifdef NXAGENT_SERVER char tmp[256]; - memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); - tmp[stuff->nbytes]=0; + memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255); + tmp[stuff->nbytes] = '\0'; #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Dispatch: ListFont request with pattern %s max_names=%d\n",tmp,stuff->maxNames); + fprintf(stderr, "%s: ListFont request with pattern [%s] max_names [%d]\n", __func__, tmp, stuff->maxNames); #endif nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames); #endif @@ -910,12 +911,12 @@ ProcListFontsWithInfo(register ClientPtr client) #ifdef NXAGENT_SERVER char tmp[256]; - memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); - tmp[stuff->nbytes]=0; + memcpy(tmp, (unsigned char *) &stuff[1], (stuff->nbytes < 256) ? stuff->nbytes : 255); + tmp[stuff->nbytes] = '\0'; #ifdef NXAGENT_FONTMATCH_DEBUG - fprintf(stderr, "Dispatch: ListFont with info request with pattern %s max_names=%d\n",tmp,stuff->maxNames); + fprintf(stderr, "%s: ListFont with info request with pattern [%s] max_names [%d]\n", __func__, tmp, stuff->maxNames); #endif - nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames :stuff->maxNames); + nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames); #endif return StartListFontsWithInfo(client, stuff->nbytes, @@ -937,11 +938,10 @@ ProcFreePixmap(register ClientPtr client) #ifdef NXAGENT_SERVER /* - * When a client releases a pixmap the resource - * should not be lost if the reference counter - * is not 0, otherwise the server will not be - * able to find this pixmap looping through the - * resources. + * When a client releases a pixmap the resource should not be + * lost if the reference counter is not 0, otherwise the + * server will not be able to find this pixmap looping through + * the resources. */ if (pMap -> refcnt > 0) @@ -960,8 +960,8 @@ ProcFreePixmap(register ClientPtr client) #ifdef TEST else { - fprintf(stderr, "ProcFreePixmap: Found duplicated pixmap at [%p], " - "resource switching skipped.\n", (void *) pMap); + fprintf(stderr, "%s: Found duplicated pixmap at [%p], " + "resource switching skipped.\n", __func__, (void *) pMap); } #endif } @@ -990,49 +990,12 @@ CloseDownClient(register ClientPtr client) { #ifdef NXAGENT_SERVER /* - * There must be a better way to hook a - * call-back function to be called any - * time a client is going to be closed. - */ - - nxagentClearClipboard(client, NULL); - - /* - * Need to reset the karma counter and - * get rid of the pending sync replies. + * Need to reset the karma counter and get rid of the pending sync + * replies. */ nxagentWakeupByReset(client); - - /* - * Check if the client - * is a shadow nxagent. - */ - - nxagentCheckIfShadowAgent(client); #endif xorg_CloseDownClient(client); } - -/* FIXME: Instead of having a own function use the provided Callback - mechanism */ -int -InitClientPrivates(ClientPtr client) -{ - int ret = xorg_InitClientPrivates(client); - -#ifdef NXAGENT_SERVER - if (ret == 1) - { - - /* - * Initialize the private members. - */ - - nxagentInitClientPrivates(client); - } -#endif - - return ret; -} |