Skip to content

Commit af91cad

Browse files
committed
nxcomp/src/Loop.cpp: Support NXTransDialog caption / title being prefixed with a custom prefix string.
1 parent 8f3b446 commit af91cad

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

nxcomp/src/Loop.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -14731,7 +14731,19 @@ static void handleAlertInLoop()
1473114731
{
1473214732
char caption[DEFAULT_STRING_LENGTH];
1473314733

14734-
strcpy(caption, ALERT_CAPTION_PREFIX);
14734+
const char* caption_prefix = getenv("NX_DIALOG_CAPTIONPREFIX");
14735+
14736+
if (!caption_prefix) {
14737+
// Use the hard-coded 'NX -' as default.
14738+
strncpy(caption, ALERT_CAPTION_PREFIX, DEFAULT_STRING_LENGTH);
14739+
caption[DEFAULT_STRING_LENGTH-1] = '\0';
14740+
}
14741+
else
14742+
{
14743+
// Use what gets provided via NX_DIALOG_CAPTIONPREFIX (used in X2Go)
14744+
strncpy(caption, caption_prefix, DEFAULT_STRING_LENGTH-1);
14745+
caption[DEFAULT_STRING_LENGTH-1] = '\0';
14746+
}
1473514747

1473614748
int length = strlen(sessionId);
1473714749

nxproxy/man/nxproxy.1

+8
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,14 @@ where <nxclient> is located in a different directory compared to the
376376
other programs, to make easier for the user to execute the program from
377377
the shell.
378378

379+
.TP 8
380+
.B NX_DIALOG_CAPTIONPREFIX
381+
This variable can be used to override the default caption prefix for
382+
agent calls to nxdialog. By default (if NX_DIALOG_CAPTIONPREFIX is
383+
unset), the caption prefix gets set to 'NX - '. This variable is only
384+
used if the proxy is running in server mode or if nxcomp code is run
385+
as part of nxagent.
386+
379387
.TP 8
380388
.B NX_SLAVE_CMD
381389
The full path to the slave channel handler. When the slave channel is

0 commit comments

Comments
 (0)