From eb8c54a207597d5b88ec18daccfd67526e9a75f9 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 29 Jun 2024 20:25:04 +0200 Subject: [PATCH] nxcomp/src/Loop.cpp: Support NXTransDialog caption / title being prefixed with a custom prefix string. --- nxcomp/src/Loop.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp index 4bbf42b915..b18568e564 100644 --- a/nxcomp/src/Loop.cpp +++ b/nxcomp/src/Loop.cpp @@ -14731,7 +14731,19 @@ static void handleAlertInLoop() { char caption[DEFAULT_STRING_LENGTH]; - strcpy(caption, ALERT_CAPTION_PREFIX); + const char* caption_prefix = getenv("NX_DIALOG_CAPTIONPREFIX"); + + if (!caption_prefix) { + // Use the hard-coded 'NX -' as default. + strncpy(caption, ALERT_CAPTION_PREFIX, DEFAULT_STRING_LENGTH); + caption[DEFAULT_STRING_LENGTH-1] = '\0'; + } + else + { + // Use what gets provided via NX_DIALOG_CAPTIONPREFIX (used in X2Go) + strncpy(caption, caption_prefix, DEFAULT_STRING_LENGTH-1); + caption[DEFAULT_STRING_LENGTH-1] = '\0'; + } int length = strlen(sessionId);