Skip to content

Commit 59a0620

Browse files
committed
Merge branch 'uli42-pr/various7' into 3.6.x
Attributes GH PR #1007: #1007
2 parents 6208dad + fcc1b57 commit 59a0620

31 files changed

+542
-399
lines changed

nx-X11/programs/Xserver/composite/compext.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static DevPrivateKeyRec CompositeClientPrivateKeyRec;
3939

4040
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
4141
#else /* !defined(NXAGENT_SERVER) */
42+
#include "../hw/nxagent/Options.h"
4243
static int CompositeClientPrivIndex = -1;
4344
#endif /* !defined(NXAGENT_SERVER) */
4445

@@ -623,6 +624,11 @@ CompositeExtensionInit (void)
623624
/* Assume initialization is going to fail */
624625
noCompositeExtension = TRUE;
625626

627+
#ifdef NXAGENT_SERVER
628+
if (!nxagentOption(Composite))
629+
return;
630+
#endif
631+
626632
fprintf(stderr, "COMPOSITE: trying to initialize extension.\n");
627633

628634
for (s = 0; s < screenInfo.numScreens; s++) {

nx-X11/programs/Xserver/hw/nxagent/Args.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,12 @@ int ddxProcessArgument(int argc, char *argv[], int i)
197197
nxagentProgName = strdup(basename(basec));
198198
SAFE_free(basec);
199199

200+
#ifdef X2GO
200201
/*
201202
* Check if we are running as X2Go Agent
202203
*/
203204
checkX2goAgent();
205+
#endif
204206
}
205207

206208
#ifdef TEST
@@ -691,6 +693,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
691693
{
692694
SAFE_free(nxagentKeyboard);
693695

696+
#ifdef X2GO
694697
if (nxagentX2go && strcmp(argv[i], "null/null") == 0)
695698
{
696699
#ifdef TEST
@@ -701,6 +704,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
701704
nxagentKeyboard = strdup("clone");
702705
}
703706
else
707+
#endif
704708
{
705709
nxagentKeyboard = strdup(argv[i]);
706710
}
@@ -733,6 +737,14 @@ int ddxProcessArgument(int argc, char *argv[], int i)
733737
return 1;
734738
}
735739

740+
/* the composite extension is disabled by default so we provide a
741+
way to enable it */
742+
if (!strcmp(argv[i], "-composite"))
743+
{
744+
nxagentChangeOption(Composite, True);
745+
return 1;
746+
}
747+
736748
if (!strcmp(argv[i], "-nodamage"))
737749
{
738750
nxagentChangeOption(UseDamage, False);
@@ -1775,11 +1787,13 @@ N/A
17751787

17761788
if (*nxagentWindowName == '\0')
17771789
{
1778-
if(nxagentX2go)
1790+
#ifdef X2GO
1791+
if (nxagentX2go)
17791792
{
17801793
snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "X2Go Agent");
17811794
}
17821795
else
1796+
#endif
17831797
{
17841798
snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "NX Agent");
17851799
}
@@ -1870,11 +1884,11 @@ N/A
18701884
fprintf(stderr, "nxagentPostProcessArgs: WARNING! Using backward compatible alpha encoding.\n");
18711885
#endif
18721886

1873-
nxagentAlphaCompat = 1;
1887+
nxagentAlphaCompat = True;
18741888
}
18751889
else
18761890
{
1877-
nxagentAlphaCompat = 0;
1891+
nxagentAlphaCompat = False;
18781892
}
18791893

18801894
nxagentRemoteMajor = remoteMajor;
@@ -1984,16 +1998,16 @@ FIXME: In rootless mode the backing-store support is not functional yet.
19841998
*/
19851999
if (nxagentOption(Rootless))
19862000
{
1987-
enableBackingStore = 0;
2001+
enableBackingStore = FALSE;
19882002
}
19892003
else if (nxagentOption(BackingStore) == BackingStoreUndefined ||
19902004
nxagentOption(BackingStore) == BackingStoreForce)
19912005
{
1992-
enableBackingStore = 1;
2006+
enableBackingStore = TRUE;
19932007
}
19942008
else if (nxagentOption(BackingStore) == BackingStoreNever)
19952009
{
1996-
enableBackingStore = 0;
2010+
enableBackingStore = FALSE;
19972011
}
19982012

