diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-05-07 16:00:44 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-05-07 16:00:44 +0200 |
commit | e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0 (patch) | |
tree | a8fbc3bfb442ef8222367b9a5b2285c9e6408fda /nx-X11/programs/Xserver/hw/nxagent/Dialog.c | |
parent | 424c0e8ee3986b886bf2d7617897577a6b84aaed (diff) | |
parent | c69d2ad0fc5f69163c4babc7a356a783aa7ae411 (diff) | |
download | nx-libs-e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0.tar.gz nx-libs-e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0.tar.bz2 nx-libs-e91d08cb8d1fd529e33f9ef9924b3a7cdfea2df0.zip |
Merge branch 'uli42-pr/various4' into 3.6.x
Attributes GH PR #896: https://github.com/ArcticaProject/nx-libs/pull/896
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Dialog.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Dialog.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c index 2d4eb6229..808e1501f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c @@ -41,6 +41,7 @@ #include "Display.h" #include "Dialog.h" #include "Utils.h" +#include "Keystroke.h" #include <nx/NX.h> #include "compext/Compext.h" @@ -187,6 +188,7 @@ void nxagentLaunchDialog(DialogType dialogType) int *pid; char *type; char *message; + char *strings[2] = {NULL}; /* don't forget to add free() calls if you change the number */ int local; const char *window = NULL; @@ -247,6 +249,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE; local = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL; pid = &nxagentEnableRandRModeDialogPid; + strings[0] = nxagentFindFirstKeystroke("resize"); break; } case DIALOG_DISABLE_DESKTOP_RESIZE_MODE: @@ -255,6 +258,8 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE; local = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL; pid = &nxagentDisableRandRModeDialogPid; + strings[0] = nxagentFindFirstKeystroke("resize"); + strings[1] = nxagentFindMatchingKeystrokes("viewport_"); break; } case DIALOG_ENABLE_DEFER_MODE: @@ -263,6 +268,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_ENABLE_DEFER_MODE_TYPE; local = DIALOG_ENABLE_DEFER_MODE_LOCAL; pid = &nxagentEnableDeferModePid; + strings[0] = nxagentFindFirstKeystroke("defer"); break; } case DIALOG_DISABLE_DEFER_MODE: @@ -271,6 +277,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_DISABLE_DEFER_MODE_TYPE; local = DIALOG_DISABLE_DEFER_MODE_LOCAL; pid = &nxagentDisableDeferModePid; + strings[0] = nxagentFindFirstKeystroke("defer"); break; } case DIALOG_ENABLE_AUTOGRAB_MODE: @@ -279,6 +286,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE; local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL; pid = &nxagentEnableAutograbModePid; + strings[0] = nxagentFindFirstKeystroke("autograb"); break; } case DIALOG_DISABLE_AUTOGRAB_MODE: @@ -287,6 +295,7 @@ void nxagentLaunchDialog(DialogType dialogType) type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE; local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL; pid = &nxagentDisableAutograbModePid; + strings[0] = nxagentFindFirstKeystroke("autograb"); break; } default: @@ -321,6 +330,17 @@ void nxagentLaunchDialog(DialogType dialogType) return; } + char *msg = NULL; + if (-1 == asprintf(&msg, message, strings[0], strings[1])) + { + #ifdef DEBUG + fprintf(stderr, "%s: could not allocate message string.\n", __func__); + #endif + SAFE_free(strings[0]); + SAFE_free(strings[1]); + return; + } + /* * We don't want to receive SIGCHLD before we store the child pid. */ @@ -331,9 +351,13 @@ void nxagentLaunchDialog(DialogType dialogType) sigprocmask(SIG_BLOCK, &set, &oldSet); - *pid = NXTransDialog(nxagentDialogName, message, window, + *pid = NXTransDialog(nxagentDialogName, msg, window, type, local, dialogDisplay); + SAFE_free(strings[0]); + SAFE_free(strings[1]); + SAFE_free(msg); + #ifdef TEST fprintf(stderr, "nxagentLaunchDialog: Launched dialog %s with pid [%d] on display %s.\n", DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay); |