[X2Go-Commits] [nx-libs] 01/02: nx-X11/programs/Xserver/hw/nxagent/Screen.c: reformat nxagentAdjustRandRXinerama() consistently.
git-admin at x2go.org
git-admin at x2go.org
Sat Mar 17 01:58:05 CET 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch 3.6.x-rpm-debug
in repository nx-libs.
commit a85711a0bca37a20be0c4f68448264e25576de93
Author: Mihai Moldovan <ionic at ionic.de>
Date: Fri Mar 16 05:27:20 2018 +0100
nx-X11/programs/Xserver/hw/nxagent/Screen.c: reformat nxagentAdjustRandRXinerama() consistently.
---
nx-X11/programs/Xserver/hw/nxagent/Screen.c | 118 +++++++++++++++-------------
1 file changed, 62 insertions(+), 56 deletions(-)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index c8db47a..613876a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -3955,25 +3955,22 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
pScrPriv = rrGetScrPriv(pScreen);
- if (pScrPriv)
- {
+ if (pScrPriv) {
int i;
int number = 0;
XineramaScreenInfo *screeninfo = NULL;
screeninfo = XineramaQueryScreens(nxagentDisplay, &number);
- if (number)
- {
+ if (number) {
#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
}
- else
- {
+ else {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama\n");
#endif
@@ -3996,7 +3993,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
free(screeninfo);
if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) {
- return FALSE;
+ return FALSE;
}
/* fake a xinerama screeninfo that covers the whole screen */
@@ -4048,8 +4045,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
fprintf(stderr, "nxagentAdjustRandRXinerama: numCrtcs [%d], numOutputs [%d]\n", pScrPriv->numCrtcs, pScrPriv->numOutputs);
#endif
- /* adjust the number of CRTCs to match the number of reported
- xinerama screens on the real server */
+ /*
+ * 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) {
#ifdef DEBUG
@@ -4059,8 +4058,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RRCrtcSet(pScrPriv->crtcs[pScrPriv->numCrtcs - 1], NULL, 0, 0, RR_Rotate_0, 0, NULL);
RRCrtcDestroy(pScrPriv->crtcs[pScrPriv->numCrtcs - 1]);
}
- else
- {
+ else {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: adding crtc\n");
#endif
@@ -4072,41 +4070,45 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
fprintf(stderr, "nxagentAdjustRandRXinerama: numCrtcs [%d], numOutputs [%d]\n", pScrPriv->numCrtcs, pScrPriv->numOutputs);
#endif
- /* set gamma. Currently the only reason for doing this is
- preventing the xrandr command from complaining about missing
- gamma. */
+ /*
+ * 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]);
+ CARD16 gamma = 0;
+ RRCrtcGammaSetSize(pScrPriv->crtcs[i], 1);
+ RRCrtcGammaSet(pScrPriv->crtcs[i], &gamma, &gamma, &gamma);
+ RRCrtcGammaNotify(pScrPriv->crtcs[i]);
}
}
/* delete superfluous non-NX outputs */
- for (i = pScrPriv->numOutputs - 1; i >= 0; i--)
- if (strncmp(pScrPriv->outputs[i]->name, "NX", 2))
+ for (i = pScrPriv->numOutputs - 1; i >= 0; i--) {
+ if (strncmp(pScrPriv->outputs[i]->name, "NX", 2)) {
nxagentDropOutput(pScrPriv->outputs[i]);
+ }
+ }
/* at this stage only NX outputs are left - we delete the superfluous ones */
- for (i = pScrPriv->numOutputs - 1; i >= number; i--)
+ for (i = pScrPriv->numOutputs - 1; i >= number; i--) {
nxagentDropOutput(pScrPriv->outputs[i]);
+ }
/* add and init outputs */
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
}
- else
- {
+ else {
output = pScrPriv->outputs[i];
}
#ifdef DEBUG
@@ -4150,7 +4152,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
#ifdef DEBUG
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
@@ -4184,8 +4187,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RRCrtcSet(pScrPriv->crtcs[i], NULL, 0, 0, RR_Rotate_0, 1, &(pScrPriv->outputs[i]));
}
}
- else
- {
+ else {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: intersection is x [%d] y [%d] width [%d] height [%d]\n", i, pScrPriv->outputs[i]->name, new_x, new_y, new_w, new_h);
#endif
@@ -4195,10 +4197,12 @@ 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. */
+ /*
+ * 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);
@@ -4217,24 +4221,24 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
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? */
+ else {
+ /* 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);
+ /*
+ * 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);
}
- else
- {
+ 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
@@ -4247,14 +4251,16 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RRCrtcSet(pScrPriv->crtcs[i], mymode, new_x, new_y, RR_Rotate_0, 1, &(pScrPriv->outputs[i]));
} /* if disable_output */
- /* 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 */
+ /*
+ * 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) {
#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);
@@ -4269,17 +4275,17 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
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);
+ else {
+ 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);
- }
+ 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);
+ }
+ }
#endif
pScrPriv -> lastSetTime = currentTime;
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
More information about the x2go-commits
mailing list