19992013
/*
@@ -2098,9 +2112,13 @@ void ddxUseMsg(void)
20982112
ErrorF("-autodpi detect real server's DPI and use that in the session\n");
20992113
ErrorF("-display string display name of the real server\n");
21002114
ErrorF("-sync synchronize with the real server\n");
2115+
ErrorF("-nxrealwindowprop set property NX_REAL_WINDOW for each X11 window inside nxagent\n");
2116+
ErrorF("-reportwids report externally exposed X11 window IDs to the session log\n");
2117+
ErrorF("-reportprivatewids report internal X11 window ID to the session log\n");
21012118
#ifdef RENDER
21022119
ErrorF("-norender disable the use of the render extension\n");
2103-
ErrorF("-nocomposite disable the use of the composite extension\n");
2120+
ErrorF("-nocomposite disable the use of the composite extension (default)\n");
2121+
ErrorF("-composite enable the use of the composite extension\n");
21042122
#endif
21052123
ErrorF("-nopersistent disable disconnection/reconnection to the X display on SIGHUP\n");
21062124
ErrorF("-noshmem disable use of shared memory extension\n");
@@ -2114,6 +2132,7 @@ void ddxUseMsg(void)
21142132
ErrorF("-irlimit maximum image data rate to the encoder input in kB/s.\n");
21152133
ErrorF("-tile WxH maximum size of image tiles (minimum allowed: 32x32)\n");
21162134
ErrorF("-keystrokefile file file with keyboard shortcut definitions\n");
2135+
ErrorF("-options file|string path to an options file or an option string (for testing/debugging)\n");
21172136
ErrorF("-verbose print more warning and error messages\n");
21182137
ErrorF("-D enable desktop mode\n");
21192138
ErrorF("-R enable rootless mode\n");

nx-X11/programs/Xserver/hw/nxagent/Atoms.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,12 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
8989
"WM_NX_READY", /* 3 */
9090
/* nxagent takes the ownership of the selection with this name
9191
to signal the nxclient (or any other watching program)
92-
it is ready. */
92+
it is ready. This is only used if NXAGENT_ONSTART is defined.
93+
We cannot enclose it in #ifdef here because we use the numeric
94+
indices to this structure at multiple places. */
9395
"MCOPGLOBALS", /* 4 */
94-
/* used for artsd support. */
96+
/* used for artsd support. Only used if compiled with
97+
NXAGENT_ARTSD */
9598
"NX_CUT_BUFFER_SERVER", /* 5 */
9699
/* this is the name of a property on nxagent's window on the
97100
real X server. This property is used for passing clipboard

nx-X11/programs/Xserver/hw/nxagent/Clipboard.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,6 +2237,7 @@ Bool nxagentInitClipboard(WindowPtr pWin)
22372237
nxagentXFixesInfo.Initialized = True;
22382238
}
22392239

2240+
#ifdef NXAGENT_ONSTART
22402241
/*
22412242
The first paste from CLIPBOARD did not work directly after
22422243
session start. Removing this code makes it work. It is unsure why
@@ -2247,6 +2248,7 @@ Bool nxagentInitClipboard(WindowPtr pWin)
22472248
22482249
if (nxagentSessionId[0])
22492250
{
2251+
// nxagentAtoms[10] is the CLIPBOARD atom
22502252
#ifdef TEST
22512253
fprintf(stderr, "%s: setting the ownership of %s to %lx"
22522254
" and registering for PropertyChangeMask events\n", __func__,
@@ -2258,6 +2260,7 @@ Bool nxagentInitClipboard(WindowPtr pWin)
22582260
nxagentChangeWindowAttributes(pWin, CWEventMask);
22592261
}
22602262
*/
2263+
#endif
22612264

