From 0153bf6b7e5c0ae2567bd93c4068068534dbf55b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 5 Jul 2019 19:41:04 +0200 Subject: Atoms.c: fix wrong fprintf format --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 2ee67b9bb..bf64369eb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -814,7 +814,7 @@ static void nxagentPrintAtomMapInfo(char *message) for (i = 0; i < privLastAtom; i++) { - fprintf(stderr, "[%5.1d] local: %6.1lu - remote: %6.1lu - [%p] %s\n", i, + fprintf(stderr, "[%5.1d] local: %6.1u - remote: %6.1u - [%p] %s\n", i, privAtomMap[i].local, privAtomMap[i].remote, privAtomMap[i].string, validateString(privAtomMap[i].string)); -- cgit v1.2.3 From 061f7dc9f4cd70354878c8f61395826b7c78b981 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 30 Jun 2019 16:42:22 +0200 Subject: Events.c: nxagentInternalWindowInfo is only called with DEBUG_TREE so hide it behind that define --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 4a6a05482..0134c1007 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -456,7 +456,6 @@ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine) } -#ifdef DEBUG_TREE /* * Walk remote windows tree. */ @@ -517,7 +516,6 @@ void nxagentRemoteWindowsTree(Window window, int level) SAFE_XFree((char *) childList); } -#endif /* * Print info about internal window. -- cgit v1.2.3 From 022d64d2ac6bc66ad8246bfa320d991eda0b775e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 30 Jun 2019 17:15:05 +0200 Subject: Events.c: fix write after buffer end --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 0134c1007..4a31497da 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -544,9 +544,7 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) if (result == Success && pszReturnData != NULL) { - pszReturnData[ulReturnItems] = '\0'; - - fprintf(stderr, "\"%s\"\n", (char *) pszReturnData); + fprintf(stderr, "\"%*.*s\"\n", (int)ulReturnItems, (int)ulReturnItems, (char *) pszReturnData); } else { -- cgit v1.2.3 From 3d37db0719648775ab61b91016c64431e18f829e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 30 Jun 2019 17:16:08 +0200 Subject: Events.c: shorten window tree debugging code scope improvements, use fprintf for indentation instead of loops. --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 49 ++++++----------------------- 1 file changed, 10 insertions(+), 39 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 4a31497da..1a3085448 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -426,20 +426,14 @@ void nxagentRemoteWindowID(Window window, Bool newline) void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine) { XWindowAttributes attributes; - int i; if (XGetWindowAttributes(nxagentDisplay, win, &attributes) == 0) { return; } - for (i = 0; i < indent; i++) - { - fprintf(stderr, " "); - } - - fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s " - "override_redirect=%s\n", attributes.x, attributes.y, + fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s " + "override_redirect=%s\n", indent, "", attributes.x, attributes.y, attributes.width, attributes.height, (attributes.class == 0) ? "CopyFromParent" : ((attributes.class == 1) ? "InputOutput" : "InputOnly"), @@ -462,7 +456,6 @@ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine) void nxagentRemoteWindowsTree(Window window, int level) { - int i, j; unsigned long rootWin, parentWin; unsigned int numChildren; unsigned long *childList = NULL; @@ -487,25 +480,15 @@ void nxagentRemoteWindowsTree(Window window, int level) if (level == 0 || numChildren > 0) { - fprintf(stderr, " "); - - for (j = 0; j < level; j++) - { - fprintf(stderr, " "); - } + fprintf(stderr, "%*s", (level * 4) + 5, ""); /* 4 spaces per level */ fprintf(stderr, "%d child%s%s\n", numChildren, (numChildren == 1) ? "" : "ren", (numChildren == 1) ? ":" : "."); } - for (i = (int) numChildren - 1; i >= 0; i--) + for (int i = (int) numChildren - 1; i >= 0; i--) { - fprintf(stderr, " "); - - for (j = 0; j < level; j++) - { - fprintf(stderr, " "); - } + fprintf(stderr, "%*s", (level * 5) + 6, ""); /* 5 spaces per level */ nxagentRemoteWindowID(childList[i], TRUE); @@ -523,7 +506,6 @@ void nxagentRemoteWindowsTree(Window window, int level) void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) { - int i; int result; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; @@ -551,13 +533,8 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) fprintf(stderr, "%s\n", "( has no name )"); } - for (i = 0; i < indent; i++) - { - fprintf(stderr, " "); - } - - fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s " - "override_redirect=%s", pWin -> drawable.x, pWin -> drawable.y, + fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s " + "override_redirect=%s", indent, "", pWin -> drawable.x, pWin -> drawable.y, pWin -> drawable.width, pWin -> drawable.height, (pWin -> drawable.class == 0) ? "CopyFromParent" : ((pWin -> drawable.class == 1) ? "InputOutput" : @@ -580,17 +557,11 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) void nxagentInternalWindowsTree(WindowPtr pWin, int indent) { - WindowPtr pChild; - int i; - while (pWin) { - pChild = pWin -> firstChild; + WindowPtr pChild = pWin -> firstChild; - for (i = 0; i < indent; i++) - { - fprintf(stderr, " "); - } + fprintf(stderr, "%*s", indent, ""); nxagentInternalWindowInfo(pWin, indent, TRUE); @@ -1021,7 +992,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) case doDebugTree: { - fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n"); + fprintf(stderr, "\n========== nxagentRemoteWindowsTree ============\n"); nxagentRemoteWindowsTree(nxagentWindow(screenInfo.screens[0]->root), 0); fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n"); -- cgit v1.2.3 From 7404d2178e7877cc3b92b0241df800e0963342b9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 30 Jun 2019 17:35:47 +0200 Subject: Events.c: fix wrong returncode interpretation XGetWMName returns non-zero on success The result was that no window names were displayed in DEBUG_TREE remote windows tree output. --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 1a3085448..8f68084a4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -372,7 +372,7 @@ void nxagentRemoteWindowID(Window window, Bool newline) #else - if (XGetWMName(nxagentDisplay, window, &tp) != 0) + if (XGetWMName(nxagentDisplay, window, &tp) == 0) { fprintf(stderr, " (has no name) "); } -- cgit v1.2.3 From 94c7091bcece8df786470888e003155dab13bf6c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 30 Jun 2019 17:55:51 +0200 Subject: Events.c: add FIXME --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 8f68084a4..b33ede2c8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -452,6 +452,19 @@ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine) /* * Walk remote windows tree. + * + * FIXME: + * ========== nxagentRemoteWindowsTree ============ + * + * Root Window ID: 0x169 (the root window) (has no name) + * Parent window ID: 0x2a00063 "NX Agent" + * 0 children. + * + * ========== nxagentInternalWindowsTree ========== + * Window ID=[0x9d] Remote ID=[0x2a0007e] Name: ( has no name ) + * x=0 y=0 width=1440 height=810 class=InputOutput map_state=IsViewable override_redirect=No + * + * -> Internal root window's remote id is not listed in RemoteWindowsTree. */ void nxagentRemoteWindowsTree(Window window, int level) -- cgit v1.2.3 From 7fa6c88089bb0731ba7e1c3c4e0a25acdff4e521 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 30 Jun 2019 17:56:09 +0200 Subject: Events.c: identify internal root window in nxagentInternalWindowInfo --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index b33ede2c8..40779f9b9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -526,8 +526,8 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) int iReturnFormat; unsigned char *pszReturnData = NULL; - fprintf(stderr, "Window ID=[0x%lx] Remote ID=[0x%lx] ", pWin -> drawable.id, - nxagentWindow(pWin)); + fprintf(stderr, "Window ID=[0x%x] %s Remote ID=[0x%x] ", pWin -> drawable.id, + pWin->parent ? "" : "(the root window)", nxagentWindow(pWin)); result = GetWindowProperty(pWin, MakeAtom("WM_NAME", 7, False) , 0, sizeof(CARD32), False, AnyPropertyType, -- cgit v1.2.3 From c539e0ca5c9d23567e7cd9a60a375f73ee4166d7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 30 Jun 2019 15:55:26 +0200 Subject: NXproperty.c: reformat GetWindowProperty to increase readability --- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 47 +++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 9d8a46c4f..a0c355b41 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -549,14 +549,17 @@ ProcGetProperty(ClientPtr client) #ifdef NXAGENT_CLIPBOARD /* GetWindowProperty clipboard use only */ +/* FIXME: that's wrong, it is also called in Window.c and Events. */ +/* FIXME: should be moved to a different file, is not derived from + dix */ int GetWindowProperty(pWin, property, longOffset, longLength, delete, type, actualType, format, nItems, bytesAfter, propData ) WindowPtr pWin; Atom property; - long longOffset; - long longLength; - Bool delete; + long longOffset; + long longLength; + Bool delete; Atom type; Atom *actualType; int *format; @@ -569,24 +572,24 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (!pWin) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: invalid window\n", __func__); -#endif + #endif return BadWindow; } if (!ValidAtom(property)) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: invalid atom [%d]\n", __func__, property); -#endif + #endif return(BadAtom); } if ((type != AnyPropertyType) && !ValidAtom(type)) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: invalid type [%d]\n", __func__, type); -#endif + #endif return(BadAtom); } @@ -604,14 +607,14 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (!pProp) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: property not found [%d]\n", __func__, property); -#endif + #endif return (BadAtom); } /* If the request type and actual type don't match. Return the - property information, but not the data. */ + property information, but not the data. */ if (((type != pProp->type) && (type != AnyPropertyType)) @@ -624,20 +627,20 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, return(Success); } -/* - * Return type, format, value to client - */ + /* + * Return type, format, value to client + */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = longOffset << 2; - /* If longOffset is invalid such that it causes "len" to - be negative, it's a value error. */ + /* If longOffset is invalid such that it causes "len" to + be negative, it's a value error. */ if (n < ind) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "%s: negative property len\n", __func__); -#endif + #endif return BadValue; } @@ -650,9 +653,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (delete && (*bytesAfter == 0)) { /* send the event */ - xEvent event; - - memset(&event, 0, sizeof(xEvent)); + xEvent event = {0}; event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; @@ -663,7 +664,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, if (len) { - *propData = (unsigned char *)(pProp->data) + ind; + *propData = (unsigned char *)(pProp->data) + ind; } if (delete && (*bytesAfter == 0)) -- cgit v1.2.3 From 41e1d4961d473674e286743a282151a2800ee5b7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 3 Jul 2019 22:05:58 +0200 Subject: nxagent: drop unused DisplayLatency --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 12 ------------ nx-X11/programs/Xserver/hw/nxagent/Options.c | 1 - nx-X11/programs/Xserver/hw/nxagent/Options.h | 10 ---------- 3 files changed, 23 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index bf64369eb..a27da0289 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -211,12 +211,8 @@ int nxagentQueryAtoms(ScreenPtr pScreen) int num_of_atoms = NXAGENT_NUMBER_OF_ATOMS; char *names[NXAGENT_NUMBER_OF_ATOMS]; - unsigned long int startingTime = GetTimeInMillis(); - #ifdef TEST fprintf(stderr, "nxagentQueryAtoms: Going to create the intern atoms on real display.\n"); - - fprintf(stderr, "nxagentQueryAtoms: Starting time is [%ld].\n", startingTime); #endif nxagentPrintAtomMapInfo("nxagentQueryAtoms: Entering"); @@ -317,14 +313,6 @@ int nxagentQueryAtoms(ScreenPtr pScreen) fprintf(stderr, "nxagentQueryAtoms: Created intern atom [%s] with id [%ld].\n", names[i], nxagentAtoms[i]); } - - #endif - - nxagentChangeOption(DisplayLatency, GetTimeInMillis() - startingTime); - - #ifdef TEST - fprintf(stderr, "nxagentQueryAtoms: Ending time is [%ld] reference latency is [%d] Ms.\n", - GetTimeInMillis(), nxagentOption(DisplayLatency)); #endif nxagentPrintAtomMapInfo("nxagentQueryAtoms: Exiting"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c index 10e006a23..5c3a44c23 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c @@ -133,7 +133,6 @@ void nxagentInitOptions(void) nxagentOptions.Xdmcp = 0; - nxagentOptions.DisplayLatency = 0; nxagentOptions.DisplayBuffer = UNDEFINED; nxagentOptions.DisplayCoalescence = 0; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h index 88bb60e8f..02e1890b3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h @@ -294,16 +294,6 @@ typedef struct _AgentOptions int Xdmcp; - /* - * Latency of the link. It is simply set - * to a reference value, calculated based - * on the time required to complete the - * query of the agent's atoms at session - * startup. - */ - - int DisplayLatency; - /* * Size of the Xlib display buffer. The * default is set according to the link -- cgit v1.2.3 From 2589a1349c70d965065333423b615a3cef6754a3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 2 Jul 2019 19:55:20 +0200 Subject: Events.c: fix wrong size in format specification --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 40779f9b9..512a55f99 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -345,7 +345,7 @@ void nxagentRemoteWindowID(Window window, Bool newline) XTextProperty tp; #endif - fprintf(stderr, "0x%lx", window); + fprintf(stderr, "0x%x", window); if (!window) { -- cgit v1.2.3 From 7a2836f8db9941aaefd88b595f43589ff513b53e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 2 Jul 2019 21:03:10 +0200 Subject: Update currentTime in dispatch loop commit 312910b4e34215aaa50fc0c6092684d5878dc32f Author: Chase Douglas Date: Wed Apr 18 11:15:40 2012 -0700 Update currentTime in dispatch loop A request, like input device grabs, may check a request timestamp against currentTime. It is possible for currentTime to lag a previously sent event timestamp. If the client makes a request based on such an event timestamp, the request may fail the validity check against currentTime unless we always update the time before processing the request. Signed-off-by: Chase Douglas Reviewed-by: Peter Hutterer --- nx-X11/programs/Xserver/dix/dispatch.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index d656da748..f80cec0dd 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -407,6 +407,9 @@ Dispatch(void) } /* now, finally, deal with client requests */ + /* Update currentTime so request time checks, such as for input + * device grabs, are calculated correctly */ + UpdateCurrentTimeIf(); result = ReadRequestFromClient(client); if (result <= 0) { -- cgit v1.2.3 From 084d9cb546c7d6aa045522af86e5829462717096 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 24 Jun 2019 21:39:45 +0200 Subject: NXdispatch.c: replace hardcoded values by variables from Clipboard.c --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 6 ++--- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 31 ++++++++++++++----------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 024d685ba..a98d07413 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -74,9 +74,9 @@ Atom serverCutProperty; Atom clientCutProperty; static Window serverWindow; -static const int nxagentPrimarySelection = 0; -static const int nxagentClipboardSelection = 1; -static const int nxagentMaxSelections = 2; +const int nxagentPrimarySelection = 0; +const int nxagentClipboardSelection = 1; +const int nxagentMaxSelections = 2; typedef struct _SelectionOwner { diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 10616834e..f68623740 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -194,6 +194,11 @@ extern int nxagentMaxAllowedResets; extern int nxagentFindClientResource(int, RESTYPE, void *); +#ifdef NXAGENT_CLIPBOARD +extern int nxagentPrimarySelection; +extern int nxagentClipboardSelection; +extern int nxagentMaxSelections; +#endif void InitSelections() @@ -206,23 +211,23 @@ InitSelections() #ifdef NXAGENT_CLIPBOARD { Selection *newsels; - newsels = (Selection *)malloc(2 * sizeof(Selection)); + newsels = (Selection *)malloc(nxagentMaxSelections * sizeof(Selection)); if (!newsels) return; - NumCurrentSelections += 2; + NumCurrentSelections += nxagentMaxSelections; CurrentSelections = newsels; - CurrentSelections[0].selection = XA_PRIMARY; - CurrentSelections[0].lastTimeChanged = ClientTimeToServerTime(0); - CurrentSelections[0].window = screenInfo.screens[0]->root->drawable.id; - CurrentSelections[0].pWin = NULL; - CurrentSelections[0].client = NullClient; - - CurrentSelections[1].selection = MakeAtom("CLIPBOARD", 9, 1); - CurrentSelections[1].lastTimeChanged = ClientTimeToServerTime(0); - CurrentSelections[1].window = screenInfo.screens[0]->root->drawable.id; - CurrentSelections[1].pWin = NULL; - CurrentSelections[1].client = NullClient; + CurrentSelections[nxagentPrimarySelection].selection = XA_PRIMARY; + CurrentSelections[nxagentPrimarySelection].lastTimeChanged = ClientTimeToServerTime(0); + CurrentSelections[nxagentPrimarySelection].window = screenInfo.screens[0]->root->drawable.id; + CurrentSelections[nxagentPrimarySelection].pWin = NULL; + CurrentSelections[nxagentPrimarySelection].client = NullClient; + + CurrentSelections[nxagentClipboardSelection].selection = MakeAtom("CLIPBOARD", 9, 1); + CurrentSelections[nxagentClipboardSelection].lastTimeChanged = ClientTimeToServerTime(0); + CurrentSelections[nxagentClipboardSelection].window = screenInfo.screens[0]->root->drawable.id; + CurrentSelections[nxagentClipboardSelection].pWin = NULL; + CurrentSelections[nxagentClipboardSelection].client = NullClient; } #endif -- cgit v1.2.3 From 157c8c7f37a9d7f613d273e32aac40f8a7df1d36 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 24 Jun 2019 21:30:11 +0200 Subject: Clipboard.c: fix wrong variable being printed in debugging output --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index a98d07413..8da1dd285 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -304,8 +304,8 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, " lastClientProperty (Atom) [% 4d][%s]\n", lastClientProperty, NameForAtom(lastClientProperty)); fprintf(stderr, " lastClientSelection (Atom) [% 4d][%s]\n", lastClientSelection, NameForAtom(lastClientSelection)); fprintf(stderr, " lastClientTarget (Atom) [% 4d][%s]\n", lastClientTarget, NameForAtom(lastClientTarget)); - fprintf(stderr, " lastClientTime (Time) [%u]\n", lastServerTime); - fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastServerReqTime); + 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)); -- cgit v1.2.3 From 59f1d37376d20d855d93fae4919bf81995c24281 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 21 Jun 2019 15:17:04 +0200 Subject: NXrender.c: fix possible memory leak --- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 7456bd3a5..8a288b485 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -715,6 +715,9 @@ ProcRenderTrapezoids (ClientPtr client) { if (pFormat != NULL) { + if (nxagentTrapezoidExtents && nxagentTrapezoidExtents != NullBox) + free(nxagentTrapezoidExtents); + nxagentTrapezoidExtents = (BoxPtr) malloc(sizeof(BoxRec)); miTrapezoidBounds (ntraps, (xTrapezoid *) &stuff[1], nxagentTrapezoidExtents); -- cgit v1.2.3 From 3a581f165ed047833bcf6827e4448b9a9bb0759b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 8 Nov 2018 00:12:56 +0100 Subject: {render,randr}/Imakefile: remove hw/kdrive from include path we don't have that... --- nx-X11/programs/Xserver/randr/Imakefile | 2 +- nx-X11/programs/Xserver/render/Imakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/randr/Imakefile b/nx-X11/programs/Xserver/randr/Imakefile index 6c5c89450..2e21efe4c 100644 --- a/nx-X11/programs/Xserver/randr/Imakefile +++ b/nx-X11/programs/Xserver/randr/Imakefile @@ -62,7 +62,7 @@ $(NULL) INCLUDES = -I../include -I../mi \ - -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + -I../fb -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I../render \ `pkg-config --cflags-only-I pixman-1` diff --git a/nx-X11/programs/Xserver/render/Imakefile b/nx-X11/programs/Xserver/render/Imakefile index 235acf1ed..2246a35d9 100644 --- a/nx-X11/programs/Xserver/render/Imakefile +++ b/nx-X11/programs/Xserver/render/Imakefile @@ -44,7 +44,7 @@ NXAGENT_SKIP_OBJS = \ $(NULL) INCLUDES = -I. -I../include -I../mi \ - -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + -I../fb -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I../Xext \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln -- cgit v1.2.3 From db0187b052b1db10307362ba8456237deceadff2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 7 Nov 2018 19:50:21 +0100 Subject: code-versions.txt: Update composite version turns out that our composite is much newer than xorg 6.9/7.0... --- nx-X11/programs/Xserver/code-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/code-versions.txt b/nx-X11/programs/Xserver/code-versions.txt index 37a5f9d44..fa6bf05a8 100644 --- a/nx-X11/programs/Xserver/code-versions.txt +++ b/nx-X11/programs/Xserver/code-versions.txt @@ -4,7 +4,7 @@ backported, it rather describes what functionality level the modules are at (roughly): module xorg version -composite 6.9/7.0 +composite 1.12 (~ 9838b70 2012-03-21 Introduce a consistent coding style [Keith Packard]) damageext 6.9/7.0 dbe 1.4.2 dix 1.3.0.0 -- cgit v1.2.3 From 9da26af354cbc558ea716fb1f21b3a0587073487 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 9 Nov 2018 00:23:20 +0100 Subject: code-versions.txt: adapt os version information --- nx-X11/programs/Xserver/code-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/code-versions.txt b/nx-X11/programs/Xserver/code-versions.txt index fa6bf05a8..f5bb33621 100644 --- a/nx-X11/programs/Xserver/code-versions.txt +++ b/nx-X11/programs/Xserver/code-versions.txt @@ -12,7 +12,7 @@ fb 7.1/1.1 GL 6.9/7.0 mi 7.1/1.1 miext 7.1/1.1 -os 7.1/1.1 +os ? 7.1/1.1 + many backports, some of them from 2017 randr 1.18.0 record 1.4.2 render 6.9/7.0 -- cgit v1.2.3 From 2fbefa708eb9d273fa5bdaa51a7495c17ef83e53 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 9 Nov 2018 01:54:22 +0100 Subject: Events.c: code improvements (mainly scope) --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 116 ++++++++++------------------ 1 file changed, 41 insertions(+), 75 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 512a55f99..111212601 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -379,7 +379,7 @@ void nxagentRemoteWindowID(Window window, Bool newline) else if (tp.nitems > 0) { int count = 0; - int i, ret; + int ret; char **list = NULL; fprintf(stderr, " \""); @@ -388,7 +388,7 @@ void nxagentRemoteWindowID(Window window, Bool newline) if ((ret == Success || ret > 0) && list != NULL) { - for (i = 0; i < count; i++) + for (int i = 0; i < count; i++) { fprintf(stderr, "%s", list[i]); } @@ -510,7 +510,7 @@ void nxagentRemoteWindowsTree(Window window, int level) nxagentRemoteWindowsTree(childList[i], level + 1); } - SAFE_XFree((char *) childList); + SAFE_XFree(childList); } /* @@ -1635,21 +1635,16 @@ FIXME: Don't enqueue the KeyRelease event if the key was * Force the keys all up when focus is lost. */ - int i, k; - int mask = 1; - CARD8 val; - - XEvent xM; - memset(&xM, 0, sizeof(XEvent)); - - for (i = 0; i < DOWN_LENGTH; i++) /* input.h */ + for (int i = 0; i < DOWN_LENGTH; i++) /* input.h */ { - val = inputInfo.keyboard->key->down[i]; + CARD8 val = inputInfo.keyboard->key->down[i]; if (val != 0) { - for (k = 0; k < 8; k++) + for (int k = 0; k < 8; k++) { + const int mask = 1; + if (val & (mask << k)) { #ifdef NXAGENT_FIXKEYS_DEBUG @@ -1667,6 +1662,9 @@ FIXME: Don't enqueue the KeyRelease event if the key was if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow)) { + XEvent xM; + + memset(&xM, 0, sizeof(XEvent)); xM.type = KeyRelease; xM.xkey.display = nxagentDisplay; xM.xkey.type = KeyRelease; @@ -3210,12 +3208,10 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) #ifdef TEST { - WindowPtr pSib; - fprintf(stderr, "nxagentCheckWindowConfiguration: Before restacking top level window [%p]\n", (void *) nxagentWindowPtr(X -> window)); - for (pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib) + for (WindowPtr pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib) { fprintf(stderr, "nxagentCheckWindowConfiguration: Top level window: [%p].\n", (void *) pSib); @@ -3574,16 +3570,13 @@ int nxagentHandleReparentNotify(XEvent* X) if (nxagentOption(Rootless)) { - WindowPtr pWin; - XlibWindow w; XlibWindow root_return = 0; XlibWindow parent_return = 0; XlibWindow *children_return = NULL; unsigned int nchildren_return = 0; Status result; - - pWin = nxagentWindowPtr(X -> xreparent.window); + WindowPtr pWin = nxagentWindowPtr(X -> xreparent.window); #ifdef TEST @@ -3677,10 +3670,8 @@ int nxagentHandleReparentNotify(XEvent* X) XlibWindow junk; XlibWindow *childrenReturn = NULL; unsigned int nchildrenReturn = 0; - Status result; XWindowAttributes attributes; int x, y; - int xParent, yParent; /* * Calculate the absolute upper-left X e Y @@ -3712,10 +3703,12 @@ int nxagentHandleReparentNotify(XEvent* X) if (w != DefaultRootWindow(nxagentDisplay)) { + int xParent, yParent; + do { - result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn, - &childrenReturn, &nchildrenReturn); + Status result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn, + &childrenReturn, &nchildrenReturn); SAFE_XFree(childrenReturn); @@ -3760,14 +3753,13 @@ int nxagentHandleReparentNotify(XEvent* X) void nxagentEnableKeyboardEvents(void) { - int i; Mask mask = nxagentGetDefaultEventMask(); mask |= NXAGENT_KEYBOARD_EVENT_MASK; nxagentSetDefaultEventMask(mask); - for (i = 0; i < nxagentNumScreens; i++) + for (int i = 0; i < nxagentNumScreens; i++) { XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); } @@ -3779,14 +3771,13 @@ void nxagentEnableKeyboardEvents(void) void nxagentDisableKeyboardEvents(void) { - int i; Mask mask = nxagentGetDefaultEventMask(); mask &= ~NXAGENT_KEYBOARD_EVENT_MASK; nxagentSetDefaultEventMask(mask); - for (i = 0; i < nxagentNumScreens; i++) + for (int i = 0; i < nxagentNumScreens; i++) { XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); } @@ -3796,14 +3787,13 @@ void nxagentDisableKeyboardEvents(void) void nxagentEnablePointerEvents(void) { - int i; Mask mask = nxagentGetDefaultEventMask(); mask |= NXAGENT_POINTER_EVENT_MASK; nxagentSetDefaultEventMask(mask); - for (i = 0; i < nxagentNumScreens; i++) + for (int i = 0; i < nxagentNumScreens; i++) { XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); } @@ -3811,14 +3801,13 @@ void nxagentEnablePointerEvents(void) void nxagentDisablePointerEvents(void) { - int i; Mask mask = nxagentGetDefaultEventMask(); mask &= ~NXAGENT_POINTER_EVENT_MASK; nxagentSetDefaultEventMask(mask); - for (i = 0; i < nxagentNumScreens; i++) + for (int i = 0; i < nxagentNumScreens; i++) { XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); } @@ -4084,9 +4073,7 @@ void nxagentHandleCollectPropertyEvent(XEvent *X) unsigned long ulReturnBytesLeft; unsigned char *pszReturnData = NULL; int result; - int resource; - - resource = X -> xclient.data.l[1]; + int resource = X -> xclient.data.l[1]; if (X -> xclient.data.l[2] == False) { @@ -4212,12 +4199,9 @@ void nxagentSynchronizeExpose(void) int nxagentLookupByWindow(WindowPtr pWin) { - int i; - int j; - - for (j = 0; j < nxagentExposeQueue.length; j++) + for (int j = 0; j < nxagentExposeQueue.length; j++) { - i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; + int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; if (nxagentExposeQueue.exposures[i].pWindow == pWin && !nxagentExposeQueue.exposures[i].remoteRegionIsCompleted) @@ -4231,28 +4215,18 @@ int nxagentLookupByWindow(WindowPtr pWin) void nxagentRemoveDuplicatedKeys(XEvent *X) { - _XQEvent *prev; - _XQEvent *qelt; - - _XQEvent *qeltKeyRelease; - _XQEvent *prevKeyRelease; + _XQEvent *qelt = nxagentDisplay -> head; KeyCode lastKeycode = X -> xkey.keycode; - qelt = nxagentDisplay -> head; - if (qelt == NULL) { #ifdef TEST - int more; - fprintf(stderr, "nxagentRemoveDuplicatedKeys: Trying to read more events " "from the X server.\n"); - more = nxagentReadEvents(nxagentDisplay); - - if (more > 0) + if (nxagentReadEvents(nxagentDisplay) > 0) { fprintf(stderr, "nxagentRemoveDuplicatedKeys: Successfully read more events " "from the X server.\n"); @@ -4269,6 +4243,10 @@ void nxagentRemoveDuplicatedKeys(XEvent *X) if (qelt != NULL) { + _XQEvent *prev; + _XQEvent *qeltKeyRelease; + _XQEvent *prevKeyRelease; + prev = qeltKeyRelease = prevKeyRelease = NULL; LockDisplay(nxagentDisplay); @@ -4371,23 +4349,18 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr rect) int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) { - RegionPtr exposeRgn; - RegionPtr remoteExposeRgn; + RegionPtr remoteExposeRgn = (RegionRec *) ptr; #ifdef DEBUG - BoxRec box; - fprintf(stderr, "nxagentClipAndSendExpose: Called.\n"); #endif - remoteExposeRgn = (RegionRec *) ptr; - if (pWin -> drawable.class != InputOnly) { - exposeRgn = RegionCreate(NULL, 1); + RegionPtr exposeRgn = RegionCreate(NULL, 1); #ifdef DEBUG - box = *RegionExtents(remoteExposeRgn); + BoxRec box = *RegionExtents(remoteExposeRgn); fprintf(stderr, "nxagentClipAndSendExpose: Root expose extents: [%d] [%d] [%d] [%d].\n", box.x1, box.y1, box.x2, box.y2); @@ -4506,14 +4479,12 @@ int nxagentUserInput(void *p) int nxagentHandleRRScreenChangeNotify(XEvent *X) { - XRRScreenChangeNotifyEvent *Xr; + XRRScreenChangeNotifyEvent *Xr = (XRRScreenChangeNotifyEvent *) X; #ifdef DEBUG fprintf(stderr, "nxagentHandleRRScreenChangeNotify called.\n"); #endif - Xr = (XRRScreenChangeNotifyEvent *) X; - nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height, Xr -> mwidth, Xr -> mheight); @@ -4556,12 +4527,9 @@ int nxagentPendingEvents(Display *dpy) } else { - int result; int readable; - result = NXTransReadable(dpy -> fd, &readable); - - if (result == 0) + if (NXTransReadable(dpy -> fd, &readable) == 0) { if (readable > 0) { @@ -4711,9 +4679,7 @@ static const char *nxagentGrabStateToString(int state) void nxagentDumpInputDevicesState(void) { - int i, k; int mask = 1; - CARD8 val; DeviceIntPtr dev; GrabPtr grab; WindowPtr pWin = NULL; @@ -4723,13 +4689,13 @@ void nxagentDumpInputDevicesState(void) dev = inputInfo.keyboard; - for (i = 0; i < DOWN_LENGTH; i++) + for (int i = 0; i < DOWN_LENGTH; i++) { - val = dev -> key -> down[i]; + CARD8 val = dev -> key -> down[i]; if (val != 0) { - for (k = 0; k < 8; k++) + for (int k = 0; k < 8; k++) { if (val & (mask << k)) { @@ -4784,13 +4750,13 @@ void nxagentDumpInputDevicesState(void) dev = inputInfo.pointer; - for (i = 0; i < DOWN_LENGTH; i++) + for (int i = 0; i < DOWN_LENGTH; i++) { - val = dev -> button -> down[i]; + CARD8 val = dev -> button -> down[i]; if (val != 0) { - for (k = 0; k < 8; k++) + for (int k = 0; k < 8; k++) { if (val & (mask << k)) { -- cgit v1.2.3 From 6dd6e695a51ccaca7fbf4a9886d769b38a1c608b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 23 Jul 2019 21:24:44 +0200 Subject: Atoms.c: add FIXME --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 1 + 1 file changed, 1 insertion(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index a27da0289..91cdd851e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -161,6 +161,7 @@ static void finishWMDetection(Bool verbose) void nxagentWMDetect() { + /* FIXME: verbose is always false, there's no code to set it to true */ Bool verbose = False; Bool windowManagerWasRunning = nxagentWMIsRunning; -- cgit v1.2.3 From a61102b6208cd61ef8a19f242aedb579799e4473 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 23 Jul 2019 21:25:02 +0200 Subject: Atoms.c: fix wrong variable reference --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 91cdd851e..fa4c45b9a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -670,7 +670,7 @@ Atom nxagentLocalToRemoteAtom(Atom local) if (!ValidAtom(local)) { #ifdef DEBUG - fprintf(stderr, "%s: local [%d] is no valid - returning None\n", __func__, remote); + fprintf(stderr, "%s: local [%d] is no valid - returning None\n", __func__, local); #endif return None; } -- cgit v1.2.3 From 1f71a75f583c54b07a62f181d7301ffa1ade55e8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 23 Jul 2019 21:25:41 +0200 Subject: Atoms.c: code cleanup no functional change --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 128 ++++++++++++----------------- 1 file changed, 54 insertions(+), 74 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index fa4c45b9a..a52cb9658 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -179,8 +179,6 @@ void nxagentWMDetect() int nxagentInitAtoms(WindowPtr pWin) { - Atom atom; - /* * Value of nxagentAtoms[8] is "NX_AGENT_SIGNATURE". * @@ -189,39 +187,43 @@ int nxagentInitAtoms(WindowPtr pWin) * run nested. */ - atom = MakeAtom(nxagentAtomNames[8], strlen(nxagentAtomNames[8]), 1); + Atom atom = MakeAtom(nxagentAtomNames[8], strlen(nxagentAtomNames[8]), 1); if (atom == None) { #ifdef PANIC - fprintf(stderr, "nxagentInitAtoms: PANIC! Could not create [%s] atom.\n", + fprintf(stderr, "%s: PANIC! Could not create [%s] atom.\n", __func__, nxagentAtomNames[8]); #endif return -1; } - - return 1; + else + { + #ifdef TEST + fprintf(stderr, "nxagentInitAtoms: atom [%s] created with value [%d].\n", + nxagentAtomNames[8], atom); + #endif + return 1; + } } int nxagentQueryAtoms(ScreenPtr pScreen) { - int i; static unsigned long atomGeneration = 1; int num_of_atoms = NXAGENT_NUMBER_OF_ATOMS; char *names[NXAGENT_NUMBER_OF_ATOMS]; #ifdef TEST - fprintf(stderr, "nxagentQueryAtoms: Going to create the intern atoms on real display.\n"); + fprintf(stderr, "%s: Going to create the intern atoms on real display.\n", __func__); #endif nxagentPrintAtomMapInfo("nxagentQueryAtoms: Entering"); - for (i = 0; i < num_of_atoms; i++) + for (int i = 0; i < num_of_atoms; i++) { names[i] = nxagentAtomNames[i]; - nxagentAtoms[i] = None; } @@ -248,10 +250,10 @@ int nxagentQueryAtoms(ScreenPtr pScreen) if (atomGeneration != serverGeneration) { #ifdef WARNING - fprintf(stderr, "nxagentQueryAtoms: The nxagent has been reset with server %ld atom %ld.\n", + fprintf(stderr, "%s: The nxagent has been reset with server %ld atom %ld.\n", __func__, serverGeneration, atomGeneration); - fprintf(stderr, "nxagentQueryAtoms: Forcing a sync to detect the window manager.\n"); + fprintf(stderr, "%s: Forcing a sync to detect the window manager.\n", __func__); #endif atomGeneration = serverGeneration; @@ -309,9 +311,9 @@ int nxagentQueryAtoms(ScreenPtr pScreen) #ifdef TEST - for (i = 0; i < num_of_atoms; i++) + for (int i = 0; i < num_of_atoms; i++) { - fprintf(stderr, "nxagentQueryAtoms: Created intern atom [%s] with id [%ld].\n", + fprintf(stderr, "%s: Created intern atom [%s] with id [%ld].\n", __func__, names[i], nxagentAtoms[i]); } #endif @@ -353,9 +355,8 @@ static void nxagentExpandCache(void) } /* - * Check if there is space left on the map - * and manage the possible consequent allocation, - * then cache the atom-couple. + * Check if there is space left on the map and manage the possible + * consequent allocation, then cache the atom-couple. */ static void nxagentWriteAtom(Atom local, Atom remote, const char *string, Bool duplicate) @@ -363,10 +364,9 @@ static void nxagentWriteAtom(Atom local, Atom remote, const char *string, Bool d const char *s; /* - * We could remove this string duplication if - * we know for sure that the server will not - * reset, since only at reset the dix layer - * free all the atom names. + * 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) @@ -399,19 +399,16 @@ static void nxagentWriteAtom(Atom local, Atom remote, const char *string, Bool d } /* - * 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. + * 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. */ void nxagentResetAtomMap(void) { - unsigned i; - nxagentPrintAtomMapInfo("nxagentResetAtomMap: Entering"); - for (i = 0; i < privLastAtom; i++) + for (unsigned int i = 0; i < privLastAtom; i++) { privAtomMap[i].local = None; } @@ -426,16 +423,13 @@ void nxagentResetAtomMap(void) static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) { - XlibAtom *atom_list; - char **name_list; unsigned int i; - int ret_value = 0; int list_size = count + privLastAtom; nxagentPrintAtomMapInfo("nxagentInitAtomMap: Entering"); - atom_list = malloc((list_size) * sizeof(*atom_list)); - name_list = malloc((list_size) * sizeof(char*)); + XlibAtom *atom_list = malloc((list_size) * sizeof(*atom_list)); + char **name_list = malloc((list_size) * sizeof(char*)); if ((atom_list == NULL) || (name_list == NULL)) { @@ -459,7 +453,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) * ... if successful cache them too. */ - ret_value = XInternAtoms(nxagentDisplay, name_list, list_size, False, atom_list); + int ret_value = XInternAtoms(nxagentDisplay, name_list, list_size, False, atom_list); if (ret_value == 0) { @@ -517,22 +511,19 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) } /* - * If the nxagent has been reset, - * the local value of the atoms stored - * in cache could have the value None, - * do not call this function with None. + * If the nxagent has been reset, the local value of the atoms stored + * in cache could have the value None, do not call this function with + * None. */ static AtomMap* nxagentFindAtomByLocalValue(Atom local) { - unsigned i; - if (!ValidAtom(local)) { return NULL; } - for (i = 0; i < privLastAtom; i++) + for (unsigned int i = 0; i < privLastAtom; i++) { if (local == privAtomMap[i].local) { @@ -545,14 +536,12 @@ static AtomMap* nxagentFindAtomByLocalValue(Atom local) static AtomMap* nxagentFindAtomByRemoteValue(Atom remote) { - unsigned i; - if (remote == None || remote == BAD_RESOURCE) { return NULL; } - for (i = 0; i < privLastAtom; i++) + for (unsigned int i = 0; i < privLastAtom; i++) { if (remote == privAtomMap[i].remote) { @@ -565,9 +554,7 @@ static AtomMap* nxagentFindAtomByRemoteValue(Atom remote) static AtomMap* nxagentFindAtomByName(char *string, unsigned int length) { - unsigned i; - - for (i = 0; i < privLastAtom; i++) + for (unsigned int i = 0; i < privLastAtom; i++) { if ((length == privAtomMap[i].length) && (strcmp(string, privAtomMap[i].string) == 0)) @@ -591,7 +578,6 @@ static AtomMap* nxagentFindAtomByName(char *string, unsigned int length) Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) { - Atom local; AtomMap *current; /* @@ -599,7 +585,7 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) * our nxagentFindAtomByName. */ - local = MakeAtom(string, length, Makeit); + Atom local = MakeAtom(string, length, Makeit); if (!ValidAtom(local)) { @@ -623,7 +609,7 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) if ((current = nxagentFindAtomByName(string, length))) { /* - * Found Cached by name. + * Found cached by name. * It means that nxagent has been reset, * but not the xserver so we still have cached its atoms. */ @@ -634,13 +620,11 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) } /* - * We really have to ask Xserver for it. + * We really have to ask the Xserver for it. */ { - Atom remote; - - remote = XInternAtom(nxagentDisplay, string, !Makeit); + Atom remote = XInternAtom(nxagentDisplay, string, !Makeit); if (remote == None) { @@ -659,10 +643,6 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) Atom nxagentLocalToRemoteAtom(Atom local) { - AtomMap *current; - const char *string; - Atom remote; - #ifdef TEST fprintf(stderr, "%s: entering\n", __func__); #endif @@ -683,7 +663,9 @@ Atom nxagentLocalToRemoteAtom(Atom local) return local; } - if ((current = nxagentFindAtomByLocalValue(local))) + AtomMap *current = nxagentFindAtomByLocalValue(local); + + if (current) { #ifdef TEST fprintf(stderr, "%s: local [%d] -> remote [%d]\n", __func__, local, current->remote); @@ -691,9 +673,9 @@ Atom nxagentLocalToRemoteAtom(Atom local) return current->remote; } - string = NameForAtom(local); + const char *string = NameForAtom(local); - remote = XInternAtom(nxagentDisplay, string, False); + Atom remote = XInternAtom(nxagentDisplay, string, False); if (remote == None) { @@ -715,10 +697,6 @@ Atom nxagentLocalToRemoteAtom(Atom local) Atom nxagentRemoteToLocalAtom(Atom remote) { - AtomMap *current; - char *string; - Atom local; - if (remote == None || remote == BAD_RESOURCE) { #ifdef DEBUG @@ -735,11 +713,13 @@ Atom nxagentRemoteToLocalAtom(Atom remote) return remote; } - if ((current = nxagentFindAtomByRemoteValue(remote))) + AtomMap *current = nxagentFindAtomByRemoteValue(remote); + + if (current) { if (!ValidAtom(current->local)) { - local = MakeAtom(current->string, current->length, True); + Atom local = MakeAtom(current->string, current->length, True); if (ValidAtom(local)) { @@ -761,14 +741,16 @@ Atom nxagentRemoteToLocalAtom(Atom remote) return current->local; } - if ((string = XGetAtomName(nxagentDisplay, remote))) + char *string = XGetAtomName(nxagentDisplay, remote); + + if (string) { - local = MakeAtom(string, strlen(string), True); + Atom local = MakeAtom(string, strlen(string), True); if (!ValidAtom(local)) { #ifdef WARNING - fprintf(stderr, "nxagentRemoteToLocalAtom: WARNING MakeAtom failed.\n"); + fprintf(stderr, "%s: WARNING MakeAtom failed.\n", __func__); #endif local = None; @@ -785,7 +767,7 @@ Atom nxagentRemoteToLocalAtom(Atom remote) } #ifdef WARNING - fprintf(stderr, "nxagentRemoteToLocalAtom: WARNING failed to get name from remote atom.\n"); + fprintf(stderr, "%s: WARNING failed to get name from remote atom.\n", __func__); #endif return None; @@ -795,13 +777,11 @@ Atom nxagentRemoteToLocalAtom(Atom remote) static void nxagentPrintAtomMapInfo(char *message) { - unsigned i; - fprintf(stderr, "--------------- Atom map in context [%s] ----------------------\n", message); fprintf(stderr, "nxagentPrintAtomMapInfo: Map at [%p] size [%d] number of entry [%d] auto increment [%d].\n", (void*) privAtomMap, privLastAtom, privAtomMapSize, NXAGENT_ATOM_MAP_SIZE_INCREMENT); - for (i = 0; i < privLastAtom; i++) + for (unsigned int i = 0; i < privLastAtom; i++) { fprintf(stderr, "[%5.1d] local: %6.1u - remote: %6.1u - [%p] %s\n", i, privAtomMap[i].local, -- cgit v1.2.3 From b8751fca890b9714450b158d8405850c6856a753 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 23 Jul 2019 21:29:27 +0200 Subject: Atoms.c: remove unused parameter from nxagentInitAtoms --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index a52cb9658..e65ddaac3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -177,7 +177,7 @@ void nxagentWMDetect() finishWMDetection(verbose); } -int nxagentInitAtoms(WindowPtr pWin) +int nxagentInitAtoms() { /* * Value of nxagentAtoms[8] is "NX_AGENT_SIGNATURE". diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index 391e06181..2e11c7c69 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h @@ -41,7 +41,7 @@ extern Bool nxagentWMIsRunning; * to the agent server. */ -int nxagentInitAtoms(WindowPtr pWin); +int nxagentInitAtoms(); /* * Query and create all the required atoms diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 3dcb552e5..c4991b014 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -204,7 +204,7 @@ InitRootWindow(WindowPtr pWin) fprintf(stderr, "InitRootWindow: Mapping default windows.\n"); #endif - nxagentInitAtoms(pWin); + nxagentInitAtoms(); nxagentInitClipboard(pWin); -- cgit v1.2.3 From 17e0265a49466acfcef1da026e22a79f5a89ba6d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 23 Jul 2019 21:31:40 +0200 Subject: Screen.c: fix: use bit operator, not logic operator --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 8285d464d..b3f4ccbc6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -4694,7 +4694,7 @@ void nxagentPrintGeometry(void) for (i = 0; i < screenInfo.numScreens; i++) { - if (nxagentPrintGeometryFlags && (1 << i)) + if (nxagentPrintGeometryFlags & (1 << i)) { fprintf(stderr, "Info: Screen [%d] resized to geometry [%dx%d] " "fullscreen [%d].\n", i, screenInfo.screens[i] -> width, -- cgit v1.2.3 From cccb25fa7b3fc15b62f5a989d4fb3e55e0eb66a2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 23 Jul 2019 22:30:33 +0200 Subject: Screen.c: code cleanup no functional change --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 436 +++++++++++++--------------- 1 file changed, 201 insertions(+), 235 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index b3f4ccbc6..01579581f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -268,8 +268,6 @@ void nxagentSetScreenInfo(ScreenInfo *screenInfo) void nxagentSetPixmapFormats(ScreenInfo *screenInfo) { - int i; - /* * Formats are created with no care of which are supported * on the real display. Creating only formats supported @@ -279,7 +277,7 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo) screenInfo -> numPixmapFormats = nxagentNumPixmapFormats; - for (i = 0; i < nxagentNumPixmapFormats; i++) + for (int i = 0; i < nxagentNumPixmapFormats; i++) { screenInfo -> formats[i].depth = nxagentPixmapFormats[i].depth; screenInfo -> formats[i].bitsPerPixel = nxagentPixmapFormats[i].bits_per_pixel; @@ -651,14 +649,12 @@ FIXME: Do we need to check the key grab if the Bool nxagentCreateScreenResources(ScreenPtr pScreen) { - Bool ret; - CreatePixmapProcPtr savedCreatePixmap = pScreen->CreatePixmap; ModifyPixmapHeaderProcPtr savedModifyPixmapHeader = pScreen->ModifyPixmapHeader; pScreen->CreatePixmap = fbCreatePixmap; pScreen->ModifyPixmapHeader = miModifyPixmapHeader; - ret = miCreateScreenResources(pScreen); + Bool ret = miCreateScreenResources(pScreen); pScreen->CreatePixmap = savedCreatePixmap; pScreen->ModifyPixmapHeader = savedModifyPixmapHeader; @@ -688,7 +684,6 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin) { int error = Success; VisualID visual = 0; - int i; XID xid; if (nxagentOption(Rootless)) @@ -696,7 +691,7 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin) return; } - for (i = 0; i < pScreen -> numDepths; i++) + for (int i = 0; i < pScreen -> numDepths; i++) { if (pScreen -> allowedDepths[i].depth == pRootWin -> drawable.depth) { @@ -2714,37 +2709,31 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) case StaticGray: { className = "StaticGray"; - break; } case StaticColor: { className = "StaticColor"; - break; } case PseudoColor: { className = "PseudoColor"; - break; } case DirectColor: { className = "DirectColor"; - break; } case GrayScale: { className = "GrayScale"; - break; } default: { className = ""; - break; } } @@ -3222,29 +3211,14 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, unsigned int lineMaster, char **buffer) { - unsigned char red; - unsigned char green; - unsigned char blue; - unsigned short color16 = 0; - unsigned char * icBuffer; - unsigned char * cBuffer = NULL; unsigned char * tBuffer = (unsigned char *) *buffer; - unsigned int lineShadow; - unsigned int length; - unsigned int c; - unsigned int pad; - unsigned int color32 = 0; - unsigned long redMask; - unsigned long greenMask; - unsigned long blueMask; - Visual *pVisual; - length = nxagentImageLength(width, height, ZPixmap, 0, nxagentShadowDepth); + unsigned int length = nxagentImageLength(width, height, ZPixmap, 0, nxagentShadowDepth); - cBuffer = malloc(length); - icBuffer = cBuffer; + unsigned char *cBuffer = malloc(length); + unsigned char *icBuffer = cBuffer; - pVisual = nxagentImageVisual((DrawablePtr) nxagentShadowPixmapPtr, nxagentShadowDepth); + Visual *pVisual = nxagentImageVisual((DrawablePtr) nxagentShadowPixmapPtr, nxagentShadowDepth); if (pVisual == NULL) { @@ -3260,9 +3234,9 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, pVisual -> red_mask, pVisual -> green_mask, pVisual -> blue_mask); #endif - redMask = nxagentShadowDisplay -> screens[0].root_visual[0].red_mask; - greenMask = nxagentShadowDisplay -> screens[0].root_visual[0].green_mask; - blueMask = nxagentShadowDisplay -> screens[0].root_visual[0].blue_mask; + unsigned long redMask = nxagentShadowDisplay -> screens[0].root_visual[0].red_mask; + unsigned long greenMask = nxagentShadowDisplay -> screens[0].root_visual[0].green_mask; + unsigned long blueMask = nxagentShadowDisplay -> screens[0].root_visual[0].blue_mask; #ifdef TEST fprintf(stderr, "nxagentCorrectDepthShadow: Master redMask [%lu] greenMask[%lu] blueMask[%lu].\n", @@ -3276,7 +3250,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, */ case 16: { - pad = lineMaster - nxagentBppMaster * width; + unsigned int pad = lineMaster - nxagentBppMaster * width; #ifdef TEST fprintf(stderr, "nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].\n", lineMaster, width, pad); @@ -3284,8 +3258,13 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, while (height > 0) { - for (c = 0; c < width ; c++) + for (unsigned int c = 0; c < width ; c++) { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned short color16; + if (imageByteOrder == LSBFirst) { color16 = *tBuffer++; @@ -3353,9 +3332,8 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, */ case 24: { - lineShadow = PixmapBytePad(width, nxagentShadowDepth); - - pad = lineShadow - nxagentBppShadow * width; + unsigned int lineShadow = PixmapBytePad(width, nxagentShadowDepth); + unsigned int pad = lineShadow - nxagentBppShadow * width; #ifdef TEST fprintf(stderr, "nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].\n", lineShadow, width, pad); @@ -3363,8 +3341,11 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, while (height > 0) { - for (c = 0; c < width; c++) + for (unsigned int c = 0; c < width; c++) { + unsigned short color16; + unsigned int color32; + if (imageByteOrder == LSBFirst) { color32 = *tBuffer++; @@ -3479,8 +3460,6 @@ FIXME: The port information is not used at the moment and produces a if (iReturn == Success && atomReturnType != None && ulReturnItems > 0 && pszReturnData != NULL) { - char *local_buf; - #ifdef TEST fprintf(stderr, "nxagentPropagateArtsdProperties: Got [%ld] elements of format [%d] with [%ld] bytes left.\n", ulReturnItems, iReturnFormat, ulReturnBytesLeft); @@ -3495,7 +3474,7 @@ FIXME: The port information is not used at the moment and produces a #endif - local_buf = (char *) malloc(strlen((char*)pszReturnData) + 100); + char *local_buf = (char *) malloc(strlen((char*)pszReturnData) + 100); if (local_buf) { @@ -3611,9 +3590,7 @@ FIXME: The port information is not used at the moment and produces a Bool nxagentReconnectScreen(void *p0) { - CARD16 w, h; PixmapPtr pPixmap = (PixmapPtr)nxagentDefaultScreen->devPrivate; - Mask mask; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_SCREEN_DEBUG) fprintf(stderr, "nxagentReconnectScreen\n"); @@ -3634,8 +3611,8 @@ Bool nxagentReconnectScreen(void *p0) pPixmap, nxagentPixmap( pPixmap )); #endif - w = 16; - h = 16; + CARD16 w = 16; + CARD16 h = 16; (*nxagentDefaultScreen->QueryBestSize)(StippleShape, &w, &h, nxagentDefaultScreen); if (!(nxagentPixmap(nxagentDefaultScreen->PixmapPerDepth[0]) = XCreatePixmap(nxagentDisplay, @@ -3644,7 +3621,7 @@ Bool nxagentReconnectScreen(void *p0) h, 1))); - mask = nxagentGetDefaultEventMask(); + Mask mask = nxagentGetDefaultEventMask(); mask |= NXAGENT_KEYBOARD_EVENT_MASK | NXAGENT_POINTER_EVENT_MASK; nxagentSetDefaultEventMask(mask); XSelectInput(nxagentDisplay, nxagentDefaultWindows[0], mask); @@ -3663,8 +3640,8 @@ Bool nxagentReconnectScreen(void *p0) /* intersect two rectangles */ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah, - int bx1, int by1, unsigned int bw, unsigned int bh, - int *x, int *y, unsigned int *w, unsigned int *h) + int bx1, int by1, unsigned int bw, unsigned int bh, + int *x, int *y, unsigned int *w, unsigned int *h) { int tx1, ty1, tx2, ty2, ix, iy; unsigned int iw, ih; @@ -3721,9 +3698,9 @@ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah, /* intersect two rectangles, return aw/ah for w/h if resulting rectangle is (partly) outside of bounding box */ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah, - int bx1, int by1, unsigned int bw, unsigned int bh, - int bbx1, int bby1, int bbx2, int bby2, - int *x, int *y, unsigned int *w, unsigned int *h) + int bx1, int by1, unsigned int bw, unsigned int bh, + int bbx1, int bby1, int bbx2, int bby2, + int *x, int *y, unsigned int *w, unsigned int *h) { #ifdef DEBUG @@ -3877,9 +3854,6 @@ void nxagentAdjustCustomMode(ScreenPtr pScreen) int nxagentChangeScreenConfig(int screen, int width, int height) { - ScreenPtr pScreen; - int r; - #ifdef DEBUG fprintf(stderr, "nxagentChangeScreenConfig: called for screen [%d], width [%d] height [%d]\n", screen, width, height); #endif @@ -3923,13 +3897,13 @@ int nxagentChangeScreenConfig(int screen, int width, int height) return 0; } - pScreen = screenInfo.screens[screen] -> root -> drawable.pScreen; + ScreenPtr pScreen = screenInfo.screens[screen] -> root -> drawable.pScreen; #ifdef TEST fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %d x %d\n", width, height); #endif - r = nxagentResizeScreen(pScreen, width, height, 0, 0); + int r = nxagentResizeScreen(pScreen, width, height, 0, 0); if (r != 0) { @@ -3958,21 +3932,25 @@ int nxagentChangeScreenConfig(int screen, int width, int height) /* Destroy an output after removing it from any crtc that might reference it */ -void nxagentDropOutput(RROutputPtr o) { +void nxagentDropOutput(RROutputPtr o) +{ RRCrtcPtr c = o->crtc; - if (c) { - for (int i = 0; i < c->numOutputs; i++) { - if (c->outputs[i] == o) { -#ifdef DEBUG - fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, c); -#endif - RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL); + if (c) + { + for (int i = 0; i < c->numOutputs; i++) + { + if (c->outputs[i] == o) + { + #ifdef DEBUG + fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, c); + #endif + RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL); } } } -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "nxagentDropOutput: destroying output [%s]\n", o->name); -#endif + #endif RROutputDestroy(o); } @@ -3993,23 +3971,22 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) int i; int number = 0; - XineramaScreenInfo *screeninfo = NULL; + XineramaScreenInfo *screeninfo = XineramaQueryScreens(nxagentDisplay, &number); - screeninfo = XineramaQueryScreens(nxagentDisplay, &number); if (number) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() returned [%d] screens:\n", number); for (int i=0; i < number; i++) { - fprintf(stderr, "nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]\n", screeninfo[i].screen_number, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height); + fprintf(stderr, "nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]\n", screeninfo[i].screen_number, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height); } -#endif + #endif } else { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama\n"); -#endif + #endif } /* @@ -4020,7 +3997,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) * behaved. The single PanoramiX/Xinerama extension however * disables xinerama if only one screen exists. */ - if (number == 0) { + if (number == 0) + { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: faking xinerama\n"); #endif @@ -4028,8 +4006,9 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) SAFE_free(screeninfo); - if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) { - return FALSE; + if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) + { + return FALSE; } /* fake a xinerama screeninfo that covers the whole screen */ @@ -4066,7 +4045,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) bbx2 = bby2 = 0; bbx1 = bby1 = INT_MAX; - for (i = 0; i < number; i++) { + for (i = 0; i < number; i++) + { bbx2 = max(bbx2, screeninfo[i].x_org + screeninfo[i].width); bby2 = max(bby2, screeninfo[i].y_org + screeninfo[i].height); bbx1 = min(bbx1, screeninfo[i].x_org); @@ -4083,8 +4063,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) /* adjust the number of CRTCs to match the number of reported xinerama screens on the real server */ - while (number != pScrPriv->numCrtcs) { - if (number < pScrPriv->numCrtcs) { + while (number != pScrPriv->numCrtcs) + { + if (number < pScrPriv->numCrtcs) + { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: destroying crtc\n"); #endif @@ -4108,12 +4090,14 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) /* set gamma. Currently the only reason for doing this is preventing the xrandr command from complaining about missing gamma. */ - for (i = 0; i < pScrPriv->numCrtcs; i++) { - if (pScrPriv->crtcs[i]->gammaSize == 0) { - CARD16 gamma = 0; - RRCrtcGammaSetSize(pScrPriv->crtcs[i], 1); - RRCrtcGammaSet(pScrPriv->crtcs[i], &gamma, &gamma, &gamma); - RRCrtcGammaNotify(pScrPriv->crtcs[i]); + for (i = 0; i < pScrPriv->numCrtcs; i++) + { + if (pScrPriv->crtcs[i]->gammaSize == 0) + { + CARD16 gamma = 0; + RRCrtcGammaSetSize(pScrPriv->crtcs[i], 1); + RRCrtcGammaSet(pScrPriv->crtcs[i], &gamma, &gamma, &gamma); + RRCrtcGammaNotify(pScrPriv->crtcs[i]); } } @@ -4127,13 +4111,15 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) nxagentDropOutput(pScrPriv->outputs[i]); /* add and init outputs */ - for (i = 0; i < number; i++) { - if (i >= pScrPriv->numOutputs) { + for (i = 0; i < number; i++) + { + if (i >= pScrPriv->numOutputs) + { sprintf(name, "NX%d", i+1); output = RROutputCreate(pScreen, name, strlen(name), NULL); - /* will be done later - RROutputSetConnection(output, RR_Disconnected); - */ + /* will be done later + RROutputSetConnection(output, RR_Disconnected); + */ #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: created new output [%s]\n", name); #endif @@ -4154,7 +4140,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) RROutputSetPhysicalSize(output, 0, 0); } - for (i = 0; i < pScrPriv->numOutputs; i++) { + for (i = 0; i < pScrPriv->numOutputs; i++) + { Bool disable_output = FALSE; RRModePtr mymode = NULL, prevmode = NULL; int new_x = 0; @@ -4174,23 +4161,27 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) width, height, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height, - bbx1, bby1, bbx2, bby2, + bbx1, bby1, bbx2, bby2, &new_x, &new_y, &new_w, &new_h); #endif /* save previous mode */ prevmode = pScrPriv->crtcs[i]->mode; #ifdef DEBUG - if (prevmode) { + if (prevmode) + { fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: prevmode [%s] ([%p]) refcnt [%d]\n", i, pScrPriv->outputs[i]->name, prevmode->name, (void *)prevmode, prevmode->refcnt); - } else { + } + else + { fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: no prevmode\n", i, pScrPriv->outputs[i]->name); } #endif RROutputSetCrtcs(pScrPriv->outputs[i], &(pScrPriv->crtcs[i]), 1); - if (disable_output) { + if (disable_output) + { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: no (valid) intersection - disconnecting\n", i, pScrPriv->outputs[i]->name); #endif @@ -4205,7 +4196,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) * mode of the output's crtc. This also leads to xinerama not * showing the disconnected head anymore. */ - if (prevmode) { + if (prevmode) + { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: removing mode from output [%d] name [%s]\n", i, pScrPriv->outputs[i]->name); #endif @@ -4247,27 +4239,29 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) mymode = RRModeGet(&modeInfo, name); #ifdef DEBUG - if (mymode) { + if (mymode) + { fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] ([%p]) created/received, refcnt [%d]\n", i, pScrPriv->outputs[i]->name, name, (void *) mymode, mymode->refcnt); } else { - /* FIXME: what is the correct behaviour in this case? */ + /* FIXME: what is the correct behaviour in this case? */ fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] creation failed!\n", i, pScrPriv->outputs[i]->name, name); } #endif - if (prevmode && mymode == prevmode) { + if (prevmode && mymode == prevmode) + { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: mymode [%s] ([%p]) == prevmode [%s] ([%p])\n", mymode->name, (void *) mymode, prevmode->name, (void *)prevmode); #endif /* if they are the same RRModeGet() has increased the - refcnt by 1. We decrease it again by calling only - RRModeDestroy() and forget about prevmode */ - RRModeDestroy(mymode); + refcnt by 1. We decrease it again by calling only + RRModeDestroy() and forget about prevmode */ + RRModeDestroy(mymode); } else - { + { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: setting mode [%s] ([%p]) refcnt [%d] for output %d [%s]\n", mymode->name, (void *) mymode, mymode->refcnt, i, pScrPriv->outputs[i]->name); #endif @@ -4283,11 +4277,12 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) /* throw away the mode if otherwise unused. We do not need it anymore. We call FreeResource() to ensure the system will not try to free it again on shutdown */ - if (prevmode && prevmode->refcnt == 1) { + if (prevmode && prevmode->refcnt == 1) + { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: destroying prevmode [%s]\n", prevmode->name); #endif - FreeResource(prevmode->mode.id, 0); + FreeResource(prevmode->mode.id, 0); } RROutputChanged(pScrPriv->outputs[i], TRUE); @@ -4298,19 +4293,20 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) SAFE_free(screeninfo); #ifdef DEBUG - for (i = 0; i < pScrPriv->numCrtcs; i++) { + for (i = 0; i < pScrPriv->numCrtcs; i++) + { RRModePtr mode = pScrPriv->crtcs[i]->mode; if (mode) { - fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has mode [%s] ([%p]), refcnt [%d] and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->mode->name, (void *)pScrPriv->crtcs[i]->mode, pScrPriv->crtcs[i]->mode->refcnt, pScrPriv->crtcs[i]->numOutputs); + fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has mode [%s] ([%p]), refcnt [%d] and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->mode->name, (void *)pScrPriv->crtcs[i]->mode, pScrPriv->crtcs[i]->mode->refcnt, pScrPriv->crtcs[i]->numOutputs); } else { - fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has no mode and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->numOutputs); + fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has no mode and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->numOutputs); } if (pScrPriv->crtcs[i]->numOutputs > 0) 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); + 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 @@ -4338,24 +4334,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin) { - PixmapPtr pVirtualPixmap; - nxagentPrivPixmapPtr pPrivPixmap; - XlibGC gc; - XGCValues values; - int i; - int xSrc, ySrc, xDst, yDst, w, h; - int nRects; - int size; - BoxPtr pBox; - XRectangle *pRects; - BoxRec extents; - RegionRec cleanRegion; + XGCValues values = {0}; miBSWindowPtr pBackingStore = (miBSWindowPtr) pWin -> backStorage; - pVirtualPixmap = nxagentVirtualPixmap(pPixmap); + PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap); - pPrivPixmap = nxagentPixmapPriv(pPixmap); + nxagentPrivPixmapPtr pPrivPixmap = nxagentPixmapPriv(pPixmap); pPrivPixmap -> isBackingPixmap = 1; @@ -4364,13 +4349,14 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, values.subwindow_mode = IncludeInferiors; - gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); + XlibGC gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); /* * Initialize to the corrupted region. * Coordinates are relative to the window. */ + RegionRec cleanRegion; RegionInit(&cleanRegion, NullBox, 1); RegionCopy(&cleanRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); @@ -4395,12 +4381,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, RegionSubtract(&cleanRegion, prgnSave, &cleanRegion); - nRects = RegionNumRects(&cleanRegion); - size = nRects * sizeof(*pRects); - pRects = (XRectangle *) malloc(size); - pBox = RegionRects(&cleanRegion); + int nRects = RegionNumRects(&cleanRegion); + int size = nRects * sizeof(XRectangle); + XRectangle *pRects = (XRectangle *) malloc(size); + BoxPtr pBox = RegionRects(&cleanRegion); - for (i = nRects; i-- > 0;) + for (int i = nRects; i-- > 0;) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; @@ -4412,12 +4398,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, SAFE_free(pRects); - extents = *RegionExtents(&cleanRegion); + BoxRec extents = *RegionExtents(&cleanRegion); RegionUninit(&cleanRegion); - xDst = extents.x1; - yDst = extents.y1; + int xDst = extents.x1; + int yDst = extents.y1; /* * Left here the wrong solution. The window could be not @@ -4430,11 +4416,11 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, * ySrc = yDst + yorg - pWin -> drawable.y; */ - xSrc = xDst + pBackingStore -> x; - ySrc = yDst + pBackingStore -> y; + int xSrc = xDst + pBackingStore -> x; + int ySrc = yDst + pBackingStore -> y; - w = extents.x2 - extents.x1; - h = extents.y2 - extents.y1; + int w = extents.x2 - extents.x1; + int h = extents.y2 - extents.y1; XCopyArea(nxagentDisplay, nxagentWindow(pWin), nxagentPixmap(pPixmap), gc, xSrc, ySrc, w, h, xDst, yDst); @@ -4455,18 +4441,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin) { - PixmapPtr pVirtualPixmap; - RegionPtr clipRegion; - XlibGC gc; - XGCValues values; - int i; - int xSrc, ySrc, xDst, yDst, w, h; - int nRects; - int size; - BoxPtr pBox; - XRectangle *pRects; - BoxRec extents; - miBSWindowPtr pBackingStore; + XGCValues values = {0}; /* * Limit the area to restore to the @@ -4476,16 +4451,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, RegionIntersect(prgnRestore, prgnRestore, &pWin -> drawable.pScreen -> root -> winSize); - pBackingStore = (miBSWindowPtr) pWin -> backStorage; + miBSWindowPtr pBackingStore = (miBSWindowPtr) pWin -> backStorage; - pVirtualPixmap = nxagentVirtualPixmap(pPixmap); + PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap); fbCopyWindowProc(&pVirtualPixmap -> drawable, &pWin -> drawable, 0, RegionRects(prgnRestore), RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0, 0); values.subwindow_mode = ClipByChildren; - gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); + XlibGC gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); /* * Translate the reference point to the origin of the window. @@ -4495,7 +4470,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, -pWin -> drawable.x - pWin -> borderWidth, -pWin -> drawable.y - pWin -> borderWidth); - clipRegion = prgnRestore; + RegionPtr clipRegion = prgnRestore; if (nxagentDrawableStatus((DrawablePtr) pPixmap) == NotSynchronized) { @@ -4541,12 +4516,12 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, RegionSubtract(clipRegion, prgnRestore, clipRegion); } - nRects = RegionNumRects(clipRegion); - size = nRects * sizeof(*pRects); - pRects = (XRectangle *) malloc(size); - pBox = RegionRects(clipRegion); + int nRects = RegionNumRects(clipRegion); + int size = nRects * sizeof(XRectangle); + XRectangle *pRects = (XRectangle *) malloc(size); + BoxPtr pBox = RegionRects(clipRegion); - for (i = nRects; i-- > 0;) + for (int i = nRects; i-- > 0;) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; @@ -4558,16 +4533,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, SAFE_free(pRects); - extents = *RegionExtents(clipRegion); + BoxRec extents = *RegionExtents(clipRegion); - xDst = extents.x1; - yDst = extents.y1; + int xDst = extents.x1; + int yDst = extents.y1; - xSrc = xDst - xorg + pWin -> drawable.x; - ySrc = yDst - yorg + pWin -> drawable.y; + int xSrc = xDst - xorg + pWin -> drawable.x; + int ySrc = yDst - yorg + pWin -> drawable.y; - w = extents.x2 - extents.x1; - h = extents.y2 - extents.y1; + int w = extents.x2 - extents.x1; + int h = extents.y2 - extents.y1; nxagentFlushConfigureWindow(); @@ -4661,11 +4636,7 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr pScreen, int maxwidth, int maxheig void nxagentShadowAdaptToRatio(void) { - ScreenPtr pScreen; - RegionRec region; - BoxRec box; - - pScreen = screenInfo.screens[0]; + ScreenPtr pScreen = screenInfo.screens[0]; nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / nxagentShadowWidth, nxagentOption(Height) * 1.0 / nxagentShadowHeight); @@ -4676,10 +4647,14 @@ void nxagentShadowAdaptToRatio(void) WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); - box.x1 = 0; - box.y1 = 0; - box.x2 = nxagentShadowPixmapPtr -> drawable.width; - box.y2 = nxagentShadowPixmapPtr -> drawable.height; + BoxRec box = { + .x1 = 0, + .y1 = 0, + .x2 = nxagentShadowPixmapPtr -> drawable.width, + .y2 = nxagentShadowPixmapPtr -> drawable.height + }; + + RegionRec region; RegionInit(®ion, &box, 1); @@ -4690,9 +4665,7 @@ void nxagentShadowAdaptToRatio(void) void nxagentPrintGeometry(void) { - int i; - - for (i = 0; i < screenInfo.numScreens; i++) + for (int i = 0; i < screenInfo.numScreens; i++) { if (nxagentPrintGeometryFlags & (1 << i)) { @@ -4711,21 +4684,15 @@ void nxagentPrintGeometry(void) void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) { static int init = 1; - static Display *shadow; - static Window win; + static Display *shadow = NULL; + static Window win = 0; - XlibGC gc; - XGCValues value; - XImage *image; - WindowPtr pWin = screenInfo.screens[0]->root; - unsigned int format; - int depth, pixmapWidth, pixmapHeight, length; - char *data; - - depth = pPixmap -> drawable.depth; - pixmapWidth = pPixmap -> drawable.width; - pixmapHeight = pPixmap -> drawable.height; - format = (depth == 1) ? XYPixmap : ZPixmap; + int depth = pPixmap -> drawable.depth; + /* + int pixmapWidth = pPixmap -> drawable.width; + int pixmapHeight = pPixmap -> drawable.height; + */ + unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; if (init) { @@ -4770,9 +4737,9 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) XRaiseWindow(nxagentDisplay, win); } - length = nxagentImageLength(width, height, format, 0, depth); - - if ((data = malloc(length)) == NULL) + int length = nxagentImageLength(width, height, format, 0, depth); + char *data = malloc(length); + if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentShowPixmap: malloc failed.\n"); @@ -4783,12 +4750,12 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) /* FIXME - image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y, - width, height, AllPlanes, format); + XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y, + width, height, AllPlanes, format); */ - image = XGetImage(nxagentDisplay, RootWindow(nxagentDisplay, 0), 0, 0, - width, height, AllPlanes, format); + XImage *image = XGetImage(nxagentDisplay, RootWindow(nxagentDisplay, 0), 0, 0, + width, height, AllPlanes, format); if (image == NULL) { @@ -4806,13 +4773,15 @@ FIXME memcpy(image -> data, data, length); - value.foreground = 0xffffff; - value.background = 0x000000; - value.plane_mask = 0xffffff; - value.fill_style = FillSolid; + XGCValues value = { + .foreground = 0xffffff, + .background = 0x000000, + .plane_mask = 0xffffff, + .fill_style = FillSolid + }; - gc = XCreateGC(shadow, win, GCBackground | - GCForeground | GCFillStyle | GCPlaneMask, &value); + XlibGC gc = XCreateGC(shadow, win, GCBackground | + GCForeground | GCFillStyle | GCPlaneMask, &value); XSync(shadow, 0); @@ -4843,26 +4812,19 @@ FIXME void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc, int width, int height, int xDst, int yDst) { - Display *shadow; - - XlibGC gc; - XGCValues value; - XImage *image; - unsigned int format; - int depth, pixmapWidth, pixmapHeight, length; - char *data = NULL; - Visual *pVisual; - - depth = pPixmap -> drawable.depth; - pixmapWidth = pPixmap -> drawable.width; - pixmapHeight = pPixmap -> drawable.height; - format = (depth == 1) ? XYPixmap : ZPixmap; + Display *shadow = nxagentDisplay; - shadow = nxagentDisplay; + int depth = pPixmap -> drawable.depth; + /* + int pixmapWidth = pPixmap -> drawable.width; + int pixmapHeight = pPixmap -> drawable.height; + */ + unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; - length = nxagentImageLength(width, height, format, 0, depth); + int length = nxagentImageLength(width, height, format, 0, depth); + char *data = malloc(length); - if ((data = malloc(length)) == NULL) + if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbRestoreArea: malloc failed.\n"); @@ -4870,11 +4832,13 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc, return; } + + XImage *image = NULL; /* - image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc, - width, height, AllPlanes, format); + XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc, + width, height, AllPlanes, format); */ - + if (image == NULL) { #ifdef WARNING @@ -4892,7 +4856,7 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc, /* FIXME */ - pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth); + Visual *pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth); if (pVisual == NULL) { @@ -4914,14 +4878,16 @@ FIXME fprintf(stderr, "nxagentFbRestoreArea: Cleaning %d bytes of image.\n", length); - value.foreground = 0xffffff; - value.background = 0x000000; - value.plane_mask = 0xffffff; - value.fill_style = FillSolid; - value.function = GXcopy; + XGCValues value = { + .foreground = 0xffffff, + .background = 0x000000, + .plane_mask = 0xffffff, + .fill_style = FillSolid, + .function = GXcopy + }; - gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground | - GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value); + XlibGC gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground | + GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value); NXCleanImage(image); -- cgit v1.2.3 From 9dca2c598af64d8fbe56f7cb0608b906a88e1e6a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 5 May 2018 18:58:27 +0200 Subject: Split.c: whitespace fixes --- nx-X11/programs/Xserver/hw/nxagent/Split.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Split.c b/nx-X11/programs/Xserver/hw/nxagent/Split.c index d58d70bfd..33005e86d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Split.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Split.c @@ -792,11 +792,11 @@ void nxagentWaitDrawable(DrawablePtr pDrawable) else { fprintf(stderr, "nxagentWaitDrawable: Drawable at [%p] can now be restarted.\n", - (void *) pDrawable); + (void *) pDrawable); } #endif - + return; } -- cgit v1.2.3 From 8f609404caa511a464207507129de586d325b3d9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 24 Jul 2019 00:02:51 +0200 Subject: NXproperty.c: prevent deletion of NX_AGENT_VERSION property Fixes ArcticaProject/nx-libs#825 --- nx-X11/programs/Xserver/dix/property.c | 2 ++ nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 47 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c index 66c38f56c..7f25a5c55 100644 --- a/nx-X11/programs/Xserver/dix/property.c +++ b/nx-X11/programs/Xserver/dix/property.c @@ -655,6 +655,7 @@ ProcListProperties(ClientPtr client) return(client->noClientException); } +#ifndef NXAGENT_SERVER int ProcDeleteProperty(register ClientPtr client) { @@ -692,3 +693,4 @@ ProcDeleteProperty(register ClientPtr client) else return(result); } +#endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index a0c355b41..94e9e4b2a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -682,3 +682,50 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, return(Success); } #endif + +int +ProcDeleteProperty(register ClientPtr client) +{ + WindowPtr pWin; + REQUEST(xDeletePropertyReq); + int result; + + REQUEST_SIZE_MATCH(xDeletePropertyReq); + UpdateCurrentTime(); + pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, + DixWriteAccess); + if (!pWin) + return(BadWindow); + if (!ValidAtom(stuff->property)) + { + client->errorValue = stuff->property; + return (BadAtom); + } + +#ifdef XCSECURITY + switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, + DixDestroyAccess)) + { + case SecurityErrorOperation: + client->errorValue = stuff->property; + return BadAtom;; + case SecurityIgnoreOperation: + return Success; + } +#endif + +#ifdef NXAGENT_SERVER + /* prevent clients from deleting the NX_AGENT_VERSION property */ + { + Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True); + if (stuff->property == prop) + return client->noClientException; + } +#endif + + result = DeleteProperty(pWin, stuff->property); + if (client->noClientException != Success) + return(client->noClientException); + else + return(result); +} -- cgit v1.2.3 From f8a1f79b30f5996109646d890b39d9453342a7b9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 25 Jul 2019 23:53:57 +0200 Subject: Colormap.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Colormap.c | 28 +++++++++------------------ 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c index 33b0738ec..7fa006539 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c @@ -187,9 +187,7 @@ static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr) { nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *) ptr; - int i; - - for (i = 0; i < icws->numCmapIDs; i++) + for (int i = 0; i < icws->numCmapIDs; i++) if (SEARCH_PREDICATE) { icws->numWindows++; return WT_DONTWALKCHILDREN; @@ -201,9 +199,8 @@ static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr) static int nxagentGetInstalledColormapWindows(WindowPtr pWin, void * ptr) { nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *)ptr; - int i; - for (i = 0; i < icws->numCmapIDs; i++) + for (int i = 0; i < icws->numCmapIDs; i++) if (SEARCH_PREDICATE) { icws->windows[icws->index++] = nxagentWindow(pWin); return WT_DONTWALKCHILDREN; @@ -262,10 +259,9 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen) #ifdef _XSERVER64 { - int i; Window64 *windows = (Window64 *)malloc(numWindows * sizeof(Window64)); - for(i = 0; i < numWindows; ++i) + for(int i = 0; i < numWindows; ++i) windows[i] = icws.windows[i]; XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], windows, numWindows); @@ -347,17 +343,14 @@ void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen) void nxagentDirectInstallColormaps(ScreenPtr pScreen) { - int i, n; Colormap pCmapIDs[MAXCMAPS]; if (!nxagentDoDirectColormaps) return; - n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); - - for (i = 0; i < n; i++) { - ColormapPtr pCmap; + int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); - pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); + for (int i = 0; i < n; i++) { + ColormapPtr pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); if (pCmap) XInstallColormap(nxagentDisplay, nxagentColormap(pCmap)); } @@ -365,14 +358,13 @@ void nxagentDirectInstallColormaps(ScreenPtr pScreen) void nxagentDirectUninstallColormaps(ScreenPtr pScreen) { - int i, n; Colormap pCmapIDs[MAXCMAPS]; if (!nxagentDoDirectColormaps) return; - n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); + int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); - for (i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { ColormapPtr pCmap; pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); @@ -429,7 +421,6 @@ int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds) if (nxagentInstalledDefaultColormap) { *pCmapIds = InstalledMaps[pScreen->myNum]->mid; - return 1; } else @@ -443,10 +434,9 @@ void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors) if (pCmap->pVisual->class & DynamicClass) #ifdef _XSERVER64 { - int i; XColor *pColors64 = (XColor *)malloc(nColors * sizeof(XColor) ); - for(i = 0; i < nColors; ++i) + for(int i = 0; i < nColors; ++i) { pColors64[i].pixel = pColors[i].pixel; pColors64[i].red = pColors[i].red; -- cgit v1.2.3 From fc7cb8657f285ef46d0f1b16abcfec448246c4f5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 25 Jul 2019 23:58:30 +0200 Subject: Pixels.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Pixels.c | 30 +++++++++-------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixels.c b/nx-X11/programs/Xserver/hw/nxagent/Pixels.c index e59ef97ab..93038eab6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixels.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixels.c @@ -63,10 +63,6 @@ int nxagentUniquePixels(XImage *image) int elements = PIXEL_ELEMENTS; int unique = 0; - int total; - int ratio; - int step; - int last = -1; const char *next = image -> data; @@ -80,9 +76,9 @@ int nxagentUniquePixels(XImage *image) * Take at most 256 pixels from the image. */ - total = image -> width * image -> height; + int total = image -> width * image -> height; - step = total / elements; + int step = total / elements; if (step < PIXEL_STEP) { @@ -231,7 +227,7 @@ int nxagentUniquePixels(XImage *image) #endif } - ratio = unique * 100 / elements; + int ratio = unique * 100 / elements; #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Found [%d] unique pixels out of [%d] with ratio [%d%%].\n", @@ -267,13 +263,11 @@ unsigned int Get16(const char *buffer, int order) unsigned int Get24(const char *buffer, int order) { - int i; - const char *next = (order == MSBFirst ? buffer : buffer + 2); unsigned int result = 0; - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { result <<= 8; @@ -294,13 +288,11 @@ unsigned int Get24(const char *buffer, int order) unsigned int Get32(const char *buffer, int order) { - int i; - const char *next = (order == MSBFirst ? buffer : buffer + 3); unsigned int result = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { result <<= 8; @@ -341,13 +333,11 @@ void Put16(unsigned int value, char *buffer, int order) void Put24(unsigned int value, char *buffer, int order) { - int i; - if (order == MSBFirst) { buffer += 2; - for (i = 3; i > 0; i--) + for (int i = 3; i > 0; i--) { *buffer-- = (unsigned char) (value & 0xff); @@ -356,7 +346,7 @@ void Put24(unsigned int value, char *buffer, int order) } else { - for (i = 3; i > 0; i--) + for (int i = 3; i > 0; i--) { *buffer++ = (unsigned char) (value & 0xff); @@ -367,13 +357,11 @@ void Put24(unsigned int value, char *buffer, int order) void Put32(unsigned int value, char *buffer, int order) { - int i; - if (order == MSBFirst) { buffer += 3; - for (i = 4; i > 0; i--) + for (int i = 4; i > 0; i--) { *buffer-- = (unsigned char) (value & 0xff); @@ -382,7 +370,7 @@ void Put32(unsigned int value, char *buffer, int order) } else { - for (i = 4; i > 0; i--) + for (int i = 4; i > 0; i--) { *buffer++ = (unsigned char) (value & 0xff); -- cgit v1.2.3 From c36efbd37c7be45d04768afb4fa806d6dd67e790 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 26 Jul 2019 00:07:28 +0200 Subject: Screen.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 01579581f..5a12f406e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -891,7 +891,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, VisualPtr visuals; DepthPtr depths; int numVisuals, numDepths; - int i, j, depthIndex; + int depthIndex; unsigned long valuemask; XSetWindowAttributes attributes; XWindowAttributes gattributes; @@ -1221,7 +1221,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec)); - for (i = 0; i < nxagentNumDepths; i++) + for (int i = 0; i < nxagentNumDepths; i++) { depths[i].depth = nxagentDepths[i]; depths[i].numVids = 0; @@ -1242,7 +1242,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, visuals = (VisualPtr) malloc(nxagentNumVisuals * sizeof(VisualRec)); - for (i = 0; i < nxagentNumVisuals; i++) + for (int i = 0; i < nxagentNumVisuals; i++) { visuals[numVisuals].vid = FakeClientID(0); visuals[numVisuals].class = nxagentVisuals[i].class; @@ -1271,6 +1271,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, } else { + int j; for (j = 0; j < numVisuals; j++) { if (visuals[numVisuals].class == visuals[j].class && @@ -1300,7 +1301,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, (long unsigned int)visuals[numVisuals].vid); #endif - for (j = 0; j < numDepths; j++) + for (int j = 0; j < numDepths; j++) { if (depths[j].depth == nxagentVisuals[i].depth) { @@ -1461,7 +1462,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, * pixmap for each depth. */ - for (i = 0; i < numDepths; i++) + for (int i = 0; i < numDepths; i++) { nxagentMarkPlaceholderNotLoaded(i); } @@ -2581,7 +2582,6 @@ void nxagentShadowSetWindowOptions(void) int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) { - int i; char *layout = NULL; extern char *nxagentKeyboard; XlibGC gc; @@ -2604,6 +2604,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) if (nxagentKeyboard != NULL) { + int i; for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++); if(nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0) @@ -3427,7 +3428,6 @@ void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port) unsigned char *pszReturnData = NULL; int iReturn; - int i,in; char tchar[] = " "; /* FIXME: The port information is not used at the moment and produces a @@ -3480,6 +3480,7 @@ FIXME: The port information is not used at the moment and produces a { memset(local_buf, 0, strlen((char *) pszReturnData)); + int i, in; for (i = 0, in = 0; pszReturnData[i] != '\0'; i++) { local_buf[in]=pszReturnData[i]; -- cgit v1.2.3 From 19267ddf42afe3f53eba0d6ae82963b9f6dfdeb9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Jul 2019 00:01:17 +0200 Subject: Screen.c: fix typo in TEST output --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 5a12f406e..3b1d5f450 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -397,7 +397,7 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after if (!XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e)) break; #ifdef TEST - fprintf(stderr, "%d: swallowing LeaveNotify event\m", __func__); + fprintf(stderr, "%d: swallowing LeaveNotify event\n", __func__); #endif } -- cgit v1.2.3 From e2fa4f5c4b5ce4999d16fd4a55ff44e5b198aece Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Jul 2019 16:07:37 +0200 Subject: Colormap.c: Formatting and scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Colormap.c | 245 +++++++++++++------------- 1 file changed, 122 insertions(+), 123 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c index 7fa006539..b04977887 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c @@ -69,11 +69,7 @@ Bool nxagentReconnectAllColormap(void *p0); Bool nxagentCreateColormap(ColormapPtr pCmap) { - VisualPtr pVisual; XColor *colors; - int i, ncolors; - Pixel red, green, blue; - Pixel redInc, greenInc, blueInc; Visual *visual; int class; @@ -83,8 +79,8 @@ Bool nxagentCreateColormap(ColormapPtr pCmap) " visual [%lu].\n", pCmap->pVisual); #endif - pVisual = pCmap->pVisual; - ncolors = pVisual->ColormapEntries; + VisualPtr pVisual = pCmap->pVisual; + int ncolors = pVisual->ColormapEntries; pCmap->devPriv = (void *)malloc(sizeof(nxagentPrivColormap)); @@ -102,7 +98,6 @@ Bool nxagentCreateColormap(ColormapPtr pCmap) class = pVisual->class; } - nxagentColormapPriv(pCmap)->colormap = XCreateColormap(nxagentDisplay, nxagentDefaultWindows[pCmap->pScreen->myNum], @@ -110,13 +105,15 @@ Bool nxagentCreateColormap(ColormapPtr pCmap) (class & DynamicClass) ? AllocAll : AllocNone); - switch (class) { + switch (class) + { case StaticGray: /* read only */ colors = (XColor *)malloc(ncolors * sizeof(XColor)); - for (i = 0; i < ncolors; i++) + for (int i = 0; i < ncolors; i++) colors[i].pixel = i; XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); - for (i = 0; i < ncolors; i++) { + for (int i = 0; i < ncolors; i++) + { pCmap->red[i].co.local.red = colors[i].red; pCmap->red[i].co.local.green = colors[i].red; pCmap->red[i].co.local.blue = colors[i].red; @@ -126,10 +123,11 @@ Bool nxagentCreateColormap(ColormapPtr pCmap) case StaticColor: /* read only */ colors = (XColor *)malloc(ncolors * sizeof(XColor)); - for (i = 0; i < ncolors; i++) + for (int i = 0; i < ncolors; i++) colors[i].pixel = i; XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); - for (i = 0; i < ncolors; i++) { + for (int i = 0; i < ncolors; i++) + { pCmap->red[i].co.local.red = colors[i].red; pCmap->red[i].co.local.green = colors[i].green; pCmap->red[i].co.local.blue = colors[i].blue; @@ -139,21 +137,29 @@ Bool nxagentCreateColormap(ColormapPtr pCmap) case TrueColor: /* read only */ colors = (XColor *)malloc(ncolors * sizeof(XColor)); - red = green = blue = 0L; + Pixel red = 0L, green = 0L, blue = 0L; + Pixel redInc, greenInc, blueInc; redInc = lowbit(pVisual->redMask); greenInc = lowbit(pVisual->greenMask); blueInc = lowbit(pVisual->blueMask); - for (i = 0; i < ncolors; i++) { + for (int i = 0; i < ncolors; i++) + { colors[i].pixel = red | green | blue; red += redInc; - if (red > pVisual->redMask) red = 0L; + if (red > pVisual->redMask) + red = 0L; + green += greenInc; - if (green > pVisual->greenMask) green = 0L; + if (green > pVisual->greenMask) + green = 0L; + blue += blueInc; - if (blue > pVisual->blueMask) blue = 0L; + if (blue > pVisual->blueMask) + blue = 0L; } XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); - for (i = 0; i < ncolors; i++) { + for (int i = 0; i < ncolors; i++) + { pCmap->red[i].co.local.red = colors[i].red; pCmap->green[i].co.local.green = colors[i].green; pCmap->blue[i].co.local.blue = colors[i].blue; @@ -188,10 +194,13 @@ static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr) nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *) ptr; for (int i = 0; i < icws->numCmapIDs; i++) - if (SEARCH_PREDICATE) { + { + if (SEARCH_PREDICATE) + { icws->numWindows++; return WT_DONTWALKCHILDREN; } + } return WT_WALKCHILDREN; } @@ -201,10 +210,13 @@ static int nxagentGetInstalledColormapWindows(WindowPtr pWin, void * ptr) nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *)ptr; for (int i = 0; i < icws->numCmapIDs; i++) - if (SEARCH_PREDICATE) { + { + if (SEARCH_PREDICATE) + { icws->windows[icws->index++] = nxagentWindow(pWin); return WT_DONTWALKCHILDREN; } + } return WT_WALKCHILDREN; } @@ -240,7 +252,8 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen) icws.numCmapIDs = nxagentListInstalledColormaps(pScreen, icws.cmapIDs); icws.numWindows = 0; WalkTree(pScreen, nxagentCountInstalledColormapWindows, (void *)&icws); - if (icws.numWindows) { + if (icws.numWindows) + { icws.windows = (Window *)malloc((icws.numWindows + 1) * sizeof(Window)); icws.index = 0; WalkTree(pScreen, nxagentGetInstalledColormapWindows, (void *)&icws); @@ -254,7 +267,8 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen) SAFE_free(icws.cmapIDs); - if (!nxagentSameInstalledColormapWindows(icws.windows, icws.numWindows)) { + if (!nxagentSameInstalledColormapWindows(icws.windows, icws.numWindows)) + { SAFE_free(nxagentOldInstalledColormapWindows); #ifdef _XSERVER64 @@ -281,36 +295,36 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen) This will only work with default local visual colormaps. */ if (icws.numWindows) + { + WindowPtr pWin; + Visual *visual; + ColormapPtr pCmap; + + pWin = nxagentWindowPtr(icws.windows[0]); + visual = nxagentVisualFromID(pScreen, wVisual(pWin)); + + if (visual == nxagentDefaultVisual(pScreen)) + pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), + RT_COLORMAP); + else + pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, + RT_COLORMAP); + + if (pCmap != NULL) { - WindowPtr pWin; - Visual *visual; - ColormapPtr pCmap; - - pWin = nxagentWindowPtr(icws.windows[0]); - visual = nxagentVisualFromID(pScreen, wVisual(pWin)); - - if (visual == nxagentDefaultVisual(pScreen)) - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), - RT_COLORMAP); - else - pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, - RT_COLORMAP); - - if (pCmap != NULL) - { - XSetWindowColormap(nxagentDisplay, - nxagentDefaultWindows[pScreen->myNum], - nxagentColormap(pCmap)); - } - #ifdef WARNING - else - { - fprintf(stderr, "nxagentSetInstalledColormapWindows: WARNING! " - "Window at [%p] has no colormap with class [%d].\n", - (void *)pWin, pWin -> drawable.class); - } - #endif + XSetWindowColormap(nxagentDisplay, + nxagentDefaultWindows[pScreen->myNum], + nxagentColormap(pCmap)); } + #ifdef WARNING + else + { + fprintf(stderr, "nxagentSetInstalledColormapWindows: WARNING! " + "Window at [%p] has no colormap with class [%d].\n", + (void *)pWin, pWin -> drawable.class); + } + #endif + } #endif /* DUMB_WINDOW_MANAGERS */ } else @@ -345,7 +359,8 @@ void nxagentDirectInstallColormaps(ScreenPtr pScreen) { Colormap pCmapIDs[MAXCMAPS]; - if (!nxagentDoDirectColormaps) return; + if (!nxagentDoDirectColormaps) + return; int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); @@ -375,45 +390,39 @@ void nxagentDirectUninstallColormaps(ScreenPtr pScreen) void nxagentInstallColormap(ColormapPtr pCmap) { - int index; - ColormapPtr pOldCmap; - - index = pCmap->pScreen->myNum; - pOldCmap = InstalledMaps[index]; + int index = pCmap->pScreen->myNum; + ColormapPtr pOldCmap = InstalledMaps[index]; if(pCmap != pOldCmap) - { - nxagentDirectUninstallColormaps(pCmap->pScreen); + { + nxagentDirectUninstallColormaps(pCmap->pScreen); - /* Uninstall pInstalledMap. Notify all interested parties. */ - if(pOldCmap != (ColormapPtr)None) - WalkTree(pCmap->pScreen, TellLostMap, (void *)&pOldCmap->mid); + /* Uninstall pInstalledMap. Notify all interested parties. */ + if(pOldCmap != (ColormapPtr)None) + WalkTree(pCmap->pScreen, TellLostMap, (void *)&pOldCmap->mid); - InstalledMaps[index] = pCmap; - WalkTree(pCmap->pScreen, TellGainedMap, (void *)&pCmap->mid); + InstalledMaps[index] = pCmap; + WalkTree(pCmap->pScreen, TellGainedMap, (void *)&pCmap->mid); - nxagentSetInstalledColormapWindows(pCmap->pScreen); - nxagentDirectInstallColormaps(pCmap->pScreen); - } + nxagentSetInstalledColormapWindows(pCmap->pScreen); + nxagentDirectInstallColormaps(pCmap->pScreen); + } } void nxagentUninstallColormap(ColormapPtr pCmap) { - int index; - ColormapPtr pCurCmap; - - index = pCmap->pScreen->myNum; - pCurCmap = InstalledMaps[index]; + int index = pCmap->pScreen->myNum; + ColormapPtr pCurCmap = InstalledMaps[index]; if(pCmap == pCurCmap) + { + if ((unsigned int)pCmap->mid != pCmap->pScreen->defColormap) { - if ((unsigned int)pCmap->mid != pCmap->pScreen->defColormap) - { - pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap, - RT_COLORMAP); - (*pCmap->pScreen->InstallColormap)(pCurCmap); - } + pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap, + RT_COLORMAP); + (*pCmap->pScreen->InstallColormap)(pCurCmap); } + } } int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds) @@ -456,50 +465,43 @@ void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors) void nxagentResolveColor(unsigned short *pRed, unsigned short *pGreen, unsigned short *pBlue, VisualPtr pVisual) { - int shift; - unsigned int lim; - - shift = 16 - pVisual->bitsPerRGBValue; - lim = (1 << pVisual->bitsPerRGBValue) - 1; + int shift = 16 - pVisual->bitsPerRGBValue; + unsigned int lim = (1 << pVisual->bitsPerRGBValue) - 1; if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor)) - { - /* rescale to rgb bits */ - *pRed = ((*pRed >> shift) * 65535) / lim; - *pGreen = ((*pGreen >> shift) * 65535) / lim; - *pBlue = ((*pBlue >> shift) * 65535) / lim; - } + { + /* rescale to rgb bits */ + *pRed = ((*pRed >> shift) * 65535) / lim; + *pGreen = ((*pGreen >> shift) * 65535) / lim; + *pBlue = ((*pBlue >> shift) * 65535) / lim; + } else if (pVisual->class == GrayScale) - { - /* rescale to gray then rgb bits */ - *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100; - *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim; - } + { + /* rescale to gray then rgb bits */ + *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100; + *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim; + } else if (pVisual->class == StaticGray) - { - unsigned int limg; - - limg = pVisual->ColormapEntries - 1; - /* rescale to gray then [0..limg] then [0..65535] then rgb bits */ - *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100; - *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg; - *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim; - } + { + unsigned int limg = pVisual->ColormapEntries - 1; + /* rescale to gray then [0..limg] then [0..65535] then rgb bits */ + *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100; + *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg; + *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim; + } else - { - unsigned limr, limg, limb; - - limr = pVisual->redMask >> pVisual->offsetRed; - limg = pVisual->greenMask >> pVisual->offsetGreen; - limb = pVisual->blueMask >> pVisual->offsetBlue; - /* rescale to [0..limN] then [0..65535] then rgb bits */ - *pRed = ((((((*pRed * (limr + 1)) >> 16) * - 65535) / limr) >> shift) * 65535) / lim; - *pGreen = ((((((*pGreen * (limg + 1)) >> 16) * - 65535) / limg) >> shift) * 65535) / lim; - *pBlue = ((((((*pBlue * (limb + 1)) >> 16) * - 65535) / limb) >> shift) * 65535) / lim; - } + { + unsigned limr = pVisual->redMask >> pVisual->offsetRed; + unsigned limg = pVisual->greenMask >> pVisual->offsetGreen; + unsigned limb = pVisual->blueMask >> pVisual->offsetBlue; + /* rescale to [0..limN] then [0..65535] then rgb bits */ + *pRed = ((((((*pRed * (limr + 1)) >> 16) * + 65535) / limr) >> shift) * 65535) / lim; + *pGreen = ((((((*pGreen * (limg + 1)) >> 16) * + 65535) / limg) >> shift) * 65535) / lim; + *pBlue = ((((((*pBlue * (limb + 1)) >> 16) * + 65535) / limb) >> shift) * 65535) / lim; + } } Bool nxagentCreateDefaultColormap(ScreenPtr pScreen) @@ -507,7 +509,6 @@ Bool nxagentCreateDefaultColormap(ScreenPtr pScreen) VisualPtr pVisual; ColormapPtr pCmap; unsigned short zero = 0, ones = 0xFFFF; - Pixel wp, bp; #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Searching for the root visual [%lu].\n", @@ -523,8 +524,8 @@ Bool nxagentCreateDefaultColormap(ScreenPtr pScreen) != Success) return False; - wp = pScreen->whitePixel; - bp = pScreen->blackPixel; + Pixel wp = pScreen->whitePixel; + Pixel bp = pScreen->blackPixel; if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) != Success) || (AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) != @@ -543,7 +544,6 @@ static void nxagentReconnectColormap(void * p0, XID x1, void * p2) { ColormapPtr pCmap = (ColormapPtr)p0; Bool* pBool = (Bool*)p2; - VisualPtr pVisual; #ifdef NXAGENT_RECONNECT_COLORMAP_DEBUG fprintf(stderr, "nxagentReconnectColormap: %p\n", pCmap); @@ -552,7 +552,7 @@ static void nxagentReconnectColormap(void * p0, XID x1, void * p2) if (!*pBool || !pCmap) return; - pVisual = pCmap -> pVisual; + VisualPtr pVisual = pCmap -> pVisual; nxagentColormapPriv(pCmap)->colormap = XCreateColormap(nxagentDisplay, @@ -569,14 +569,13 @@ static void nxagentReconnectColormap(void * p0, XID x1, void * p2) Bool nxagentReconnectAllColormap(void *p0) { - int cid; Bool success = True; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_COLORMAP_DEBUG) fprintf(stderr, "nxagentReconnectAllColormap\n"); #endif - for (cid = 0; (cid < MAXCLIENTS) && success; cid++) + for (int cid = 0; (cid < MAXCLIENTS) && success; cid++) { if (clients[cid] && success) { -- cgit v1.2.3 From 3b94b9c64f40f5c10196da33725ccf04ed63bfba Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 31 Jul 2019 22:34:24 +0200 Subject: Imakefile: Cleanup defines Some of them are unused, some of them were missing. Also add a list of the available debug macros. --- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 64 ++++++++++++++++++---------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index b3450440e..0e2effff2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -203,18 +203,43 @@ INCLUDES = \ ### NXAGENT Defines: # -# NXAGENT_FONTCACHE_SIZE Number of cache slots -# NXAGENT_SHAPE Old shape code -# NXAGENT_GLYPHCACHE -# NXAGENT_GLYPHCACHE_SIZE Slots for glyph cache -# NXAGENT_SHAPE2 New shape code -# NXAGENT_FIXKEYS Force the release of pressed key when losing focus -# NXAGENT_EXPOSURES Manage expose events +# 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_FONTEXCLUDE Exclude some specific font names (only "-ult1mo" at this moment). -# NXAGENT FULLSCREEN Fullscreen mode # NXAGENT_RANDR_MODE_PREFIX Use prefixed (i.e., nx_x) RandR modes # 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 +# +### 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 +# NXAGENT_DEBUG +# NXAGENT_FIXKEYS_DEBUG +# NXAGENT_FONTCACHE_DEBUG +# NXAGENT_FONTMATCH_DEBUG +# NXAGENT_LOGO_DEBUG +# NXAGENT_RECONNECT_COLORMAP_DEBUG +# NXAGENT_RECONNECT_CURSOR_DEBUG +# NXAGENT_RECONNECT_DEBUG +# NXAGENT_RECONNECT_DISPLAY_DEBUG +# NXAGENT_RECONNECT_FONT_DEBUG +# NXAGENT_RECONNECT_PICTFORMAT_DEBUG +# NXAGENT_RECONNECT_PICTURE_DEBUG +# NXAGENT_RECONNECT_SCREEN_DEBUG +# NXAGENT_RECONNECT_WINDOW_DEBUG +# NXAGENT_XKBD_DEBUG +# NX_DEBUG_INPUT #if nxVersion NX_DEFINES = \ @@ -224,34 +249,27 @@ NX_DEFINES = \ #endif DEFINES = \ - -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \ + -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \ -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI \ -DNXAGENT_SERVER \ - -DNXAGENT_CONSTRAINCURSOR \ - -DNXAGENT_FONTCACHE_SIZE=50 \ - -DNXAGENT_GLYPHCACHE -DNXAGENT_GLYPHCACHE_SIZE=50 \ -DNXAGENT_RENDER_CLEANUP \ -DNXAGENT_SHAPE2 \ -DNXAGENT_FIXKEYS \ -DNXAGENT_CLIPBOARD \ - -DNXAGENT_EXPOSURES \ - -DNXAGENT_FONTEXCLUDE \ - -DNXAGENT_PACKEDIMAGES \ - -DNXAGENT_VISIBILITY \ -DNXAGENT_WAKEUP=1000 \ -DNXAGENT_ONSTART \ -DNXAGENT_ARTSD \ -DNXAGENT_RANDR_MODE_PREFIX \ -UNX_DEBUG_INPUT \ - -DRANDR_10_INTERFACE=1 \ - -DRANDR_12_INTERFACE=1 \ - -DRANDR_13_INTERFACE=1 \ - -DRANDR_14_INTERFACE=1 \ - -DRANDR_15_INTERFACE=1 \ + -DRANDR_10_INTERFACE=1 \ + -DRANDR_12_INTERFACE=1 \ + -DRANDR_13_INTERFACE=1 \ + -DRANDR_14_INTERFACE=1 \ + -DRANDR_15_INTERFACE=1 \ -DPANORAMIX \ -UDEBUG_TREE \ -DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \ - $(NULL) + $(NULL) all:: $(OBJS) -- cgit v1.2.3 From a91e34a8a2ae3b19726f5ecca256b34464af8d40 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 31 Jul 2019 23:18:41 +0200 Subject: Imakefile: make NXAGENT_RANDR_MODE_PREFIX configurable via macro --- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 3 +-- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 10 +++++----- nx-X11/programs/Xserver/hw/nxagent/Utils.h | 4 ++++ 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 0e2effff2..ff9538f3e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -207,7 +207,7 @@ INCLUDES = \ # 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 Use prefixed (i.e., nx_x) RandR modes +# NXAGENT_RANDR_MODE_PREFIX Prefix for RandR 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 # @@ -259,7 +259,6 @@ DEFINES = \ -DNXAGENT_WAKEUP=1000 \ -DNXAGENT_ONSTART \ -DNXAGENT_ARTSD \ - -DNXAGENT_RANDR_MODE_PREFIX \ -UNX_DEBUG_INPUT \ -DRANDR_10_INTERFACE=1 \ -DRANDR_12_INTERFACE=1 \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 3b1d5f450..0fae9b704 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -210,6 +210,10 @@ RegionRec nxagentShadowUpdateRegion; #define NXAGENT_DEFAULT_DPI 96 #define NXAGENT_AUTO_DPI -1 +#ifndef NXAGENT_RANDR_MODE_PREFIX +#define NXAGENT_RANDR_MODE_PREFIX nx_ +#endif + extern Bool nxagentAutoDPI; /* @@ -4220,15 +4224,11 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) memset(&modeInfo, '\0', sizeof(modeInfo)); -#ifdef NXAGENT_RANDR_MODE_PREFIX /* avoid collisions with pre-existing default modes by using a separate namespace. If we'd simply use XxY we could not distinguish between pre-existing modes which should stay and our own modes that should be removed after use. */ - sprintf(name, "nx_%dx%d", new_w, new_h); -#else - sprintf(name, "%dx%d", new_w, new_h); -#endif + sprintf(name, "%s%dx%d", QUOTE(NXAGENT_RANDR_MODE_PREFIX), new_w, new_h); modeInfo.width = new_w; modeInfo.height = new_h; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Utils.h b/nx-X11/programs/Xserver/hw/nxagent/Utils.h index 0aebda839..e61a79144 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Utils.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Utils.h @@ -47,4 +47,8 @@ static inline const char * validateString(const char *str) { #define SAFE_XFree(what) do {if (what) {XFree(what); what = NULL;}} while (0) #define SAFE_free(what) do {free(what); what = NULL;} while (0) +/* some helper macros to produce a quoted string from other macros */ +#define QUOTEEXP(str) #str +#define QUOTE(str) QUOTEEXP(str) + #endif /* __Utils_H__ */ -- cgit v1.2.3 From a514a7e2906fc657866c0e1caf999adc4b031058 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 31 Jul 2019 23:20:07 +0200 Subject: Screen.c: improve readability --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 0fae9b704..221cec1ab 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1278,18 +1278,16 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, int j; for (j = 0; j < numVisuals; j++) { - if (visuals[numVisuals].class == visuals[j].class && - visuals[numVisuals].bitsPerRGBValue == - visuals[j].bitsPerRGBValue && - visuals[numVisuals].ColormapEntries == - visuals[j].ColormapEntries && - visuals[numVisuals].nplanes == visuals[j].nplanes && - visuals[numVisuals].redMask == visuals[j].redMask && - visuals[numVisuals].greenMask == visuals[j].greenMask && - visuals[numVisuals].blueMask == visuals[j].blueMask && - visuals[numVisuals].offsetRed == visuals[j].offsetRed && - visuals[numVisuals].offsetGreen == visuals[j].offsetGreen && - visuals[numVisuals].offsetBlue == visuals[j].offsetBlue) + if (visuals[numVisuals].class == visuals[j].class && + visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue && + visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries && + visuals[numVisuals].nplanes == visuals[j].nplanes && + visuals[numVisuals].redMask == visuals[j].redMask && + visuals[numVisuals].greenMask == visuals[j].greenMask && + visuals[numVisuals].blueMask == visuals[j].blueMask && + visuals[numVisuals].offsetRed == visuals[j].offsetRed && + visuals[numVisuals].offsetGreen == visuals[j].offsetGreen && + visuals[numVisuals].offsetBlue == visuals[j].offsetBlue) break; } -- cgit v1.2.3 From 84867ad0f2beb5444ded5daa0f3f976dbf08a305 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 31 Jul 2019 23:33:50 +0200 Subject: Screen.c: fix typo --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 221cec1ab..e129f6e39 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -2643,7 +2643,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) if (NXShadowCreate(nxagentDisplay, layout, nxagentShadowDisplayName, (void *) &nxagentShadowDisplay) != 1) { - #ifdef PANIIC + #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! Failed to initialize shadow " "display [%s].\n", nxagentShadowDisplayName); #endif -- cgit v1.2.3 From c54feb0bd135d3662edb6a97cf76ca63c47136cc Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 31 Jul 2019 23:43:21 +0200 Subject: Window.c: reactivate disabled debug code --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 80e9bef3b..fadf6ffb1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2671,7 +2671,7 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) nxagentCursorPriv(pCursor, pScreen) && nxagentCursor(pCursor, pScreen)) { - #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG_disabled + #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG char msg[] = "nxagentDisconnectWindow:"; nxagentPrintCursorInfo(pCursor, msg); -- cgit v1.2.3 From 71fca41ff36880c855eed715152fbf2ff50643eb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 1 Aug 2019 00:02:42 +0200 Subject: Screen.c: fix wrong format character --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index e129f6e39..b6b3fcd58 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -401,7 +401,7 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after if (!XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e)) break; #ifdef TEST - fprintf(stderr, "%d: swallowing LeaveNotify event\n", __func__); + fprintf(stderr, "%s: swallowing LeaveNotify event\n", __func__); #endif } -- cgit v1.2.3 From 7d2a222f2c6b87c7277b50ed89e522b39a495975 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 1 Aug 2019 00:13:07 +0200 Subject: xkb: replace NX_TRANS_SOCKET by NXAGENT_SERVER This has nothing to do with the transport. --- nx-X11/programs/Xserver/xkb/xkbDflts.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/xkb/xkbDflts.h b/nx-X11/programs/Xserver/xkb/xkbDflts.h index 575814baa..8fe12bdaf 100644 --- a/nx-X11/programs/Xserver/xkb/xkbDflts.h +++ b/nx-X11/programs/Xserver/xkb/xkbDflts.h @@ -411,7 +411,7 @@ static XkbSymInterpretRec dfltSI[69]= { 255, { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } } }, -#ifndef NX_TRANS_SOCKET +#ifndef NXAGENT_SERVER /* * Make sure that the server can't be killed -- cgit v1.2.3 From b1850beb9f58f32cb13f585b55a44a4467f2093a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 1 Aug 2019 23:18:03 +0200 Subject: nxagent: avoid nested externs --- nx-X11/programs/Xserver/hw/nxagent/Init.c | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 3 ++- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 16 +++++++++------ nx-X11/programs/Xserver/hw/nxagent/NXpicture.c | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 15 ++++++++------ nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 3 ++- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 3 ++- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 4 +--- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 26 ++++++++++--------------- nx-X11/programs/Xserver/os/utils.c | 11 ++++++++--- 10 files changed, 48 insertions(+), 41 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index 2a0bceaf5..0919a695f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -148,6 +148,8 @@ extern void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, void *args); #endif +extern const char *nxagentProgName; + void ddxInitGlobals(void) { /* @@ -199,8 +201,6 @@ Bool nxagentX2go; void checkX2goAgent(void) { - extern const char *nxagentProgName; - #ifdef TEST fprintf(stderr, "%s: nxagentProgName [%s]\n", __func__, nxagentProgName); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index f68623740..b7a054913 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -200,6 +200,8 @@ extern int nxagentClipboardSelection; extern int nxagentMaxSelections; #endif +extern int nxOpenFont(ClientPtr, XID, Mask, unsigned, char*); + void InitSelections() { @@ -774,7 +776,6 @@ ProcOpenFont(register ClientPtr client) fontReq[stuff->nbytes]=0; if (strchr(fontReq,'*') || strchr(fontReq,'?')) { - extern int nxOpenFont(ClientPtr, XID, Mask, unsigned, char*); #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Dispatch: ProcOpenFont try to find a common font with font pattern=%s\n",fontReq); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 78d74a0d5..031e62431 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -147,6 +147,16 @@ extern Display *nxagentDisplay; extern WindowPtr nxagentLastEnteredWindow; +#ifdef VIEWPORT_FRAME +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) @@ -466,11 +476,6 @@ void DefineInitialRootWindow(register WindowPtr win) { register ScreenPtr pScreen = win->drawable.pScreen; - #ifdef VIEWPORT_FRAME - extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr); - #endif - extern int nxagentShadowInit(ScreenPtr, WindowPtr); - sprite.hotPhys.pScreen = pScreen; sprite.hotPhys.x = pScreen->width / 2; sprite.hotPhys.y = pScreen->height / 2; @@ -537,7 +542,6 @@ ProcSendEvent(ClientPtr client) if (stuff -> event.u.u.type == SelectionNotify) { - extern int nxagentSendNotify(xEvent*); if (nxagentSendNotify(&stuff->event) == 1) return Success; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c index 491af5b30..7ccc04bc8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c @@ -81,6 +81,8 @@ void *nxagentMatchingFormats(PictFormatPtr pForm); void nxagentPictureCreateDefaultFormats(ScreenPtr pScreen, FormatInitRec *formats, int *nformats); +extern int nxagentPicturePrivateIndex; + PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) { @@ -303,8 +305,6 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error) static PicturePtr createSourcePicture(void) { - extern int nxagentPicturePrivateIndex; - /* * Compute size of entire PictureRect, plus privates. */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 94e9e4b2a..9799d80d5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -93,6 +93,14 @@ nxagentWMStateRec; #undef TEST #undef DEBUG +#ifdef NXAGENT_CLIPBOARD +extern WindowPtr nxagentGetClipboardWindow(Atom, WindowPtr); +#endif + +#ifdef NXAGENT_ARTSD +extern Atom mcop_local_atom; +#endif + int ProcChangeProperty(ClientPtr client) { @@ -127,11 +135,7 @@ ProcChangeProperty(ClientPtr client) REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); #ifdef NXAGENT_CLIPBOARD - { - extern WindowPtr nxagentGetClipboardWindow(Atom, WindowPtr); - - pWin = nxagentGetClipboardWindow(stuff->property, NULL); - } + pWin = nxagentGetClipboardWindow(stuff->property, NULL); if (pWin == NULL) #endif @@ -168,7 +172,6 @@ ProcChangeProperty(ClientPtr client) they are already set reflecting the server side settings. Just return success. */ - extern Atom mcop_local_atom; if (stuff->property == mcop_local_atom) return client->noClientException; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 8a288b485..5aa7606e8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -124,6 +124,8 @@ extern void nxagentRenderCreateConicalGradient(PicturePtr pPicture, xFixed *stops, xRenderColor *colors); +extern int nxagentAlphaEnabled; + /* * The void pointer is actually a XGlyphElt8. */ @@ -184,7 +186,6 @@ ProcRenderQueryPictFormats (ClientPtr client) int numScreens; int numSubpixel; - extern int nxagentAlphaEnabled; /* REQUEST(xRenderQueryPictFormatsReq); */ REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 9a314391c..e1b55f561 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -81,6 +81,8 @@ extern void fbPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage); +extern int nxagentImageLength(int, int, int, int, int); + void ShmExtensionInit(void) { @@ -228,7 +230,6 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) #ifdef NXAGENT_SERVER int length; char *newdata; - extern int nxagentImageLength(int, int, int, int, int); #ifdef TEST fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n", diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index c4991b014..ec4166f07 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -215,9 +215,7 @@ InitRootWindow(WindowPtr pWin) #ifdef NXAGENT_ARTSD { char artsd_port[10]; - short int nPort; - extern void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); - nPort = atoi(display) + 7000; + short int nPort = atoi(display) + 7000; sprintf(artsd_port,"%d", nPort); nxagentPropagateArtsdProperties(pScreen, artsd_port); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index b6b3fcd58..c8449675a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -141,6 +141,10 @@ extern Bool useXpmIcon; extern Bool nxagentReportWindowIds; +#ifdef NXAGENT_TIMESTAMP +extern unsigned long startTime; +#endif + Window nxagentDefaultWindows[MAXSCREENS]; Window nxagentInputWindows[MAXSCREENS]; Window nxagentScreenSaverWindows[MAXSCREENS]; @@ -216,6 +220,8 @@ RegionRec nxagentShadowUpdateRegion; extern Bool nxagentAutoDPI; +extern char *nxagentKeyboard; + /* * From randr/randr.c. This was originally static * but we need it here. @@ -1197,14 +1203,8 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, } #ifdef NXAGENT_TIMESTAMP - - { - extern unsigned long startTime; - - fprintf(stderr, "Screen: going to open screen, time is [%d] milliseconds.\n", - GetTimeInMillis() - startTime); - } - + fprintf(stderr, "Screen: going to open screen, time is [%d] milliseconds.\n", + GetTimeInMillis() - startTime); #endif /* @@ -2131,13 +2131,8 @@ N/A XSelectInput(nxagentDisplay, DefaultRootWindow(nxagentDisplay), StructureNotifyMask); #ifdef NXAGENT_TIMESTAMP - - { - extern unsigned long startTime; - - fprintf(stderr, "Screen: open screen finished, time is [%d] milliseconds.\n", - GetTimeInMillis() - startTime); - } + fprintf(stderr, "Screen: open screen finished, time is [%d] milliseconds.\n", + GetTimeInMillis() - startTime); #endif @@ -2585,7 +2580,6 @@ void nxagentShadowSetWindowOptions(void) int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) { char *layout = NULL; - extern char *nxagentKeyboard; XlibGC gc; XGCValues value; diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index 4d81ff927..f9b06de2d 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -271,6 +271,14 @@ long Memory_fail = 0; char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ #endif +#ifdef NXAGENT_SERVER +extern const char *nxagentProgName; +#endif + +#ifdef NX_TRANS_SOCKET +extern char **environ; +#endif + extern char dispatchExceptionAtReset; /* Extension enable/disable in miinitext.c */ @@ -554,7 +562,6 @@ AdjustWaitForDelay (void * waitTime, unsigned long newdelay) void UseMsg(void) { #ifdef NXAGENT_SERVER - extern const char *nxagentProgName; ErrorF("Usage: %s [] [:]\n\n", nxagentProgName); #else ErrorF("use: X [:] [option]\n"); @@ -1731,8 +1738,6 @@ Popen(char *command, char *type) #else - extern char **environ; - char **ep = environ; ep = environ; -- cgit v1.2.3 From 4d3bd06ce48301fea54dcb567116dc3091ff83be Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 1 Aug 2019 23:37:56 +0200 Subject: NXdixfonts.c: use NXAGENT_SERVER instead of NX_TRANS_SOCK that macro fits better here since there's no transport specific code. --- nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index bfb208593..992a6674f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -88,13 +88,7 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c); #include "Agent.h" #include "Font.h" -#ifndef NX_TRANS_SOCKET - -#define NX_TRANS_SOCKET - -#endif - -#ifdef NX_TRANS_SOCKET +#ifdef NXAGENT_SERVER #define NXFONTPATHLENGTH 1024 char _NXFontPath[NXFONTPATHLENGTH]; @@ -107,8 +101,6 @@ char _NXFontPath[NXFONTPATHLENGTH]; static const char *_NXGetFontPath(const char *path) { - const char *fontEnv; - /* * Check the environment only once. */ @@ -118,13 +110,13 @@ static const char *_NXGetFontPath(const char *path) return _NXFontPath; } - fontEnv = getenv("NX_FONT"); + const char *fontEnv = getenv("NX_FONT"); if (fontEnv != NULL && *fontEnv != '\0') { if (strlen(fontEnv) + 1 > NXFONTPATHLENGTH) { -#ifdef NX_TRANS_TEST +#ifdef TEST fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n"); #endif goto _NXGetFontPathError; @@ -132,7 +124,7 @@ static const char *_NXGetFontPath(const char *path) snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", fontEnv); -#ifdef NX_TRANS_TEST +#ifdef TEST fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath); #endif @@ -143,7 +135,7 @@ _NXGetFontPathError: snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", path); -#ifdef NX_TRANS_TEST +#ifdef TEST fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath); #endif @@ -1003,9 +995,9 @@ SetDefaultFontPath(char *path) size = 0, bad; -#ifdef NX_TRANS_SOCKET +#ifdef NXAGENT_SERVER path = (char *) _NXGetFontPath(path); -#endif /* NX_TRANS_SOCKET */ +#endif /* NXAGENT_SERVER */ start = path; -- cgit v1.2.3 From 1920599e1829ae0469ea5a1ce04e1e251f564847 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 3 Aug 2019 23:16:05 +0200 Subject: Clipboard.c: whitespace fixes --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 8da1dd285..fe5c7d2c9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -217,7 +217,7 @@ void nxagentPrintSelectionStat(int sel) { SelectionOwner lOwner = lastSelectionOwner[sel]; Selection curSel = CurrentSelections[sel]; - char *s =NULL; + char *s = NULL; #ifdef CLIENTIDS fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d] PID [%d] Cmd [%s]\n", @@ -617,7 +617,7 @@ FIXME: Do we need this? } else { - if (lastSelectionOwner[i].client != NULL && + if (lastSelectionOwner[i].client != NULL && nxagentOption(Clipboard) != ClipboardClient) { xEvent x; @@ -913,7 +913,7 @@ void nxagentCollectPropertyEvent(int resource) SAFE_XFree(pszReturnData); return; } - + if (resultFormat != 8 && resultFormat != 16 && resultFormat != 32) { #ifdef DEBUG @@ -1571,10 +1571,10 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, x.u.selectionNotify.selection = selection; x.u.selectionNotify.target = target; x.u.selectionNotify.property = property; - + (void) TryClientEvents(client, &x, 1, NoEventMask, NoEventMask , NullGrab); - + return 1; } -- cgit v1.2.3 From 39866f5c133230e5731156c2356c8571c971534c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 4 Jul 2019 07:47:19 +0200 Subject: Events.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 111212601..655fcbb95 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -378,13 +378,11 @@ void nxagentRemoteWindowID(Window window, Bool newline) } else if (tp.nitems > 0) { - int count = 0; - int ret; - char **list = NULL; - fprintf(stderr, " \""); - ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count); + int count = 0; + char **list = NULL; + int ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count); if ((ret == Success || ret > 0) && list != NULL) { @@ -1643,9 +1641,6 @@ FIXME: Don't enqueue the KeyRelease event if the key was { for (int k = 0; k < 8; k++) { - const int mask = 1; - - if (val & (mask << k)) { #ifdef NXAGENT_FIXKEYS_DEBUG fprintf(stderr, "sending KeyRelease event for keycode: %x\n", @@ -4679,7 +4674,6 @@ static const char *nxagentGrabStateToString(int state) void nxagentDumpInputDevicesState(void) { - int mask = 1; DeviceIntPtr dev; GrabPtr grab; WindowPtr pWin = NULL; @@ -4697,7 +4691,7 @@ void nxagentDumpInputDevicesState(void) { for (int k = 0; k < 8; k++) { - if (val & (mask << k)) + if (val & (1 << k)) { fprintf(stderr, "\n\t[%d] [%s]", i * 8 + k, XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0))); @@ -4758,7 +4752,7 @@ void nxagentDumpInputDevicesState(void) { for (int k = 0; k < 8; k++) { - if (val & (mask << k)) + if (val & (1 << k)) { fprintf(stderr, "\n\t[%d]", i * 8 + k); } -- cgit v1.2.3 From 82c096ee2b1dd5c6b6ebe1a7955d89b516ab9c0e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 15:25:48 +0200 Subject: Atoms.[ch]: drop unused return code of nxagentInitAtoms() --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 5 +---- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index e65ddaac3..1c48df61c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -177,7 +177,7 @@ void nxagentWMDetect() finishWMDetection(verbose); } -int nxagentInitAtoms() +void nxagentInitAtoms() { /* * Value of nxagentAtoms[8] is "NX_AGENT_SIGNATURE". @@ -195,8 +195,6 @@ int nxagentInitAtoms() fprintf(stderr, "%s: PANIC! Could not create [%s] atom.\n", __func__, nxagentAtomNames[8]); #endif - - return -1; } else { @@ -204,7 +202,6 @@ int nxagentInitAtoms() fprintf(stderr, "nxagentInitAtoms: atom [%s] created with value [%d].\n", nxagentAtomNames[8], atom); #endif - return 1; } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index 2e11c7c69..08eb1cfff 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h @@ -41,7 +41,7 @@ extern Bool nxagentWMIsRunning; * to the agent server. */ -int nxagentInitAtoms(); +void nxagentInitAtoms(); /* * Query and create all the required atoms -- cgit v1.2.3 From c6498ddb7ef193cc9f9606fef77af5e239005e80 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 15:27:52 +0200 Subject: Screen.h: add missing prototype for nxagentPropagateArtsdProperties() --- nx-X11/programs/Xserver/hw/nxagent/Screen.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h index 2f93105ef..bf5d8894e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h @@ -136,6 +136,8 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr, int, int); void nxagentShadowSetRatio(float, float); +void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); + /* * Change window settings to adapt to a ratio. */ -- cgit v1.2.3 From 2f2a8ee008e2f90c4791eaeec6c86b42919cf9f7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 15:41:03 +0200 Subject: Init.c: some scope improvements --- nx-X11/programs/Xserver/hw/nxagent/Init.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index 0919a695f..a7338e49f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -221,15 +221,6 @@ void checkX2goAgent(void) void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) { - char *authority; - int i; - - #ifdef __sun - - char *environment; - - #endif - /* * Print our pid and version information. */ @@ -295,11 +286,13 @@ void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) } #endif - if ((authority = getenv("NX_XAUTHORITY"))) + char *authority = getenv("NX_XAUTHORITY"); + + if (authority) { #ifdef __sun - environment = malloc(15 + strlen(authority)); + char *environment = malloc(15 + strlen(authority)); sprintf(environment, "XAUTHORITY=%s", authority); @@ -391,7 +384,7 @@ FIXME: These variables, if not removed at all because have probably nxagentNumScreens = 1; } - for (i = 0; i < nxagentNumScreens; i++) + for (int i = 0; i < nxagentNumScreens; i++) { AddScreen(nxagentOpenScreen, argc, argv); } -- cgit v1.2.3 From 8aac9b617165ad797f9fa55de01afbef7a8b5541 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 23:02:50 +0200 Subject: Render.c: drop unused nxagentValidatePicture --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index ebc1fe287..ee442c3d5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -152,8 +152,6 @@ int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects, void nxagentDestroyPictureClip(PicturePtr pPicture); -void nxagentValidatePicture(PicturePtr pPicture, Mask mask); - void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); @@ -1233,13 +1231,6 @@ FIXME: Is this useful or just a waste of bandwidth? #endif } -void nxagentValidatePicture(PicturePtr pPicture, Mask mask) -{ - #ifdef DEBUG - fprintf(stderr, "nxagentValidatePicture: Nothing to do.\n"); - #endif -} - void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -- cgit v1.2.3 From 59ea22458e5e233a36023e5641f40c562779263a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 23:08:18 +0200 Subject: Render.c: drop unused nxagentRasterizeTrapezoid --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index ee442c3d5..514f98ba8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -167,9 +167,6 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps); -void nxagentRasterizeTrapezoid(PicturePtr pMask, xTrapezoid *trap, - int x_off, int y_off); - void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris); @@ -2053,14 +2050,6 @@ FIXME: Is this useful or just a waste of bandwidth? #endif } -void nxagentRasterizeTrapezoid(PicturePtr pMask, xTrapezoid *trap, - int x_off, int y_off) -{ - #ifdef DEBUG - fprintf(stderr, "nxagentRasterizeTrapezoids: Nothing to do.\n"); - #endif -} - void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris) -- cgit v1.2.3 From 1c019bd1f3f28d86fa5812171738a1c4acfc457d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 18:08:03 +0200 Subject: Render.c: drop unused nxagentDestroyPictureClip --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 514f98ba8..61f50557f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -150,8 +150,6 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask); int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects, xRectangle *rects, int xOrigin, int yOrigin); -void nxagentDestroyPictureClip(PicturePtr pPicture); - void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); @@ -998,13 +996,6 @@ FIXME: Is this useful or just a waste of bandwidth? return 1; } -void nxagentDestroyPictureClip(PicturePtr pPicture) -{ - #ifdef DEBUG - fprintf(stderr, "nxagentDestroyPictureClip: Nothing to do.\n"); - #endif -} - void nxagentChangePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; -- cgit v1.2.3 From 087b082c759d5a21f7d96dcb1468026f93b3dde8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 23:04:59 +0200 Subject: Render.c: fix broken comment --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 61f50557f..57d0dfc01 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -454,9 +454,9 @@ void nxagentRenderExtensionInit(void) * As the RENDER requests are passed directly to * the remote X server this can cause problems if * our RENDER version is different from the version - * supported by the remote. For this reasos let's + * supported by the remote. For this reasons let's * advertise to our clients the lowest between the - + two versions. + * two versions. */ if (major_version > SERVER_RENDER_MAJOR_VERSION || -- cgit v1.2.3 From 7ca51c52962c19cfc8a487943c1fd603563b8cf8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 23:03:11 +0200 Subject: Render.c. simplify nxagentMatchingFormats --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 57d0dfc01..32639172b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -794,9 +794,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) XRenderPictFormat *nxagentMatchingFormats(PictFormatPtr pFormat) { - int i; - - for (i = 0; i < nxagentNumFormats; i++) + for (int i = 0; i < nxagentNumFormats; i++) { if (pFormat -> type == nxagentArrayFormats[i].type && pFormat -> depth == nxagentArrayFormats[i].depth && -- cgit v1.2.3 From 7d8323a4ad3aa2719fedb69bc765ce33c9141b5e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 17:58:55 +0200 Subject: nxagent: simplify nxagentRenderRealizeCursor also drop unused return code --- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Render.c | 40 ++++++++++----------------- nx-X11/programs/Xserver/hw/nxagent/Render.h | 2 +- 3 files changed, 16 insertions(+), 28 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 5aa7606e8..105d7048b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -90,7 +90,7 @@ void miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box); extern int nxagentCursorSaveRenderInfo(ScreenPtr, CursorPtr); extern void nxagentCursorPostSaveRenderInfo(CursorPtr, ScreenPtr, PicturePtr, int, int); -extern int nxagentRenderRealizeCursor(ScreenPtr, CursorPtr); +extern void nxagentRenderRealizeCursor(ScreenPtr, CursorPtr); extern int nxagentCreatePicture(PicturePtr, Mask); extern void nxagentChangePicture(PicturePtr, Mask); extern int nxagentChangePictureClip(PicturePtr, int, int, xRectangle *, int, int); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 32639172b..b82db7f91 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -532,48 +532,36 @@ void nxagentCursorPostSaveRenderInfo(CursorPtr pCursor, ScreenPtr pScreen, nxagentCursorYOffset(pCursor, pScreen) = y; } -int nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { - int cid; - int x, y; - - PicturePtr pPicture; - - pPicture = nxagentCursorPicture(pCursor, pScreen); + PicturePtr pPicture = nxagentCursorPicture(pCursor, pScreen); pPicture -> refcnt++; - x = nxagentCursorXOffset(pCursor, pScreen); - y = nxagentCursorYOffset(pCursor, pScreen); - - /* - * Set the lossless trap so that the image functions - * will not try to encode the image using a lossy - * compression. Drawables should have a quality flag, - * telling if they were originally encoded with a - * lossy algorithm. This would allow us to skip the - * synchronization if the cursor was already encoded - * with the best quality. - */ + int x = nxagentCursorXOffset(pCursor, pScreen); + int y = nxagentCursorYOffset(pCursor, pScreen); #ifdef TEST - fprintf(stderr, "nxagentRenderRealizeCursor: Forcing the synchronization " - "of the cursor.\n"); + fprintf(stderr, "%s: Forcing the synchronization of the cursor.\n", __func__); #endif nxagentMarkCorruptedRegion(pPicture -> pDrawable, NULL); + /* + * Set the lossless trap so that the image functions will not try to + * encode the image using a lossy compression. Drawables should have + * a quality flag, telling if they were originally encoded with a + * lossy algorithm. This would allow us to skip the synchronization + * if the cursor was already encoded with the best quality. + */ + nxagentLosslessTrap = 1; nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); nxagentLosslessTrap = 0; - cid = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y); - - nxagentCursor(pCursor, pScreen) = cid; - - return 1; + nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y); } int nxagentCreatePicture(PicturePtr pPicture, Mask mask) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.h b/nx-X11/programs/Xserver/hw/nxagent/Render.h index 1c56ec16b..70fefe42d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.h @@ -104,7 +104,7 @@ while (0) void nxagentRenderExtensionInit(void); Bool nxagentPictureInit(ScreenPtr, PictFormatPtr, int); -int nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, int nglyphs, CARD8 *images, int sizeImages); -- cgit v1.2.3 From 45f6e41c4a213f195cbf2ba8a45611289279e64c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 19:04:42 +0200 Subject: Render.c: make nxagentPrintFormat a NOP in normal mode This way we can remove lots of #ifdef DEBUGs --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 51 ++--------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index b82db7f91..fcc418cc0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -114,12 +114,8 @@ XRenderPictFormat *nxagentMatchingFormats(PictFormatPtr pForm); BoxPtr nxagentGlyphsExtents; BoxPtr nxagentTrapezoidExtents; -#ifdef DEBUG - static void nxagentPrintFormat(XRenderPictFormat *pFormat); -#endif - /* * From NXglyph.c. */ @@ -730,12 +726,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) if (pPicture -> pFormat != NULL) { pForm = nxagentMatchingFormats(pPicture -> pFormat); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - - #endif } if (pForm == NULL) @@ -1402,13 +1393,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (maskFormat != NULL) { pForm = nxagentMatchingFormats(maskFormat); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - #endif - if (pForm == NULL) { return; @@ -1888,13 +1874,8 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (maskFormat != NULL) { pForm = nxagentMatchingFormats(maskFormat); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - #endif - if (pForm == NULL) { return; @@ -2048,13 +2029,8 @@ void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (maskFormat != NULL) { pForm = nxagentMatchingFormats(maskFormat); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - #endif - if (pForm == NULL) { return; @@ -2126,13 +2102,8 @@ void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (maskFormat != NULL) { pForm = nxagentMatchingFormats(maskFormat); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - #endif - if (pForm == NULL) { return; @@ -2204,13 +2175,8 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (maskFormat != NULL) { pForm = nxagentMatchingFormats(maskFormat); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - #endif - if (pForm == NULL) { return; @@ -2342,13 +2308,8 @@ void nxagentCreateGlyphSet(GlyphSetPtr pGly) if (pGly -> format != NULL) { pForm = nxagentMatchingFormats(pGly -> format); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - #endif - if (pForm == NULL) { return; @@ -2622,14 +2583,12 @@ Bool nxagentPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) return TRUE; } -#ifdef DEBUG - static void nxagentPrintFormat(XRenderPictFormat *pFormat) { +#ifdef DEBUG if (pFormat == NULL) { fprintf(stderr, "nxagentPrintFormat: WARNING! null pointer passed to function.\n"); - return; } @@ -2655,9 +2614,8 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) pFormat -> direct.blueMask, pFormat -> direct.alpha, pFormat -> direct.alphaMask); -} - #endif +} Bool nxagentFillGlyphSet(GlyphSetPtr pGly) { @@ -2848,12 +2806,7 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) if (pPicture -> pFormat) { pForm = nxagentMatchingFormats(pPicture -> pFormat); - - #ifdef DEBUG - nxagentPrintFormat(pForm); - - #endif } if (!pForm && pPicture->pSourcePict) -- cgit v1.2.3 From 6275bbc6f1ae2bd27e8174d7d19af7f2ee12e7b4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 19:07:14 +0200 Subject: Render.c: remove empty lines around XSync calls make the code more readable --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 36 ----------------------------- 1 file changed, 36 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index fcc418cc0..1690f18d2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -748,9 +748,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) #endif #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif nxagentPicturePriv(pPicture) -> picture = id; @@ -813,9 +811,7 @@ void nxagentDestroyPicture(PicturePtr pPicture) nxagentPicturePriv(pPicture) -> picture); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -872,9 +868,7 @@ FIXME: Is this useful or just a waste of bandwidth? #endif #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif break; @@ -905,9 +899,7 @@ FIXME: Is this useful or just a waste of bandwidth? #endif #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif break; @@ -951,9 +943,7 @@ FIXME: Is this useful or just a waste of bandwidth? #endif #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif XDestroyRegion(reg); @@ -1190,9 +1180,7 @@ FIXME: Is this useful or just a waste of bandwidth? #endif #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -1347,9 +1335,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD height); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -1840,9 +1826,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, nRect); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -2002,9 +1986,7 @@ FIXME: Is this useful or just a waste of bandwidth? #endif #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -2075,9 +2057,7 @@ void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, ntri); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -2148,9 +2128,7 @@ void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, npoint); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -2221,9 +2199,7 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, npoint); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -2242,17 +2218,13 @@ void nxagentQueryFormats(void) if (XRenderQueryFormats(nxagentDisplay)) { #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif xri = (XRenderInfo *) info -> data; @@ -2319,9 +2291,7 @@ void nxagentCreateGlyphSet(GlyphSetPtr pGly) pGly -> remoteID = XRenderCreateGlyphSet(nxagentDisplay, pForm); #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -2451,9 +2421,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, } #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif } @@ -2685,9 +2653,7 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) } #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif nxagentFillGlyphSet(pGly); @@ -2837,9 +2803,7 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) &attributes); #ifdef TEST - XSync(nxagentDisplay, 0); - #endif #ifdef TEST -- cgit v1.2.3 From 56aaea90b4ee442b57f1370e3cafe0418deadc1d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 19:17:53 +0200 Subject: Render.c: Code simplifications Save some lines... --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 261 ++++++++++------------------ 1 file changed, 89 insertions(+), 172 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 1690f18d2..4d56322e2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -211,8 +211,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi, int bitsToClean; int widthInBytes; int height = gi -> height; - register int i; - int j; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n", @@ -237,14 +235,14 @@ nxagentCleanGlyphs(xGlyphInfo *gi, if (ImageByteOrder(dpy) == LSBFirst) { - for (i = 3; i < bytesToClean; i += 4) + for (int i = 3; i < bytesToClean; i += 4) { images[i] = 0x00; } } else { - for (i = 0; i < bytesToClean; i += 4) + for (int i = 0; i < bytesToClean; i += 4) { images[i] = 0x00; } @@ -252,7 +250,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); - for (i = 0; i < bytesPerLine; i++) + for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } @@ -288,8 +286,9 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ImageByteOrder(dpy), BitmapBitOrder(dpy)); #endif - for (i = 1; i <= height; i++) + for (int i = 1; i <= height; i++) { + int j; if (ImageByteOrder(dpy) == BitmapBitOrder(dpy)) { for (j = 1; j <= bytesToClean; j++) @@ -339,7 +338,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); - for (i = 0; i < bytesPerLine; i++) + for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } @@ -375,22 +374,22 @@ nxagentCleanGlyphs(xGlyphInfo *gi, { while (height > 0) { - i = bytesToClean; + int count = bytesToClean; - while (i > 0) + while (count > 0) { - *(images + (bytesPerLine - i)) = 0; + *(images + (bytesPerLine - count)) = 0; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n"); #endif - i--; + count--; } #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); - for (i = 0; i < bytesPerLine; i++) + for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } @@ -564,9 +563,6 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; unsigned long valuemask=0; - XRenderPictFormat *pForm; - - Picture id; #ifdef DEBUG fprintf(stderr, "nxagentCreatePicture: Function called with picture at [%p] and mask [%ld].\n", @@ -721,7 +717,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (pPicture -> pFormat != NULL) { @@ -732,15 +728,14 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) if (pForm == NULL) { fprintf(stderr, "nxagentCreatePicture: WARNING! The requested format was not found.\n"); - return 0; } - id = XRenderCreatePicture(nxagentDisplay, - nxagentDrawable(pPicture -> pDrawable), - pForm, - valuemask, - &attributes); + Picture id = XRenderCreatePicture(nxagentDisplay, + nxagentDrawable(pPicture -> pDrawable), + pForm, + valuemask, + &attributes); #ifdef TEST fprintf(stderr, "nxagentCreatePicture: Created picture at [%p] with drawable at [%p].\n", @@ -1065,19 +1060,15 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPSubwindowMode) { attributes.subwindow_mode = pPicture -> subWindowMode; - if (nxagentCheckPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode) == 0) { valuemask |= CPSubwindowMode; - nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode); } } if (mask & CPClipMask) { - attributes.clip_mask = None; - /* * The nxagent doesn't know the remote id of * the picture's clip mask, so the clip_mask @@ -1086,10 +1077,10 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) * 1. */ + attributes.clip_mask = None; if (nxagentPicturePriv(pPicture) -> lastServerValues.clip_mask != 0) { valuemask |= CPClipMask; - nxagentSetPictureRemoteValue(pPicture, clip_mask, 0); } } @@ -1188,15 +1179,12 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { - RegionPtr pDstRegion; - if (pSrc == NULL || pDst == NULL) { return; } #ifdef DEBUG - if (pSrc && pSrc -> pDrawable != NULL) { fprintf(stderr, "nxagentComposite: Source Picture [%lu][%p] with drawable [%s%s][%p].\n", @@ -1225,12 +1213,11 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD pMask -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window", (void *) pMask -> pDrawable); } - #endif if (NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst)) { - pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, xDst, yDst, width, height); + RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, xDst, yDst, width, height); #ifdef TEST if ((pDstRegion) && (pDst && pDst->pDrawable)) { @@ -1343,23 +1330,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, XGlyphElt8 *elts, int sizeID, GlyphPtr *glyphsBase) { - XRenderPictFormat *pForm; - BoxRec glyphBox; XGlyphElt8 *elements; - #ifdef SPLIT_GLYPH_LISTS - - GlyphPtr glyph; - - int x; - int y; - int i; - int j; - - #endif /* #ifdef SPLIT_GLYPH_LISTS */ - if (pSrc == NULL || pDst == NULL) { return; @@ -1374,7 +1348,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } #endif - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -1421,10 +1395,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (pDst -> pDrawable -> type == DRAWABLE_WINDOW) { - RegionPtr pRegion; - - pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1, - glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); + RegionPtr pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1, + glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); if (RegionNil(pRegion) == 1) { @@ -1562,6 +1534,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, #endif #ifdef SPLIT_GLYPH_LISTS + GlyphPtr glyph; /* * We split glyphs lists here and recalculate @@ -1577,7 +1550,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (nlists > 1) { - for (j = 1; j < nlists; j++) + int x; + int y; + + for (int j = 1; j < nlists; j++) { x = elements -> xOff; y = elements -> yOff; @@ -1587,7 +1563,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, j, nlists, elements -> xOff, elements -> yOff); #endif - for (i = 0; i < elements -> nchars; i++) + for (int i = 0; i < elements -> nchars; i++) { glyph = *glyphsBase++; @@ -1619,7 +1595,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { case 1: { - for (j = 0; j < nlists; j++) + for (int j = 0; j < nlists; j++) { XRenderCompositeText8(nxagentDisplay, op, @@ -1640,7 +1616,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } case 2: { - for (j = 0; j < nlists; j++) + for (int j = 0; j < nlists; j++) { XRenderCompositeText16(nxagentDisplay, op, @@ -1661,7 +1637,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } case 4: { - for (j = 0; j < nlists; j++) + for (int j = 0; j < nlists; j++) { XRenderCompositeText32(nxagentDisplay, op, @@ -1751,19 +1727,15 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n", sizeID); #endif - break; } } - #endif /* #ifdef SPLIT_GLYPH_LISTS */ } void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects) { - RegionPtr rectRegion; - if (pDst == NULL) { return; @@ -1788,7 +1760,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, (op == PictOpSrc || (op == PictOpOver && color -> alpha == 0xffff))) { - rectRegion = RegionFromRects(nRect, rects, CT_REGION); + RegionPtr rectRegion = RegionFromRects(nRect, rects, CT_REGION); if (pDst -> clientClipType != CT_NONE) { @@ -1834,12 +1806,8 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps) { - XRenderPictFormat *pForm; - XTrapezoid *current = (XTrapezoid *) traps; - RegionPtr pDstRegion; - int remaining = ntrap; #ifdef TEST @@ -1853,7 +1821,7 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -1924,11 +1892,11 @@ FIXME: Is this useful or just a waste of bandwidth? if (NXAGENT_SHOULD_DEFER_TRAPEZOIDS(pDst -> pDrawable)) { - pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, - nxagentTrapezoidExtents -> x1, - nxagentTrapezoidExtents -> y1, - nxagentTrapezoidExtents -> x2 - nxagentTrapezoidExtents -> x1, - nxagentTrapezoidExtents -> y2 - nxagentTrapezoidExtents -> y1); + RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, + nxagentTrapezoidExtents -> x1, + nxagentTrapezoidExtents -> y1, + nxagentTrapezoidExtents -> x2 - nxagentTrapezoidExtents -> x1, + nxagentTrapezoidExtents -> y2 - nxagentTrapezoidExtents -> y1); #ifdef TEST if (pDst && pDst->pDrawable) { @@ -1973,14 +1941,14 @@ FIXME: Is this useful or just a waste of bandwidth? nxagentSynchronizeBox(pDst -> pDrawable, nxagentTrapezoidExtents, NEVER_BREAK); } - XRenderCompositeTrapezoids(nxagentDisplay, - op, - nxagentPicturePriv(pSrc) -> picture, - nxagentPicturePriv(pDst) -> picture, - pForm, - xSrc, - ySrc, - (XTrapezoid *) current,remaining); + XRenderCompositeTrapezoids(nxagentDisplay, + op, + nxagentPicturePriv(pSrc) -> picture, + nxagentPicturePriv(pDst) -> picture, + pForm, + xSrc, + ySrc, + (XTrapezoid *) current,remaining); #endif @@ -1994,8 +1962,6 @@ void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentTriangles: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", (void *) pSrc, (void *) pDst, xSrc, ySrc, ntri); @@ -2006,7 +1972,7 @@ void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -2065,8 +2031,6 @@ void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentTriStrip: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint); @@ -2077,7 +2041,7 @@ void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -2136,8 +2100,6 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentTriFan: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint); @@ -2148,7 +2110,7 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -2205,31 +2167,27 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, void nxagentQueryFormats(void) { - XRenderInfo *xri; - XExtDisplayInfo *info = NULL; - XRenderPictFormat *pformat=NULL; - - int i; - #ifdef DEBUG fprintf(stderr, "nxagentQueryFormats.\n"); #endif if (XRenderQueryFormats(nxagentDisplay)) { + int i; + #ifdef DEBUG XSync(nxagentDisplay, 0); #endif - info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay); + XExtDisplayInfo *info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif - xri = (XRenderInfo *) info -> data; + XRenderInfo *xri = (XRenderInfo *) info -> data; - pformat = xri -> format; + XRenderPictFormat *pformat = xri -> format; for (i = 0; i < xri -> nformat; i++) { @@ -2269,13 +2227,11 @@ void nxagentQueryFormats(void) void nxagentCreateGlyphSet(GlyphSetPtr pGly) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentCreateGlyphSet: Glyphset at [%p].\n", (void *) pGly); #endif - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (pGly -> format != NULL) { @@ -2328,13 +2284,6 @@ void nxagentFreeGlyphSet(GlyphSetPtr glyphSet) void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, int nglyphs, CARD8 *images, int sizeImages) { - GlyphRefPtr gr; - Glyph *tempGids; - - int i; - - CARD8 *normalizedImages; - #ifdef DEBUG fprintf(stderr, "nxagentAddGlyphs: Glyphset at [%p]. Number of glyphs [%d].\n", (void *) glyphSet, nglyphs); @@ -2356,12 +2305,12 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, * as synchronized. */ - tempGids = gids; - - for (i = 0; i < nglyphs; i++) + for (int i = 0; i < nglyphs; i++) { - if ((gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0)) && - gr -> glyph != DeletedGlyph) + Glyph *tempGids = gids; + GlyphRefPtr gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0); + + if (gr && gr -> glyph != DeletedGlyph) { #ifdef DEBUG fprintf(stderr, "nxagentAddGlyphs: Added Glyph [%p][%ld] to glyphset [%p].\n", @@ -2374,7 +2323,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, tempGids++; } - normalizedImages = NULL; + CARD8 *normalizedImages = NULL; if (sizeImages > 0) { @@ -2428,11 +2377,8 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph) { GlyphRefPtr gr; - CARD32 *tempGids; Glyph gid; - int i; - if (glyphSet -> remoteID == 0) { #ifdef TEST @@ -2450,9 +2396,9 @@ void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph) * they can be freed. */ - tempGids = gids; + CARD32 *tempGids = gids; - for (i = 0; i < nglyph; i++) + for (int i = 0; i < nglyph; i++) { gid = (Glyph)*tempGids; @@ -2587,10 +2533,6 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) Bool nxagentFillGlyphSet(GlyphSetPtr pGly) { - GlyphPtr glyph; - - int i; - #ifdef DEBUG fprintf(stderr, "nxagentFillGlyphSet: GlyphSet at [%p] Refcount [%ld] Glyphs [%ld] " "Format [%p] FDepth [%d] RemoteID [%ld].\n", (void *) pGly, pGly -> refcnt, @@ -2604,9 +2546,9 @@ Bool nxagentFillGlyphSet(GlyphSetPtr pGly) * corrupted the glyphs for each glyphset. */ - for (i = 0; i < pGly -> hash.hashSet -> size; i++) + for (int i = 0; i < pGly -> hash.hashSet -> size; i++) { - glyph = pGly -> hash.table[i].glyph; + GlyphPtr glyph = pGly -> hash.table[i].glyph; if (glyph && (glyph != DeletedGlyph)) { @@ -2621,12 +2563,11 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) { GlyphSetPtr pGly = (GlyphSetPtr) p0; - XRenderPictFormat *pForm = NULL; - - int i; - if (nxagentReconnectTrap == 0) { + int i; + XRenderPictFormat *pForm = NULL; + #ifdef DEBUG fprintf(stderr, "nxagentReconnectGlyphSet: GlyphSet at [%p].\n", (void *) pGly); #endif @@ -2667,7 +2608,6 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) Bool nxagentReconnectAllGlyphSet(void *p) { Bool success = True; - int i; nxagentQueryFormats(); @@ -2675,7 +2615,7 @@ Bool nxagentReconnectAllGlyphSet(void *p) fprintf(stderr, "nxagentReconnectAllGlyphSet\n"); #endif - for (i = 0; (i < MAXCLIENTS) && (success); i++) + for (int i = 0; (i < MAXCLIENTS) && (success); i++) { if (clients[i]) { @@ -2693,7 +2633,6 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) unsigned long mask = 0; XRenderPictureAttributes attributes; - XRenderPictFormat *pForm; #ifdef TEST fprintf(stderr, "nxagentReconnectPicture: Called with bool [%d] and picture at [%p].\n", @@ -2716,9 +2655,8 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) if (pPicture -> repeat) { - mask |= CPRepeat; - attributes.repeat = (Bool) pPicture -> repeat; + mask |= CPRepeat; } if (pPicture -> alphaMap) @@ -2736,38 +2674,31 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) attributes.alpha_map = nxagentPicture(pPicture -> alphaMap); attributes.alpha_x_origin = pPicture -> alphaOrigin.x; attributes.alpha_y_origin = pPicture -> alphaOrigin.y; - mask |= (CPAlphaMap | CPAlphaXOrigin | CPAlphaYOrigin); } if (pPicture -> graphicsExposures) { attributes.graphics_exposures = pPicture -> graphicsExposures; - mask |= CPGraphicsExposure; } attributes.subwindow_mode = pPicture -> subWindowMode; - mask |= CPSubwindowMode; attributes.poly_edge = pPicture -> polyEdge; - mask |= CPPolyEdge; attributes.poly_mode = pPicture -> polyMode; - mask |= CPPolyMode; attributes.dither = pPicture -> dither; - mask |= CPDither; attributes.component_alpha = pPicture -> componentAlpha; - mask |= CPComponentAlpha; - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (pPicture -> pFormat) { @@ -2827,14 +2758,13 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) Bool nxagentReconnectAllPicture(void *p) { - int i; - Bool r; + Bool r = True; #ifdef TEST fprintf(stderr, "nxagentReconnectAllPicture: Going to recreate all pictures.\n"); #endif - for (i = 0, r = True; i < MAXCLIENTS; i++) + for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { @@ -2883,14 +2813,13 @@ void nxagentDisconnectPicture(void * p0, XID x1, void* p2) Bool nxagentDisconnectAllPicture(void) { - int i; - Bool r; + Bool r = True; #ifdef DEBUG fprintf(stderr, "nxagentDisconnectAllPicture.\n"); #endif - for (i = 0, r = True; i < MAXCLIENTS; i++) + for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { @@ -2913,8 +2842,6 @@ Bool nxagentDisconnectAllPicture(void) void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) { - Picture id; - if (nxagentRenderEnable == False) { return; @@ -2939,7 +2866,7 @@ void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); - id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color); + Picture id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color); #ifdef DEBUG XSync(nxagentDisplay, 0); @@ -2957,10 +2884,6 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, xFixed *stops, xRenderColor *colors) { - Picture id; - - XLinearGradient linearGradient; - if (nxagentRenderEnable == False) { return; @@ -3000,14 +2923,16 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); + XLinearGradient linearGradient; + linearGradient.p1.x = (XFixed) p1 -> x; linearGradient.p1.y = (XFixed) p1 -> y; linearGradient.p2.x = (XFixed) p2 -> x; linearGradient.p2.y = (XFixed) p2 -> y; - id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient, - (XFixed *) stops, - (XRenderColor *) colors, nStops); + Picture id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient, + (XFixed *) stops, + (XRenderColor *) colors, nStops); #ifdef DEBUG XSync(nxagentDisplay, 0); @@ -3028,17 +2953,12 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, xFixed *stops, xRenderColor *colors) { - Picture id; - - XRadialGradient radialGradient; - if (nxagentRenderEnable == False) { return; } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateRadialGradient: Got called.\n"); if (pPicture == NULL) @@ -3065,12 +2985,13 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, { fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! colors pointer is NULL.\n"); } - #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); + XRadialGradient radialGradient; + radialGradient.inner.x = (XFixed) inner -> x; radialGradient.inner.y = (XFixed) inner -> y; radialGradient.inner.radius = (XFixed) innerRadius; @@ -3078,7 +2999,7 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, radialGradient.outer.y = (XFixed) outer -> y; radialGradient.outer.radius = (XFixed) outerRadius; - id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient, + Picture id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient, (XFixed *) stops, (XRenderColor *) colors, nStops); @@ -3099,17 +3020,12 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture, xFixed *stops, xRenderColor *colors) { - Picture id; - - XConicalGradient conicalGradient; - if (nxagentRenderEnable == False) { return; } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateConicalGradient: Got called.\n"); if (pPicture == NULL) @@ -3131,19 +3047,20 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture, { fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! colors pointer is NULL.\n"); } - #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); + XConicalGradient conicalGradient; + conicalGradient.center.x = (XFixed) center -> x; conicalGradient.center.y = (XFixed) center -> y; conicalGradient.angle = (XFixed) angle; - id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient, - (XFixed *) stops, - (XRenderColor *) colors, nStops); + Picture id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient, + (XFixed *) stops, + (XRenderColor *) colors, nStops); #ifdef DEBUG XSync(nxagentDisplay, 0); -- cgit v1.2.3 From 1a9d96e077e9da7aa8468b5a2dd06eab2554798a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 19:44:39 +0200 Subject: Render.c: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 73 ++++++++++++----------------- 1 file changed, 30 insertions(+), 43 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 4d56322e2..fb3cfc5e1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -446,11 +446,10 @@ void nxagentRenderExtensionInit(void) XRenderQueryVersion(nxagentDisplay, &major_version, &minor_version); /* - * As the RENDER requests are passed directly to - * the remote X server this can cause problems if - * our RENDER version is different from the version - * supported by the remote. For this reasons let's - * advertise to our clients the lowest between the + * As the RENDER requests are passed directly to the remote X + * server this can cause problems if our RENDER version is + * different from the version supported by the remote. For this + * reasons let's advertise to our clients the lowest between the * two versions. */ @@ -1070,11 +1069,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPClipMask) { /* - * The nxagent doesn't know the remote id of - * the picture's clip mask, so the clip_mask - * value is used as a boolean: it is set to 0 - * when the clip_mask is None, otherwise it is - * 1. + * The nxagent doesn't know the remote id of the picture's clip + * mask, so the clip_mask value is used as a boolean: it is set to + * 0 when the clip_mask is None, otherwise it is 1. */ attributes.clip_mask = None; @@ -1237,11 +1234,10 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD } /* - * Synchronize the content of the shared memory pixmap - * but pay attention at not doing this more than once. - * We need to wait until the image data has been recom- - * posed at the X server side or the operation will use - * the wrong data. + * Synchronize the content of the shared memory pixmap but pay + * attention at not doing this more than once. We need to wait + * until the image data has been recom- posed at the X server side + * or the operation will use the wrong data. */ if (pSrc -> pDrawable != NULL) @@ -1292,14 +1288,12 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD } /* - * The glyphs flag have to be propagated between - * drawables, in order to avoid to encode the - * text with lossy algorithms (like JPEG). Unlu- - * ckily we have verified that if the render com- - * posite propagates the flag, the deferring of - * render trapezoids doesn't work well. Moreover, - * by commenting out this code we have not noticed - * any visual problems. + * The glyphs flag have to be propagated between drawables, in order + * to avoid to encode the text with lossy algorithms (like + * JPEG). Unlu- ckily we have verified that if the render com- + * posite propagates the flag, the deferring of render trapezoids + * doesn't work well. Moreover, by commenting out this code we have + * not noticed any visual problems. * * if (nxagentDrawableContainGlyphs(pSrc -> pDrawable) == 1) * { @@ -1369,10 +1363,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, glyphBox.y2 = nxagentGlyphsExtents -> y2; /* - * By extending the glyph extents the - * visual aspect looks nicer because - * the synchronized region is not glued - * to the fonts. + * By extending the glyph extents the visual aspect looks nicer + * because the synchronized region is not glued to the fonts. */ if (glyphBox.x2 != glyphBox.x1) @@ -1389,8 +1381,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } /* - * If the destination window is hidden, the - * operation can be prevented. + * If the destination window is hidden, the operation can be + * prevented. */ if (pDst -> pDrawable -> type == DRAWABLE_WINDOW) @@ -1414,9 +1406,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } /* - * Need to synchronize the pixmaps involved in - * the operation before rendering the glyphs - * on the real X server. + * Need to synchronize the pixmaps involved in the operation before + * rendering the glyphs on the real X server. */ if (pSrc -> pDrawable != NULL && @@ -1431,11 +1422,9 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, #endif /* - * If the source drawable is going to be - * repeated over the destination drawable - * during the composite operation, we need - * to synchronize the whole drawable to - * avoid graphical problems. + * If the source drawable is going to be repeated over the + * destination drawable during the composite operation, we need to + * synchronize the whole drawable to avoid graphical problems. */ if (pSrc -> repeat == 1 || nxagentGlyphsExtents == NullBox) @@ -1537,12 +1526,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, GlyphPtr glyph; /* - * We split glyphs lists here and recalculate - * the offsets of each list to make them ab- - * solute and not relatives to the prior list. - * This way each time we call XRenderComposi- - * teText it has to deal only with a list of - * glyphs. This is done to further improve + * We split glyphs lists here and recalculate the offsets of each + * list to make them ab- solute and not relatives to the prior list. + * This way each time we call XRenderComposi- teText it has to deal + * only with a list of glyphs. This is done to further improve * caching. */ -- cgit v1.2.3 From fd274d058d3c86c4fc2e135ae9c2e876b303fda4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 19:47:35 +0200 Subject: Render.c: remove lots of superflous empty lines Improve code readability --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 85 +---------------------------- 1 file changed, 1 insertion(+), 84 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index fb3cfc5e1..5bd78eff0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -554,7 +554,6 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); nxagentLosslessTrap = 0; - nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y); } @@ -602,117 +601,91 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) if (mask & CPRepeat) { attributes.repeat = (Bool)pPicture -> repeat; - valuemask |= CPRepeat; - nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat); } if (mask & CPAlphaMap) { attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture; - valuemask |= CPAlphaMap; - nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map); } if (mask & CPAlphaXOrigin) { attributes.alpha_x_origin = pPicture -> alphaOrigin.x; - valuemask |= CPAlphaXOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin); } if (mask & CPAlphaYOrigin) { attributes.alpha_y_origin = pPicture -> alphaOrigin.y; - valuemask |= CPAlphaYOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin); } if (mask & CPClipXOrigin) { attributes.clip_x_origin = pPicture -> clipOrigin.x; - valuemask |= CPClipXOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin); } if (mask & CPClipYOrigin) { attributes.clip_y_origin = pPicture -> clipOrigin.y; - valuemask |= CPClipYOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin); } if (mask & CPGraphicsExposure) { attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures; - valuemask |= CPGraphicsExposure; - nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures); } if (mask & CPSubwindowMode) { attributes.subwindow_mode = pPicture -> subWindowMode; - valuemask |= CPSubwindowMode; - nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode); } if (mask & CPClipMask) { attributes.clip_mask = None; - valuemask |= CPClipMask; - nxagentSetPictureRemoteValue(pPicture, clip_mask, attributes.clip_mask); } if (mask & CPPolyEdge) { attributes.poly_edge = pPicture -> polyEdge; - valuemask |= CPPolyEdge; - nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge); } if (mask & CPPolyMode) { attributes.poly_mode = pPicture -> polyMode; - valuemask |= CPPolyMode; - nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode); } if (mask & CPDither) { attributes.dither = pPicture -> dither; - valuemask |= CPDither; - nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither); } if (mask & CPComponentAlpha) { attributes.component_alpha = pPicture -> componentAlpha; - valuemask |= CPComponentAlpha; - nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); } @@ -847,7 +820,6 @@ FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS - XRenderSetPictureClipRectangles(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, xOrigin, @@ -858,7 +830,6 @@ FIXME: Is this useful or just a waste of bandwidth? nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin); nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin); nxagentSetPictureRemoteValue(pPicture, clip_mask, 1); - #endif #ifdef DEBUG @@ -878,7 +849,6 @@ FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS - XRenderSetPictureClipRectangles(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, xOrigin, @@ -889,7 +859,6 @@ FIXME: Is this useful or just a waste of bandwidth? nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin); nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin); nxagentSetPictureRemoteValue(pPicture, clip_mask, 1); - #endif #ifdef DEBUG @@ -925,7 +894,6 @@ FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS - XRenderSetPictureClipRegion(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, reg); @@ -933,7 +901,6 @@ FIXME: Is this useful or just a waste of bandwidth? nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin); nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin); nxagentSetPictureRemoteValue(pPicture, clip_mask, 1); - #endif #ifdef DEBUG @@ -975,11 +942,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPRepeat) { attributes.repeat = (Bool)pPicture -> repeat; - if (nxagentCheckPictureRemoteValue(pPicture, repeat, attributes.repeat) == 0) { valuemask |= CPRepeat; - nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat); } } @@ -987,11 +952,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPAlphaMap) { attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture; - if (nxagentCheckPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map) == 0) { valuemask |= CPAlphaMap; - nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map); } } @@ -999,11 +962,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPAlphaXOrigin) { attributes.alpha_x_origin = pPicture -> alphaOrigin.x; - if (nxagentCheckPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin) == 0) { valuemask |= CPAlphaXOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin); } } @@ -1011,11 +972,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPAlphaYOrigin) { attributes.alpha_y_origin = pPicture -> alphaOrigin.y; - if (nxagentCheckPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin) == 0) { valuemask |= CPAlphaYOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin); } } @@ -1023,11 +982,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPClipXOrigin) { attributes.clip_x_origin = pPicture -> clipOrigin.x; - if (nxagentCheckPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin) == 0) { valuemask |= CPClipXOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin); } } @@ -1035,11 +992,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPClipYOrigin) { attributes.clip_y_origin = pPicture -> clipOrigin.y; - if (nxagentCheckPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin) == 0) { valuemask |= CPClipYOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin); } } @@ -1047,11 +1002,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPGraphicsExposure) { attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures; - if (nxagentCheckPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures) == 0) { valuemask |= CPGraphicsExposure; - nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures); } } @@ -1085,11 +1038,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPPolyEdge) { attributes.poly_edge = pPicture -> polyEdge; - if (nxagentCheckPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge) == 0) { valuemask |= CPPolyEdge; - nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge); } } @@ -1097,11 +1048,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPPolyMode) { attributes.poly_mode = pPicture -> polyMode; - if (nxagentCheckPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode) == 0) { valuemask |= CPPolyMode; - nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode); } } @@ -1109,11 +1058,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPDither) { attributes.dither = pPicture -> dither; - if (nxagentCheckPictureRemoteValue(pPicture, dither, attributes.dither) == 0) { valuemask |= CPDither; - nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither); } } @@ -1121,17 +1068,14 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPComponentAlpha) { attributes.component_alpha = pPicture -> componentAlpha; - if (nxagentCheckPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha) == 0) { valuemask |= CPComponentAlpha; - nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); } } #ifdef TEST - if (pPicture && pPicture->pDrawable && pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) { fprintf(stderr, "nxagentChangePicture: %sPixmap [%p] Picture [%p][%p].\n", @@ -1139,7 +1083,6 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) (void *) pPicture -> pDrawable, (void *) nxagentPicturePriv(pPicture) -> picture, (void *) pPicture); } - #endif /* FIXME: Is this useful or just a waste of bandwidth? @@ -1149,7 +1092,6 @@ FIXME: Is this useful or just a waste of bandwidth? Without this the text is not rendered on GTK/Cairo. */ #ifndef SKIP_REALLY_ALL_LOUSY_RENDER_OPERATIONS - if (valuemask != 0) { XRenderChangePicture(nxagentDisplay, @@ -1164,8 +1106,7 @@ FIXME: Is this useful or just a waste of bandwidth? (void *) pPicture); } #endif - - #endif + #endif /* SKIP_REALLY_ALL_LOUSY_RENDER_OPERATIONS */ #ifdef DEBUG XSync(nxagentDisplay, 0); @@ -1598,7 +1539,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, elements++; } - break; } case 2: @@ -1619,7 +1559,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, elements++; } - break; } case 4: @@ -1640,7 +1579,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, elements++; } - break; } default: @@ -1649,7 +1587,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n", sizeID); #endif - break; } } @@ -1673,7 +1610,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, elements -> yOff, (XGlyphElt8*) elements, nlists); - break; } case 2: @@ -1689,7 +1625,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, elements -> yOff, (XGlyphElt16*) elements, nlists); - break; } case 4: @@ -1705,7 +1640,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, elements -> yOff, (XGlyphElt32*) elements, nlists); - break; } default: @@ -1828,7 +1762,6 @@ FIXME: Is this useful or just a waste of bandwidth? #ifndef SKIP_LOUSY_RENDER_OPERATIONS #ifdef TEST - if (pSrc->pDrawable) { fprintf(stderr, "nxagentTrapezoids: Source is a [%s] of geometry [%d,%d].\n", (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), @@ -1840,7 +1773,6 @@ FIXME: Is this useful or just a waste of bandwidth? (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), pDst -> pDrawable -> width, pDst -> pDrawable -> height); } - #endif /* @@ -2194,7 +2126,6 @@ void nxagentQueryFormats(void) } #ifdef DEBUG - if (nxagentNumFormats == 0) { fprintf(stderr, "nxagentQueryFormats: Number of formats is [%d].\n", @@ -2205,7 +2136,6 @@ void nxagentQueryFormats(void) fprintf(stderr, "nxagentQueryFormats: Old number of formats is [%d]. New number of formats is [%d].\n", nxagentNumFormats, i); } - #endif nxagentNumFormats = i; @@ -2413,7 +2343,6 @@ FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS - XRenderSetPictureTransform(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, (XTransform *) transform); @@ -2448,7 +2377,6 @@ FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS - XRenderSetPictureFilter(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, szFilter, @@ -2463,7 +2391,6 @@ FIXME: Is this useful or just a waste of bandwidth? Bool nxagentPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { #ifdef RENDER - #ifdef DEBUG fprintf(stderr, "nxagentPictureInit: Screen [%p].\n", (void *) pScreen); #endif @@ -2478,7 +2405,6 @@ Bool nxagentPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) nxagentPicturePrivateIndex = AllocatePicturePrivateIndex(); AllocatePicturePrivate(pScreen, nxagentPicturePrivateIndex, sizeof(nxagentPrivPictureRec)); - #endif return TRUE; @@ -2758,13 +2684,11 @@ Bool nxagentReconnectAllPicture(void *p) FindClientResourcesByType(clients[i], PictureType, nxagentReconnectPicture, &r); #ifdef WARNING - if (!r) { fprintf(stderr, "nxagentReconnectAllPicture: WARNING! Failed to recreate " "picture for client [%d].\n", i); } - #endif } } @@ -2813,13 +2737,11 @@ Bool nxagentDisconnectAllPicture(void) FindClientResourcesByType(clients[i], PictureType, nxagentDisconnectPicture, &r); #ifdef WARNING - if (!r) { fprintf(stderr, "nxagentDisconnectAllPicture: WARNING! Failed to disconnect " "picture for client [%d].\n", i); } - #endif } } @@ -2835,7 +2757,6 @@ void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateSolidFill: Got called.\n"); if (pPicture == NULL) @@ -2847,7 +2768,6 @@ void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) { fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! color pointer is NULL.\n"); } - #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, @@ -2877,7 +2797,6 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateLinearGradient: Got called.\n"); if (pPicture == NULL) @@ -2904,7 +2823,6 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, { fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! colors pointer is NULL.\n"); } - #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, @@ -3059,4 +2977,3 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture, nxagentPicturePriv(pPicture) -> picture = id; } - -- cgit v1.2.3 From 8fc7a8057f30f0fe7e559510b0392b0fe8eb925d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 20:13:03 +0200 Subject: Render.c: remove some more unused functions nxagentTriangles nxagentTriFan nxagentTriStrip --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 219 ---------------------------- 1 file changed, 219 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 5bd78eff0..6113a419a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -161,20 +161,8 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps); -void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int ntri, xTriangle *tris); - -void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int npoint, xPointFixed *points); - void nxagentChangePicture(PicturePtr pPicture, Mask mask); -void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int npoint, xPointFixed *points); - void nxagentReferenceGlyphSet(GlyphSetPtr glyphSet); void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph); @@ -1877,213 +1865,6 @@ FIXME: Is this useful or just a waste of bandwidth? #endif } -void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int ntri, xTriangle *tris) -{ - #ifdef DEBUG - fprintf(stderr, "nxagentTriangles: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", - (void *) pSrc, (void *) pDst, xSrc, ySrc, ntri); - #endif - - if (pSrc == NULL || pDst == NULL) - { - return; - } - - XRenderPictFormat *pForm = NULL; - - if (maskFormat != NULL) - { - pForm = nxagentMatchingFormats(maskFormat); - nxagentPrintFormat(pForm); - - if (pForm == NULL) - { - return; - } - } - - /* - * If the X_RenderCompositeTriangles requests - * increment the traffic, we can defer the - * operation like nxagentTrapezoids() does. - */ - - if (pSrc -> pDrawable != NULL && - nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) - { - #ifdef TEST - fprintf(stderr, "nxagentTriangles: Going to synchronize the source drawable at [%p].\n", - (void *) pSrc -> pDrawable); - #endif - - nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); - } - - if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) - { - #ifdef TEST - fprintf(stderr, "nxagentTriangles: Going to synchronize the destination drawable at [%p].\n", - (void *) pDst -> pDrawable); - #endif - - nxagentSynchronizeDrawable(pDst -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); - } - - XRenderCompositeTriangles(nxagentDisplay, - op, - nxagentPicturePriv(pSrc) -> picture, - nxagentPicturePriv(pDst) -> picture, - pForm, - xSrc, - ySrc, - (XTriangle*)tris, - ntri); - - #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif -} - -void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int npoint, xPointFixed *points) -{ - #ifdef DEBUG - fprintf(stderr, "nxagentTriStrip: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", - (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint); - #endif - - if (pSrc == NULL || pDst == NULL) - { - return; - } - - XRenderPictFormat *pForm = NULL; - - if (maskFormat != NULL) - { - pForm = nxagentMatchingFormats(maskFormat); - nxagentPrintFormat(pForm); - - if (pForm == NULL) - { - return; - } - } - - /* - * If the X_RenderCompositeTriStrip requests - * increment the traffic, we can defer the - * operation like nxagentTrapezoids() does. - */ - - if (pSrc -> pDrawable != NULL && - nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) - { - #ifdef TEST - fprintf(stderr, "nxagentTriStrip: Going to synchronize the source drawable at [%p].\n", - (void *) pSrc -> pDrawable); - #endif - - nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); - } - - if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) - { - #ifdef TEST - fprintf(stderr, "nxagentTriStrip: Going to synchronize the destination drawable at [%p].\n", - (void *) pDst -> pDrawable); - #endif - - nxagentSynchronizeDrawable(pDst -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); - } - - XRenderCompositeTriStrip(nxagentDisplay, - op, - nxagentPicturePriv(pSrc) -> picture, - nxagentPicturePriv(pDst) -> picture, - pForm, - xSrc, - ySrc, - (XPointFixed*)points, - npoint); - - #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif -} - -void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int npoint, xPointFixed *points) -{ - #ifdef DEBUG - fprintf(stderr, "nxagentTriFan: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", - (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint); - #endif - - if (pSrc == NULL || pDst == NULL) - { - return; - } - - XRenderPictFormat *pForm = NULL; - - if (maskFormat != NULL) - { - pForm = nxagentMatchingFormats(maskFormat); - nxagentPrintFormat(pForm); - - if (pForm == NULL) - { - return; - } - } - - /* - * If the X_RenderCompositeTriFan requests - * increment the traffic, we can defer the - * operation like nxagentTrapezoids() does. - */ - - if (pSrc -> pDrawable != NULL && - nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) - { - #ifdef TEST - fprintf(stderr, "nxagentTriFan: Going to synchronize the source drawable at [%p].\n", - (void *) pSrc -> pDrawable); - #endif - - nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); - } - - if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) - { - #ifdef TEST - fprintf(stderr, "nxagentTriFan: Going to synchronize the destination drawable at [%p].\n", - (void *) pDst -> pDrawable); - #endif - - nxagentSynchronizeDrawable(pDst -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); - } - - XRenderCompositeTriFan(nxagentDisplay, - op, - nxagentPicturePriv(pSrc) -> picture, - nxagentPicturePriv(pDst) -> picture, - pForm, - xSrc, - ySrc, - (XPointFixed*)points, - npoint); - - #ifdef DEBUG - XSync(nxagentDisplay, 0); - #endif -} - void nxagentQueryFormats(void) { #ifdef DEBUG -- cgit v1.2.3 From 4fa0ea268bf77726c15dfe75810d25004b623183 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 20:32:24 +0200 Subject: Events.c: whitespace fixes --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 56 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 655fcbb95..72c39c38c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -431,7 +431,7 @@ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine) } fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s " - "override_redirect=%s\n", indent, "", attributes.x, attributes.y, + "override_redirect=%s\n", indent, "", attributes.x, attributes.y, attributes.width, attributes.height, (attributes.class == 0) ? "CopyFromParent" : ((attributes.class == 1) ? "InputOutput" : "InputOnly"), @@ -525,7 +525,7 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) unsigned char *pszReturnData = NULL; fprintf(stderr, "Window ID=[0x%x] %s Remote ID=[0x%x] ", pWin -> drawable.id, - pWin->parent ? "" : "(the root window)", nxagentWindow(pWin)); + pWin->parent ? "" : "(the root window)", nxagentWindow(pWin)); result = GetWindowProperty(pWin, MakeAtom("WM_NAME", 7, False) , 0, sizeof(CARD32), False, AnyPropertyType, @@ -545,7 +545,7 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) } fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s " - "override_redirect=%s", indent, "", pWin -> drawable.x, pWin -> drawable.y, + "override_redirect=%s", indent, "", pWin -> drawable.x, pWin -> drawable.y, pWin -> drawable.width, pWin -> drawable.height, (pWin -> drawable.class == 0) ? "CopyFromParent" : ((pWin -> drawable.class == 1) ? "InputOutput" : @@ -1206,9 +1206,9 @@ FIXME: Don't enqueue the KeyRelease event if the key was nxagentXkbNumTrap = 0; } - /* Calculate the time elapsed between this and the last event we - received. Add this delta to time we recorded for the last - KeyPress event we passed on to our clients. */ + /* Calculate the time elapsed between this and the last event we + received. Add this delta to time we recorded for the last + KeyPress event we passed on to our clients. */ memset(&x, 0, sizeof(xEvent)); x.u.u.type = KeyRelease; x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode); @@ -1549,18 +1549,18 @@ FIXME: Don't enqueue the KeyRelease event if the key was { WindowPtr pWin; - #ifdef DEBUG - fprintf(stderr, "%s: Going to handle new FocusIn event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); - { - XlibWindow w; + #ifdef DEBUG + fprintf(stderr, "%s: Going to handle new FocusIn event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); + { + XlibWindow w; int revert_to; XGetInputFocus(nxagentDisplay, &w, &revert_to); - fprintf(stderr, "%s: (FocusIn): Event win [0x%x] Focus owner [0x%x] nxagentDefaultWindows[0] [0x%x]\n", __func__, X.xfocus.window, w, nxagentDefaultWindows[0]); - } + fprintf(stderr, "%s: (FocusIn): Event win [0x%x] Focus owner [0x%x] nxagentDefaultWindows[0] [0x%x]\n", __func__, X.xfocus.window, w, nxagentDefaultWindows[0]); + } #else - #ifdef TEST - fprintf(stderr, "%s: Going to handle new FocusIn event\n", __func__); - #endif + #ifdef TEST + fprintf(stderr, "%s: Going to handle new FocusIn event\n", __func__); + #endif #endif /* @@ -1592,27 +1592,27 @@ FIXME: Don't enqueue the KeyRelease event if the key was { #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) fprintf(stderr, "%s: (FocusIn): grabbing\n", __func__); - #endif + #endif nxagentGrabPointerAndKeyboard(NULL); } - /* else + /* else { #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) fprintf(stderr, "%s: (FocusIn): ungrabbing\n", __func__); - #endif + #endif nxagentUngrabPointerAndKeyboard(NULL); } - */ + */ } break; } case FocusOut: { - #ifdef DEBUG - fprintf(stderr, "%s: Going to handle new FocusOut event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); - #else - #ifdef TEST - fprintf(stderr, "%s: Going to handle new FocusOut event.\n", __func__); + #ifdef DEBUG + fprintf(stderr, "%s: Going to handle new FocusOut event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); + #else + #ifdef TEST + fprintf(stderr, "%s: Going to handle new FocusOut event.\n", __func__); #endif #endif @@ -2214,7 +2214,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was /* * Handle the agent window's changes. */ - + if (closeSession) { if (nxagentOption(Persistent)) @@ -3669,7 +3669,7 @@ int nxagentHandleReparentNotify(XEvent* X) int x, y; /* - * Calculate the absolute upper-left X e Y + * Calculate the absolute upper-left X e Y */ if ((XGetWindowAttributes(nxagentDisplay, X -> xreparent.window, @@ -3735,7 +3735,7 @@ int nxagentHandleReparentNotify(XEvent* X) /* * Difference between Absolute X and Parent X gives thickness of side frame. - * Difference between Absolute Y and Parent Y gives thickness of title bar. + * Difference between Absolute Y and Parent Y gives thickness of title bar. */ nxagentChangeOption(WMBorderWidth, (x - xParent)); @@ -4201,7 +4201,7 @@ int nxagentLookupByWindow(WindowPtr pWin) if (nxagentExposeQueue.exposures[i].pWindow == pWin && !nxagentExposeQueue.exposures[i].remoteRegionIsCompleted) { - return i; + return i; } } -- cgit v1.2.3 From f323ada3c631b73c319ff53119aae9d18e1dbf7a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 20:47:15 +0200 Subject: nxagent: move atom initiatialization to Init.c It is not dependent on any root window and needs only be called once on startup. --- nx-X11/programs/Xserver/hw/nxagent/Init.c | 3 +++ nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index a7338e49f..0b4ffd601 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -71,6 +71,7 @@ is" without express or implied warranty. #include "Millis.h" #include "Error.h" #include "Keystroke.h" +#include "Atoms.h" #include #include "compext/Compext.h" @@ -414,6 +415,8 @@ FIXME: These variables, if not removed at all because have probably #ifdef NXAGENT_CLIPBOARD AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL); #endif + + nxagentInitAtoms(); } void diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index ec4166f07..88e68e463 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -106,7 +106,6 @@ Equipment Corporation. #include "Screen.h" #include "Options.h" -#include "Atoms.h" #include "Clipboard.h" #include "Splash.h" #include "Rootless.h" @@ -204,8 +203,6 @@ InitRootWindow(WindowPtr pWin) fprintf(stderr, "InitRootWindow: Mapping default windows.\n"); #endif - nxagentInitAtoms(); - nxagentInitClipboard(pWin); nxagentMapDefaultWindows(); -- cgit v1.2.3 From 15ac7a809672ec9213b5bdcad5bb283c9b365bf1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 21:43:23 +0200 Subject: Trap.h: shorten file by reformatting comments and removing blank lines. --- nx-X11/programs/Xserver/hw/nxagent/Trap.h | 54 +++++++++---------------------- 1 file changed, 15 insertions(+), 39 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.h b/nx-X11/programs/Xserver/hw/nxagent/Trap.h index 3d4bd11f9..cd1e79ff7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Trap.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.h @@ -27,91 +27,68 @@ #define __Traps_H__ /* - * Set if we are dispatching a render - * extension request. Used to avoid + * Set if we are dispatching a render extension request. Used to avoid * reentrancy in GC operations. */ - extern int nxagentGCTrap; /* - * 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. */ - extern int nxagentScreenTrap; /* - * 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. */ - extern int nxagentFBTrap; /* - * Set if we are dispatching a shared - * memory extension request. + * Set if we are dispatching a shared memory extension request. */ - extern int nxagentShmTrap; /* - * Set if a shared pixmap operation is - * requested by the client. + * Set if a shared pixmap operation is requested by the client. */ - extern int nxagentShmPixmapTrap; /* - * Set if we are dispatching a XVideo - * extension request. + * Set if we are dispatching a XVideo extension request. */ - extern int nxagentXvTrap; /* - * Set if we are dispatching a GLX - * extension request. + * Set if we are dispatching a GLX extension request. */ - extern int nxagentGlxTrap; /* * Set while we are resuming the session. */ - extern int nxagentReconnectTrap; /* - * 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. */ - extern int nxagentLosslessTrap; /* - * Set to force the synchronization of - * a drawable. + * Set to force the synchronization of a drawable. */ - extern int nxagentSplitTrap; /* - * 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. */ - extern int nxagentXkbCapsTrap; /* - * 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. */ - extern int nxagentXkbNumTrap; /* @@ -119,7 +96,6 @@ extern int nxagentXkbNumTrap; * the real X server. This is used to avoid endless loops if callbacks * would trigger another event by the real X server */ - extern int nxagentExternalClipboardEventTrap; #endif /* __Trap_H__ */ -- cgit v1.2.3 From 602d4b82b1e6b95e6806fb7fd912ff46a34cb69b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 22:15:20 +0200 Subject: Events.c: add nxagentSwitchEventsAllScreens helper --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 54 ++++++++++------------------- 1 file changed, 19 insertions(+), 35 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 72c39c38c..43504370b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -3746,18 +3746,29 @@ int nxagentHandleReparentNotify(XEvent* X) return 1; } -void nxagentEnableKeyboardEvents(void) +/* + * Helper for nxagent(Enable|Disable)(Keyboard|Pointer)Events + */ +static void nxagentSwitchEventsAllScreens(Mask mask, Bool enable) { - Mask mask = nxagentGetDefaultEventMask(); + Mask newmask = nxagentGetDefaultEventMask(); - mask |= NXAGENT_KEYBOARD_EVENT_MASK; + if (enable) + newmask |= mask; + else + newmask &= ~mask; - nxagentSetDefaultEventMask(mask); + nxagentSetDefaultEventMask(newmask); for (int i = 0; i < nxagentNumScreens; i++) { - XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); + XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], newmask); } +} + +void nxagentEnableKeyboardEvents(void) +{ + nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, True); XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, NXAGENT_KEYBOARD_EXTENSION_EVENT_MASK, @@ -3766,46 +3777,19 @@ void nxagentEnableKeyboardEvents(void) void nxagentDisableKeyboardEvents(void) { - Mask mask = nxagentGetDefaultEventMask(); - - mask &= ~NXAGENT_KEYBOARD_EVENT_MASK; - - nxagentSetDefaultEventMask(mask); - - for (int i = 0; i < nxagentNumScreens; i++) - { - XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); - } + nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, False); XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, 0x0, 0x0); } void nxagentEnablePointerEvents(void) { - Mask mask = nxagentGetDefaultEventMask(); - - mask |= NXAGENT_POINTER_EVENT_MASK; - - nxagentSetDefaultEventMask(mask); - - for (int i = 0; i < nxagentNumScreens; i++) - { - XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); - } + nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, True); } void nxagentDisablePointerEvents(void) { - Mask mask = nxagentGetDefaultEventMask(); - - mask &= ~NXAGENT_POINTER_EVENT_MASK; - - nxagentSetDefaultEventMask(mask); - - for (int i = 0; i < nxagentNumScreens; i++) - { - XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); - } + nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, False); } void nxagentSendFakeKey(int key) -- cgit v1.2.3 From 0a8027135e85a01179acd5cf78e7321f4f46ee5c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 23:29:22 +0200 Subject: Image.c: fix indentation --- nx-X11/programs/Xserver/hw/nxagent/Image.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index a7bacaf85..e55ed2dd2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -644,23 +644,23 @@ FIXME: Should use these. pDrawable -> depth != 1 && nxagentOption(DeferLevel) >= 1) { - /* -- changed by dimbor (small "bed-sheets" never need be prevented - always put) --*/ - if (dstHeight > 16) - { - /* -------------------------------------------------------------------------------- */ - #ifdef TEST - fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on region [%d,%d,%d,%d] " - "for drawable at [%p] with drawable pixmap.\n", pRegion -> extents.x1, - pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, - (void *) pDrawable); - #endif + /* -- changed by dimbor (small "bed-sheets" never need be prevented - always put) --*/ + if (dstHeight > 16) + { + /* -------------------------------------------------------------------------------- */ + #ifdef TEST + fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on region [%d,%d,%d,%d] " + "for drawable at [%p] with drawable pixmap.\n", pRegion -> extents.x1, + pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, + (void *) pDrawable); + #endif - nxagentMarkCorruptedRegion(pDrawable, pRegion); + nxagentMarkCorruptedRegion(pDrawable, pRegion); - goto nxagentPutImageEnd; - /* --- changed by dimbor ---*/ - } - /* ------------------------- */ + goto nxagentPutImageEnd; + /* --- changed by dimbor ---*/ + } + /* ------------------------- */ } if (pDrawable -> type == DRAWABLE_WINDOW && -- cgit v1.2.3 From f6cdd0f9280c1238670ece82f4aeb4b78b8d3bcd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 6 Sep 2019 01:44:33 +0200 Subject: Font.c: add FIXME --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 1 + 1 file changed, 1 insertion(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 7370bc56d..09ad471c8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -1692,6 +1692,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution) const char *s; int field; + /* FIXME: use str(n)dup()? */ if ((scalableFontName = malloc(strlen(fontName) + 1)) == NULL) { #ifdef PANIC -- cgit v1.2.3 From 2682c94077faae061618f89e61242ae96ea35b78 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 6 Sep 2019 00:30:16 +0200 Subject: Display.c: fix format --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index c25afc597..c6412f38a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -2803,11 +2803,11 @@ Bool nxagentReconnectDisplay(void *p0) #endif nxagentConfineWindow = XCreateWindow(nxagentDisplay, - DefaultRootWindow(nxagentDisplay), - 0, 0, 1, 1, 0, 0, - InputOnly, - CopyFromParent, - 0L, NULL); + DefaultRootWindow(nxagentDisplay), + 0, 0, 1, 1, 0, 0, + InputOnly, + CopyFromParent, + 0L, NULL); if (nxagentReportWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: CONFINEMENT_WINDOW,WID:[0x%x]\n", -- cgit v1.2.3 From bf700ec9ed5424d9d80cfcef7bcdf482eacb0960 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 6 Sep 2019 14:50:24 +0200 Subject: Keyboard.c: condense keycode conversion table --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 306 +++++--------------------- 1 file changed, 51 insertions(+), 255 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index b7ed38ca3..0ebaf677b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -188,261 +188,57 @@ static void nxagentCheckRemoteKeycodes(void); static CARD8 nxagentConvertedKeycodes[] = { /* evdev pc105*/ - /* 0 */ 0, - /* 1 */ 1, - /* 2 */ 2, - /* 3 */ 3, - /* 4 */ 4, - /* 5 */ 5, - /* 6 */ 6, - /* 7 */ 7, - /* 8 */ 8, - /* 9 */ 9, - /* 10 */ 10, - /* 11 */ 11, - /* 12 */ 12, - /* 13 */ 13, - /* 14 */ 14, - /* 15 */ 15, - /* 16 */ 16, - /* 17 */ 17, - /* 18 */ 18, - /* 19 */ 19, - /* 20 */ 20, - /* 21 */ 21, - /* 22 */ 22, - /* 23 */ 23, - /* 24 */ 24, - /* 25 */ 25, - /* 26 */ 26, - /* 27 */ 27, - /* 28 */ 28, - /* 29 */ 29, - /* 30 */ 30, - /* 31 */ 31, - /* 32 */ 32, - /* 33 */ 33, - /* 34 */ 34, - /* 35 */ 35, - /* 36 */ 36, - /* 37 */ 37, - /* 38 */ 38, - /* 39 */ 39, - /* 40 */ 40, - /* 41 */ 41, - /* 42 */ 42, - /* 43 */ 43, - /* 44 */ 44, - /* 45 */ 45, - /* 46 */ 46, - /* 47 */ 47, - /* 48 */ 48, - /* 49 */ 49, - /* 50 */ 50, - /* 51 */ 51, - /* 52 */ 52, - /* 53 */ 53, - /* 54 */ 54, - /* 55 */ 55, - /* 56 */ 56, - /* 57 */ 57, - /* 58 */ 58, - /* 59 */ 59, - /* 60 */ 60, - /* 61 */ 61, - /* 62 */ 62, - /* 63 */ 63, - /* 64 */ 64, - /* 65 */ 65, - /* 66 */ 66, - /* 67 */ 67, - /* 68 */ 68, - /* 69 */ 69, - /* 70 */ 70, - /* 71 */ 71, - /* 72 */ 72, - /* 73 */ 73, - /* 74 */ 74, - /* 75 */ 75, - /* 76 */ 76, - /* 77 */ 77, - /* 78 */ 78, - /* 79 */ 79, - /* 80 */ 80, - /* 81 */ 81, - /* 82 */ 82, - /* 83 */ 83, - /* 84 */ 84, - /* 85 */ 85, - /* 86 */ 86, - /* 87 */ 87, - /* 88 */ 88, - /* 89 */ 89, - /* 90 */ 90, - /* 91 */ 91, - /* 92 */ 124, - /* 93 */ 93, - /* 94 */ 94, - /* 95 */ 95, - /* 96 */ 96, - /* 97 */ 211, - /* 98 */ 98, - /* 99 */ 99, - /* 100 */ 100, - /* 101 */ 208, - /* 102 */ 102, - /* 103 */ 103, - /* 104 */ 108, - /* 105 */ 109, - /* 106 */ 112, - /* 107 */ 111, - /* 108 */ 113, - /* 109 */ 109, - /* 110 */ 97, - /* 111 */ 98, - /* 112 */ 99, - /* 113 */ 100, - /* 114 */ 102, - /* 115 */ 103, - /* 116 */ 104, - /* 117 */ 105, - /* 118 */ 106, - /* 119 */ 107, - /* 120 */ 120, - /* 121 */ 121, - /* 122 */ 122, - /* 123 */ 123, - /* 124 */ 124, - /* 125 */ 126, - /* 126 */ 126, - /* 127 */ 110, - /* 128 */ 128, - /* 129 */ 129, - /* 130 */ 130, - /* 131 */ 131, - /* 132 */ 133, - /* 133 */ 115, - /* 134 */ 116, - /* 135 */ 117, - /* 136 */ 136, - /* 137 */ 137, - /* 138 */ 138, - /* 139 */ 139, - /* 140 */ 140, - /* 141 */ 141, - /* 142 */ 142, - /* 143 */ 143, - /* 144 */ 144, - /* 145 */ 145, - /* 146 */ 146, - /* 147 */ 147, - /* 148 */ 148, - /* 149 */ 149, - /* 150 */ 150, - /* 151 */ 151, - /* 152 */ 152, - /* 153 */ 153, - /* 154 */ 154, - /* 155 */ 155, - /* 156 */ 156, - /* 157 */ 157, - /* 158 */ 158, - /* 159 */ 159, - /* 160 */ 160, - /* 161 */ 161, - /* 162 */ 162, - /* 163 */ 163, - /* 164 */ 164, - /* 165 */ 165, - /* 166 */ 166, - /* 167 */ 167, - /* 168 */ 168, - /* 169 */ 169, - /* 170 */ 170, - /* 171 */ 171, - /* 172 */ 172, - /* 173 */ 173, - /* 174 */ 174, - /* 175 */ 175, - /* 176 */ 176, - /* 177 */ 177, - /* 178 */ 178, - /* 179 */ 179, - /* 180 */ 180, - /* 181 */ 181, - /* 182 */ 182, - /* 183 */ 183, - /* 184 */ 184, - /* 185 */ 185, - /* 186 */ 186, - /* 187 */ 187, - /* 188 */ 188, - /* 189 */ 189, - /* 190 */ 190, - /* 191 */ 118, - /* 192 */ 119, - /* 193 */ 120, - /* 194 */ 121, - /* 195 */ 122, - /* 196 */ 196, - /* 197 */ 197, - /* 198 */ 198, - /* 199 */ 199, - /* 200 */ 200, - /* 201 */ 201, - /* 202 */ 202, - /* 203 */ 93, - /* 204 */ 125, - /* 205 */ 156, - /* 206 */ 127, - /* 207 */ 128, - /* 208 */ 208, - /* 209 */ 209, - /* 210 */ 210, - /* 211 */ 211, - /* 212 */ 212, - /* 213 */ 213, - /* 214 */ 214, - /* 215 */ 215, - /* 216 */ 216, - /* 217 */ 217, - /* 218 */ 218, - /* 219 */ 219, - /* 220 */ 220, - /* 221 */ 221, - /* 222 */ 222, - /* 223 */ 223, - /* 224 */ 224, - /* 225 */ 225, - /* 226 */ 226, - /* 227 */ 227, - /* 228 */ 228, - /* 229 */ 229, - /* 230 */ 230, - /* 231 */ 231, - /* 232 */ 232, - /* 233 */ 233, - /* 234 */ 234, - /* 235 */ 235, - /* 236 */ 236, - /* 237 */ 237, - /* 238 */ 238, - /* 239 */ 239, - /* 240 */ 240, - /* 241 */ 241, - /* 242 */ 242, - /* 243 */ 243, - /* 244 */ 244, - /* 245 */ 245, - /* 246 */ 246, - /* 247 */ 247, - /* 248 */ 248, - /* 249 */ 249, - /* 250 */ 250, - /* 251 */ 251, - /* 252 */ 252, - /* 253 */ 253, - /* 254 */ 254, + /* 0 */ 0, /* 1 */ 1, /* 2 */ 2, /* 3 */ 3, /* 4 */ 4, + /* 5 */ 5, /* 6 */ 6, /* 7 */ 7, /* 8 */ 8, /* 9 */ 9, + /* 10 */ 10, /* 11 */ 11, /* 12 */ 12, /* 13 */ 13, /* 14 */ 14, + /* 15 */ 15, /* 16 */ 16, /* 17 */ 17, /* 18 */ 18, /* 19 */ 19, + /* 20 */ 20, /* 21 */ 21, /* 22 */ 22, /* 23 */ 23, /* 24 */ 24, + /* 25 */ 25, /* 26 */ 26, /* 27 */ 27, /* 28 */ 28, /* 29 */ 29, + /* 30 */ 30, /* 31 */ 31, /* 32 */ 32, /* 33 */ 33, /* 34 */ 34, + /* 35 */ 35, /* 36 */ 36, /* 37 */ 37, /* 38 */ 38, /* 39 */ 39, + /* 40 */ 40, /* 41 */ 41, /* 42 */ 42, /* 43 */ 43, /* 44 */ 44, + /* 45 */ 45, /* 46 */ 46, /* 47 */ 47, /* 48 */ 48, /* 49 */ 49, + /* 50 */ 50, /* 51 */ 51, /* 52 */ 52, /* 53 */ 53, /* 54 */ 54, + /* 55 */ 55, /* 56 */ 56, /* 57 */ 57, /* 58 */ 58, /* 59 */ 59, + /* 60 */ 60, /* 61 */ 61, /* 62 */ 62, /* 63 */ 63, /* 64 */ 64, + /* 65 */ 65, /* 66 */ 66, /* 67 */ 67, /* 68 */ 68, /* 69 */ 69, + /* 70 */ 70, /* 71 */ 71, /* 72 */ 72, /* 73 */ 73, /* 74 */ 74, + /* 75 */ 75, /* 76 */ 76, /* 77 */ 77, /* 78 */ 78, /* 79 */ 79, + /* 80 */ 80, /* 81 */ 81, /* 82 */ 82, /* 83 */ 83, /* 84 */ 84, + /* 85 */ 85, /* 86 */ 86, /* 87 */ 87, /* 88 */ 88, /* 89 */ 89, + /* 90 */ 90, /* 91 */ 91, /* 92 */ 124, /* 93 */ 93, /* 94 */ 94, + /* 95 */ 95, /* 96 */ 96, /* 97 */ 211, /* 98 */ 98, /* 99 */ 99, + /* 100 */ 100, /* 101 */ 208, /* 102 */ 102, /* 103 */ 103, /* 104 */ 108, + /* 105 */ 109, /* 106 */ 112, /* 107 */ 111, /* 108 */ 113, /* 109 */ 109, + /* 110 */ 97, /* 111 */ 98, /* 112 */ 99, /* 113 */ 100, /* 114 */ 102, + /* 115 */ 103, /* 116 */ 104, /* 117 */ 105, /* 118 */ 106, /* 119 */ 107, + /* 120 */ 120, /* 121 */ 121, /* 122 */ 122, /* 123 */ 123, /* 124 */ 124, + /* 125 */ 126, /* 126 */ 126, /* 127 */ 110, /* 128 */ 128, /* 129 */ 129, + /* 130 */ 130, /* 131 */ 131, /* 132 */ 133, /* 133 */ 115, /* 134 */ 116, + /* 135 */ 117, /* 136 */ 136, /* 137 */ 137, /* 138 */ 138, /* 139 */ 139, + /* 140 */ 140, /* 141 */ 141, /* 142 */ 142, /* 143 */ 143, /* 144 */ 144, + /* 145 */ 145, /* 146 */ 146, /* 147 */ 147, /* 148 */ 148, /* 149 */ 149, + /* 150 */ 150, /* 151 */ 151, /* 152 */ 152, /* 153 */ 153, /* 154 */ 154, + /* 155 */ 155, /* 156 */ 156, /* 157 */ 157, /* 158 */ 158, /* 159 */ 159, + /* 160 */ 160, /* 161 */ 161, /* 162 */ 162, /* 163 */ 163, /* 164 */ 164, + /* 165 */ 165, /* 166 */ 166, /* 167 */ 167, /* 168 */ 168, /* 169 */ 169, + /* 170 */ 170, /* 171 */ 171, /* 172 */ 172, /* 173 */ 173, /* 174 */ 174, + /* 175 */ 175, /* 176 */ 176, /* 177 */ 177, /* 178 */ 178, /* 179 */ 179, + /* 180 */ 180, /* 181 */ 181, /* 182 */ 182, /* 183 */ 183, /* 184 */ 184, + /* 185 */ 185, /* 186 */ 186, /* 187 */ 187, /* 188 */ 188, /* 189 */ 189, + /* 190 */ 190, /* 191 */ 118, /* 192 */ 119, /* 193 */ 120, /* 194 */ 121, + /* 195 */ 122, /* 196 */ 196, /* 197 */ 197, /* 198 */ 198, /* 199 */ 199, + /* 200 */ 200, /* 201 */ 201, /* 202 */ 202, /* 203 */ 93, /* 204 */ 125, + /* 205 */ 156, /* 206 */ 127, /* 207 */ 128, /* 208 */ 208, /* 209 */ 209, + /* 210 */ 210, /* 211 */ 211, /* 212 */ 212, /* 213 */ 213, /* 214 */ 214, + /* 215 */ 215, /* 216 */ 216, /* 217 */ 217, /* 218 */ 218, /* 219 */ 219, + /* 220 */ 220, /* 221 */ 221, /* 222 */ 222, /* 223 */ 223, /* 224 */ 224, + /* 225 */ 225, /* 226 */ 226, /* 227 */ 227, /* 228 */ 228, /* 229 */ 229, + /* 230 */ 230, /* 231 */ 231, /* 232 */ 232, /* 233 */ 233, /* 234 */ 234, + /* 235 */ 235, /* 236 */ 236, /* 237 */ 237, /* 238 */ 238, /* 239 */ 239, + /* 240 */ 240, /* 241 */ 241, /* 242 */ 242, /* 243 */ 243, /* 244 */ 244, + /* 245 */ 245, /* 246 */ 246, /* 247 */ 247, /* 248 */ 248, /* 249 */ 249, + /* 250 */ 250, /* 251 */ 251, /* 252 */ 252, /* 253 */ 253, /* 254 */ 254, /* 255 */ 255 }; -- cgit v1.2.3 From 9512e64518a62c09428f45edd73a7af54119f5a3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 6 Sep 2019 14:30:39 +0200 Subject: Holder.c: remove superflous return --- nx-X11/programs/Xserver/hw/nxagent/Holder.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Holder.c b/nx-X11/programs/Xserver/hw/nxagent/Holder.c index aae48471b..c27f67818 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Holder.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Holder.c @@ -185,8 +185,6 @@ void nxagentApplyPlaceholder(Drawable drawable, int x, int y, } XFreeGC(nxagentDisplay, gc); - - return; } #ifdef DUMP -- cgit v1.2.3 From 9693d8b989c9ac868c76d19129fcbb078ccefbed Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 22:57:57 +0200 Subject: Events.c: drop unused function --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 43504370b..e9de1450d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -4596,11 +4596,6 @@ int nxagentWaitEvents(Display *dpy, useconds_t msec) #ifdef NX_DEBUG_INPUT -void nxagentDumpInputInfo(void) -{ - fprintf(stderr, "Dumping input info ON.\n"); -} - void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data) { if (strcmp(validateString(NameForAtom(property)), "NX_DEBUG_INPUT") == 0) -- cgit v1.2.3 From df9d37da58c0f10a7c5aed2af5ccb8a130c7a5b4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 6 Sep 2019 02:22:26 +0200 Subject: GC.c: introduce helper macros for GC management --- nx-X11/programs/Xserver/hw/nxagent/GC.c | 324 ++++++++------------------------ 1 file changed, 79 insertions(+), 245 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c index df9c4ad0a..b53428f96 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GC.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c @@ -297,85 +297,27 @@ void nxagentValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) pGC->stipple = lastStipple; } +#define CHECKGCVAL(cmask, member, val) do {if (mask & cmask) { values.member = (val); changeFlag += nxagentTestGC(values.member, member); } } while (0) + void nxagentChangeGC(GCPtr pGC, unsigned long mask) { #ifdef TEST static int nDiscarded; #endif - XGCValues values; - + XGCValues values = {0}; int changeFlag = 0; - if (mask & GCFunction) - { - values.function = pGC->alu; - - changeFlag |= nxagentTestGC(values.function, function); - } - - if (mask & GCPlaneMask) - { - values.plane_mask = pGC->planemask; - - changeFlag += nxagentTestGC(values.plane_mask, plane_mask); - } - - if (mask & GCForeground) - { - values.foreground = nxagentPixel(pGC->fgPixel); - - changeFlag += nxagentTestGC(values.foreground, foreground); - } - - if (mask & GCBackground) - { - values.background = nxagentPixel(pGC->bgPixel); - - changeFlag += nxagentTestGC(values.background, background); - } - - if (mask & GCLineWidth) - { - values.line_width = pGC->lineWidth; - - changeFlag += nxagentTestGC(values.line_width, line_width); - } - - if (mask & GCLineStyle) - { - values.line_style = pGC->lineStyle; - - changeFlag += nxagentTestGC(values.line_style, line_style); - } - - if (mask & GCCapStyle) - { - values.cap_style = pGC->capStyle; - - changeFlag += nxagentTestGC(values.cap_style, cap_style); - } - - if (mask & GCJoinStyle) - { - values.join_style = pGC->joinStyle; - - changeFlag += nxagentTestGC(values.join_style, join_style); - } - - if (mask & GCFillStyle) - { - values.fill_style = pGC->fillStyle; - - changeFlag += nxagentTestGC(values.fill_style, fill_style); - } - - if (mask & GCFillRule) - { - values.fill_rule = pGC->fillRule; - - changeFlag += nxagentTestGC(values.fill_rule, fill_rule); - } + CHECKGCVAL(GCFunction, function, pGC->alu); + CHECKGCVAL(GCPlaneMask, plane_mask, pGC->planemask); + CHECKGCVAL(GCForeground, foreground, nxagentPixel(pGC->fgPixel)); + CHECKGCVAL(GCBackground, background, nxagentPixel(pGC->bgPixel)); + CHECKGCVAL(GCLineWidth, line_width, pGC->lineWidth); + CHECKGCVAL(GCLineStyle, line_style, pGC->lineStyle); + CHECKGCVAL(GCCapStyle, cap_style, pGC->capStyle); + CHECKGCVAL(GCJoinStyle, join_style, pGC->joinStyle); + CHECKGCVAL(GCFillStyle, fill_style, pGC->fillStyle); + CHECKGCVAL(GCFillRule, fill_rule, pGC->fillRule); if (mask & GCTile) { @@ -460,19 +402,8 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask) changeFlag += nxagentTestGC(values.stipple, stipple); } - if (mask & GCTileStipXOrigin) - { - values.ts_x_origin = pGC->patOrg.x; - - changeFlag += nxagentTestGC(values.ts_x_origin, ts_x_origin); - } - - if (mask & GCTileStipYOrigin) - { - values.ts_y_origin = pGC->patOrg.y; - - changeFlag += nxagentTestGC(values.ts_y_origin, ts_y_origin); - } + CHECKGCVAL(GCTileStipXOrigin, ts_x_origin, pGC->patOrg.x); + CHECKGCVAL(GCTileStipYOrigin, ts_y_origin, pGC->patOrg.y); if (mask & GCFont) { @@ -483,38 +414,14 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask) else { values.font = nxagentFont(pGC->font); - changeFlag += nxagentTestGC(values.font, font); } } - if (mask & GCSubwindowMode) - { - values.subwindow_mode = pGC->subWindowMode; - - changeFlag += nxagentTestGC(values.subwindow_mode, subwindow_mode); - } - - if (mask & GCGraphicsExposures) - { - values.graphics_exposures = pGC->graphicsExposures; - - changeFlag += nxagentTestGC(values.graphics_exposures, graphics_exposures); - } - - if (mask & GCClipXOrigin) - { - values.clip_x_origin = pGC->clipOrg.x; - - changeFlag += nxagentTestGC(values.clip_x_origin, clip_x_origin); - } - - if (mask & GCClipYOrigin) - { - values.clip_y_origin = pGC->clipOrg.y; - - changeFlag += nxagentTestGC(values.clip_y_origin, clip_y_origin); - } + CHECKGCVAL(GCSubwindowMode, subwindow_mode, pGC->subWindowMode); + CHECKGCVAL(GCGraphicsExposures, graphics_exposures, pGC->graphicsExposures); + CHECKGCVAL(GCClipXOrigin, clip_x_origin, pGC->clipOrg.x); + CHECKGCVAL(GCClipYOrigin, clip_y_origin, pGC->clipOrg.y); if (mask & GCClipMask) { @@ -525,12 +432,7 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask) mask &= ~GCClipMask; } - if (mask & GCDashOffset) - { - values.dash_offset = pGC->dashOffset; - - changeFlag += nxagentTestGC(values.dash_offset, dash_offset); - } + CHECKGCVAL(GCDashOffset, dash_offset, pGC->dashOffset); if (mask & GCDashList) { @@ -543,12 +445,7 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask) } } - if (mask & GCArcMode) - { - values.arc_mode = pGC->arcMode; - - changeFlag += nxagentTestGC(values.arc_mode, arc_mode); - } + CHECKGCVAL(GCArcMode, arc_mode, pGC->arcMode); if (nxagentGCTrap == 1) { @@ -1008,10 +905,10 @@ int nxagentDestroyNewGCResourceType(void * p, XID id) return 1; } +#define SETGCVAL(mask, member, val) valuemask |= mask; values.member = (val) + static void nxagentReconnectGC(void *param0, XID param1, void * param2) { - XGCValues values; - unsigned long valuemask; GCPtr pGC = (GCPtr) param0; Bool *pBool = (Bool*)param2; @@ -1035,42 +932,29 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2) fprintf(stderr, "nxagentReconnectGC: GC at [%p].\n", (void *) pGC); #endif - valuemask = 0; - memset(&values,0,sizeof(XGCValues)); - values.function = pGC->alu; - valuemask |= GCFunction; - values.plane_mask = pGC->planemask; - valuemask |= GCPlaneMask; - values.foreground = nxagentPixel(pGC->fgPixel); - valuemask |= GCForeground; - values.background = nxagentPixel(pGC->bgPixel); - valuemask |= GCBackground; - - values.line_width = pGC->lineWidth; - valuemask |= GCLineWidth; - values.line_style = pGC->lineStyle; - valuemask |= GCLineStyle; - values.cap_style = pGC->capStyle; - valuemask |= GCCapStyle; - values.join_style = pGC->joinStyle; - valuemask |= GCJoinStyle; - values.fill_style = pGC->fillStyle; - valuemask |= GCFillStyle; - values.fill_rule = pGC->fillRule; - valuemask |= GCFillRule; - - if (!pGC -> tileIsPixel && (pGC -> tile.pixmap != NULL)) + XGCValues values = {0}; + unsigned long valuemask = 0; + SETGCVAL(GCFunction, function, pGC->alu); + SETGCVAL(GCPlaneMask, plane_mask, pGC->planemask); + SETGCVAL(GCForeground, foreground, nxagentPixel(pGC->fgPixel)); + SETGCVAL(GCBackground, background, nxagentPixel(pGC->bgPixel)); + SETGCVAL(GCLineWidth, line_width, pGC->lineWidth); + SETGCVAL(GCLineStyle, line_style, pGC->lineStyle); + SETGCVAL(GCCapStyle, cap_style, pGC->capStyle); + SETGCVAL(GCJoinStyle, join_style, pGC->joinStyle); + SETGCVAL(GCFillStyle, fill_style, pGC->fillStyle); + SETGCVAL(GCFillRule, fill_rule, pGC->fillRule); + + if (!pGC -> tileIsPixel && (pGC -> tile.pixmap != NULL)) { if (nxagentPixmapIsVirtual(pGC -> tile.pixmap)) { - values.tile = nxagentPixmap(nxagentRealPixmap(pGC -> tile.pixmap)); + SETGCVAL(GCTile, tile, nxagentPixmap(nxagentRealPixmap(pGC -> tile.pixmap))); } else { - values.tile = nxagentPixmap(pGC -> tile.pixmap); + SETGCVAL(GCTile, tile, nxagentPixmap(pGC -> tile.pixmap)); } - - valuemask |= GCTile; } if (pGC->stipple != NULL) @@ -1087,7 +971,7 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2) nxagentReconnectPixmap(nxagentRealPixmap(pGC -> stipple), 0, pBool); } - values.stipple = nxagentPixmap(nxagentRealPixmap(pGC -> stipple)); + SETGCVAL(GCStipple, stipple, nxagentPixmap(nxagentRealPixmap(pGC -> stipple))); } else { @@ -1101,42 +985,31 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2) nxagentReconnectPixmap(pGC -> stipple, 0, pBool); } - values.stipple = nxagentPixmap(pGC->stipple); + SETGCVAL(GCStipple, stipple, nxagentPixmap(pGC->stipple)); } - valuemask |= GCStipple; } - values.ts_x_origin = pGC->patOrg.x; - valuemask |= GCTileStipXOrigin; - values.ts_y_origin = pGC->patOrg.y; - valuemask |= GCTileStipYOrigin; + SETGCVAL(GCTileStipXOrigin, ts_x_origin, pGC->patOrg.x); + SETGCVAL(GCTileStipYOrigin, ts_y_origin, pGC->patOrg.y); if (pGC->font != NULL) { - values.font = nxagentFont(pGC->font); - valuemask |= GCFont; + SETGCVAL(GCFont, font, nxagentFont(pGC->font)); } - values.subwindow_mode = pGC->subWindowMode; - valuemask |= GCSubwindowMode; - values.graphics_exposures = pGC->graphicsExposures; - valuemask |= GCGraphicsExposures; - values.clip_x_origin = pGC->clipOrg.x; - valuemask |= GCClipXOrigin; - values.clip_y_origin = pGC->clipOrg.y; - valuemask |= GCClipYOrigin; - valuemask |= GCClipMask; - values.dash_offset = pGC->dashOffset; - valuemask |= GCDashOffset; + SETGCVAL(GCSubwindowMode, subwindow_mode, pGC->subWindowMode); + SETGCVAL(GCGraphicsExposures, graphics_exposures, pGC->graphicsExposures); + SETGCVAL(GCClipXOrigin, clip_x_origin, pGC->clipOrg.x); + SETGCVAL(GCClipYOrigin, clip_y_origin, pGC->clipOrg.y); + valuemask |= GCClipMask; /* FIXME: where's the ClipMask pixmap?? */ + SETGCVAL(GCDashOffset, dash_offset, pGC->dashOffset); if (pGC->dash != NULL) { - values.dashes = *pGC->dash; - valuemask |= GCDashList; + SETGCVAL(GCDashList, dashes, *pGC->dash); } - values.arc_mode = pGC->arcMode; - valuemask |= GCArcMode; + SETGCVAL(GCArcMode, arc_mode, pGC->arcMode); if ((nxagentGC(pGC) = XCreateGC(nxagentDisplay, nxagentDefaultDrawables[pGC->depth], @@ -1440,22 +1313,17 @@ static int nxagentCompareRegions(RegionPtr r1, RegionPtr r2) */ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen) { - GCPtr pGC; - XGCValues values; - unsigned long mask; - int nxagentSaveGCTrap; - /* * The GC trap is temporarily disabled in * order to allow the remote clipmask reset * requested by GetScratchGC(). */ - nxagentSaveGCTrap = nxagentGCTrap; + int nxagentSaveGCTrap = nxagentGCTrap; nxagentGCTrap = 0; - pGC = GetScratchGC(depth, pScreen); + GCPtr pGC = GetScratchGC(depth, pScreen); nxagentGCTrap = nxagentSaveGCTrap; @@ -1468,65 +1336,31 @@ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen) return NULL; } - mask = 0; - - values.function = pGC -> alu; - mask |= GCFunction; - - values.plane_mask = pGC -> planemask; - mask |= GCPlaneMask; - - values.foreground = nxagentPixel(pGC -> fgPixel); - mask |= GCForeground; - - values.background = nxagentPixel(pGC -> bgPixel); - mask |= GCBackground; - - values.line_width = pGC -> lineWidth; - mask |= GCLineWidth; - - values.line_style = pGC -> lineStyle; - mask |= GCLineStyle; - - values.cap_style = pGC -> capStyle; - mask |= GCCapStyle; - - values.join_style = pGC -> joinStyle; - mask |= GCJoinStyle; - - values.fill_style = pGC -> fillStyle; - mask |= GCFillStyle; - - values.fill_rule = pGC -> fillRule; - mask |= GCFillRule; - - values.arc_mode = pGC -> arcMode; - mask |= GCArcMode; - - values.ts_x_origin = pGC -> patOrg.x; - mask |= GCTileStipXOrigin; - - values.ts_y_origin = pGC -> patOrg.y; - mask |= GCTileStipYOrigin; - - values.subwindow_mode = pGC -> subWindowMode; - mask |= GCSubwindowMode; - - values.graphics_exposures = pGC -> graphicsExposures; - mask |= GCGraphicsExposures; - - /* - * The GCClipMask is set to none inside - * the GetScratchGC() function. - */ - - values.clip_x_origin = pGC -> clipOrg.x; - mask |= GCClipXOrigin; - - values.clip_y_origin = pGC -> clipOrg.y; - mask |= GCClipYOrigin; - - XChangeGC(nxagentDisplay, nxagentGC(pGC), mask, &values); + unsigned long valuemask = 0; + XGCValues values = {0}; + SETGCVAL(GCFunction, function, pGC -> alu); + SETGCVAL(GCPlaneMask, plane_mask, pGC -> planemask); + SETGCVAL(GCForeground, foreground, nxagentPixel(pGC -> fgPixel)); + SETGCVAL(GCBackground, background, nxagentPixel(pGC -> bgPixel)); + SETGCVAL(GCLineWidth, line_width, pGC -> lineWidth); + SETGCVAL(GCLineStyle, line_style, pGC -> lineStyle); + SETGCVAL(GCCapStyle, cap_style, pGC -> capStyle); + SETGCVAL(GCJoinStyle, join_style, pGC -> joinStyle); + SETGCVAL(GCFillStyle, fill_style, pGC -> fillStyle); + SETGCVAL(GCFillRule, fill_rule, pGC -> fillRule); + SETGCVAL(GCArcMode, arc_mode, pGC -> arcMode); + SETGCVAL(GCTileStipXOrigin, ts_x_origin, pGC -> patOrg.x); + SETGCVAL(GCTileStipYOrigin, ts_y_origin, pGC -> patOrg.y); + SETGCVAL(GCSubwindowMode, subwindow_mode, pGC -> subWindowMode); + SETGCVAL(GCGraphicsExposures, graphics_exposures, pGC -> graphicsExposures); + SETGCVAL(GCClipXOrigin, clip_x_origin, pGC -> clipOrg.x); + SETGCVAL(GCClipYOrigin, clip_y_origin, pGC -> clipOrg.y); + + /* The GCClipMask is set to none inside the GetScratchGC() function. */ + + /* FIXME: What about GCDashOffset? */ + + XChangeGC(nxagentDisplay, nxagentGC(pGC), valuemask, &values); memset(&(nxagentGCPriv(pGC) -> lastServerValues), 0, sizeof(XGCValues)); -- cgit v1.2.3