22622265
if (nxagentReconnectTrap)
22632266
{

nx-X11/programs/Xserver/hw/nxagent/Composite.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
* Set if the composite extension is supported by the remote display.
4848
*/
4949

50-
int nxagentCompositeEnable = UNDEFINED;
50+
Bool nxagentCompositeEnable = False;
5151

5252
void nxagentCompositeExtensionInit(void)
5353
{
5454
/*
5555
* Set the flag only if the initialization completes.
5656
*/
5757

58-
nxagentCompositeEnable = 0;
58+
nxagentCompositeEnable = False;
5959

6060
if (nxagentOption(Composite))
6161
{
@@ -96,7 +96,7 @@ void nxagentCompositeExtensionInit(void)
9696
fprintf(stderr, "nxagentCompositeExtensionInit: Enabling the use of the composite extension.\n");
9797
#endif
9898

99-
nxagentCompositeEnable = 1;
99+
nxagentCompositeEnable = True;
100100
}
101101
#ifdef TEST
102102
else
@@ -115,8 +115,7 @@ void nxagentCompositeExtensionInit(void)
115115

116116
void nxagentRedirectDefaultWindows(void)
117117
{
118-
if (nxagentOption(Rootless) ||
119-
nxagentCompositeEnable == 0)
118+
if (nxagentOption(Rootless) || !nxagentCompositeEnable)
120119
{
121120
#ifdef TEST
122121
fprintf(stderr, "nxagentRedirectDefaultWindows: Not redirecting default "
@@ -140,10 +139,10 @@ void nxagentRedirectDefaultWindows(void)
140139

141140
/*
142141
* When trying to redirect only the top level window, and not the
143-
* subwindows, we incur in a strange be- haviour. The top level is
144-
* unmapped, mapped, unmap- ped and then reparented. This at first
142+
* subwindows, we incur in a strange behaviour. The top level is
143+
* unmapped, mapped, unmapped and then reparented. This at first
145144
* makes the agent think that the window manager is gone, then the
146-
* agent window disappears. To make thinks even more weird, this
145+
* agent window disappears. To make things even more weird, this
147146
* happens only at reconnection.
148147
*/
149148

@@ -154,8 +153,7 @@ void nxagentRedirectDefaultWindows(void)
154153

155154
void nxagentRedirectWindow(WindowPtr pWin)
156155
{
157-
if (!nxagentOption(Rootless) ||
158-
nxagentCompositeEnable == 0)
156+
if (!nxagentOption(Rootless) || !nxagentCompositeEnable)
159157
{
160158
#ifdef TEST
161159
fprintf(stderr, "nxagentRedirectWindow: Not redirecting window id [%ld] "

nx-X11/programs/Xserver/hw/nxagent/Composite.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* its use is enabled.
3232
*/
3333

34-
extern int nxagentCompositeEnable;
34+
extern Bool nxagentCompositeEnable;
3535

3636
/*
3737
* Query the composite extension on the

nx-X11/programs/Xserver/hw/nxagent/Display.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ is" without express or implied warranty.
9292
#include "compext/Compext.h"
9393

9494
#include NXAGENT_ICON_NAME
95+
#ifdef X2GO
9596
#include X2GOAGENT_ICON_NAME
97+
#endif
9698

9799
/*
98100
* Set here the required log level.
@@ -1849,6 +1851,7 @@ Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask)
18491851
{
18501852
char** agentIconData;
18511853

1854+
#ifdef X2GO
18521855
/*
18531856
* selecting x2go icon when running as X2Go agent
18541857
*/
@@ -1857,6 +1860,7 @@ Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask)
18571860
agentIconData = x2goagentIconData;
18581861
}
18591862
else
1863+
#endif
18601864
{
18611865
agentIconData = nxagentIconData;
18621866
}

0 commit comments

Comments
 (0)