Commit 14d8e0a2 authored by Mike Gabriel's avatar Mike Gabriel

Dialog.c: Add NXTransDialog() call for autograb toggling.

parent 03aa5d74
...@@ -63,6 +63,8 @@ int nxagentEnableRandRModeDialogPid = 0; ...@@ -63,6 +63,8 @@ int nxagentEnableRandRModeDialogPid = 0;
int nxagentDisableRandRModeDialogPid = 0; int nxagentDisableRandRModeDialogPid = 0;
int nxagentEnableDeferModePid = 0; int nxagentEnableDeferModePid = 0;
int nxagentDisableDeferModePid = 0; int nxagentDisableDeferModePid = 0;
int nxagentEnableAutograbModePid = 0;
int nxagentDisableAutograbModePid = 0;
static int nxagentFailedReconnectionDialogPid = 0; static int nxagentFailedReconnectionDialogPid = 0;
...@@ -158,6 +160,24 @@ void nxagentResetDialog(int pid) ...@@ -158,6 +160,24 @@ void nxagentResetDialog(int pid)
nxagentDisableDeferModePid = 0; nxagentDisableDeferModePid = 0;
} }
else if (pid == nxagentEnableAutograbModePid)
{
#ifdef TEST
fprintf(stderr, "nxagentResetDialog: Resetting enable autograb mode dialog pid [%d].\n",
nxagentEnableAutograbModePid);
#endif
nxagentEnableAutograbModePid = 0;
}
else if (pid == nxagentDisableAutograbModePid)
{
#ifdef TEST
fprintf(stderr, "nxagentResetDialog: Resetting disable autograb mode dialog pid [%d].\n",
nxagentDisableAutograbModePid);
#endif
nxagentDisableAutograbModePid = 0;
}
} }
void nxagentLaunchDialog(DialogType dialogType) void nxagentLaunchDialog(DialogType dialogType)
...@@ -263,6 +283,24 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -263,6 +283,24 @@ void nxagentLaunchDialog(DialogType dialogType)
break; break;
} }
case DIALOG_ENABLE_AUTOGRAB_MODE:
{
message = DIALOG_ENABLE_AUTOGRAB_MODE_MESSAGE;
type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE;
local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL;
pid = &nxagentEnableAutograbModePid;
break;
}
case DIALOG_DISABLE_AUTOGRAB_MODE:
{
message = DIALOG_DISABLE_AUTOGRAB_MODE_MESSAGE;
type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE;
local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL;
pid = &nxagentDisableAutograbModePid;
break;
}
default: default:
{ {
#ifdef WARNING #ifdef WARNING
...@@ -496,6 +534,18 @@ void nxagentTerminateDialog(DialogType type) ...@@ -496,6 +534,18 @@ void nxagentTerminateDialog(DialogType type)
break; break;
} }
case DIALOG_ENABLE_AUTOGRAB_MODE:
{
pid = nxagentEnableAutograbModePid;
break;
}
case DIALOG_DISABLE_AUTOGRAB_MODE:
{
pid = nxagentDisableAutograbModePid;
break;
}
default: default:
{ {
#ifdef WARNING #ifdef WARNING
......
...@@ -41,6 +41,8 @@ typedef enum ...@@ -41,6 +41,8 @@ typedef enum
DIALOG_FAILED_RECONNECTION, DIALOG_FAILED_RECONNECTION,
DIALOG_ENABLE_DEFER_MODE, DIALOG_ENABLE_DEFER_MODE,
DIALOG_DISABLE_DEFER_MODE, DIALOG_DISABLE_DEFER_MODE,
DIALOG_ENABLE_AUTOGRAB_MODE,
DIALOG_DISABLE_AUTOGRAB_MODE,
DIALOG_LAST_TAG DIALOG_LAST_TAG
} DialogType; } DialogType;
...@@ -54,6 +56,8 @@ extern int nxagentEnableRandRModeDialogPid; ...@@ -54,6 +56,8 @@ extern int nxagentEnableRandRModeDialogPid;
extern int nxagentDisableRandRModeDialogPid; extern int nxagentDisableRandRModeDialogPid;
extern int nxagentEnableDeferModePid; extern int nxagentEnableDeferModePid;
extern int nxagentDisableDeferModePid; extern int nxagentDisableDeferModePid;
extern int nxagentEnableAutograbModePid;
extern int nxagentDisableAutograbModePid;
#define NXAGENTFAILEDRECONNECTIONMESSAGELENGTH 256 #define NXAGENTFAILEDRECONNECTIONMESSAGELENGTH 256
extern char nxagentFailedReconnectionMessage[NXAGENTFAILEDRECONNECTIONMESSAGELENGTH]; extern char nxagentFailedReconnectionMessage[NXAGENTFAILEDRECONNECTIONMESSAGELENGTH];
...@@ -87,6 +91,8 @@ extern void nxagentTerminateDialogs(void); ...@@ -87,6 +91,8 @@ extern void nxagentTerminateDialogs(void);
(type) == DIALOG_FAILED_RECONNECTION ? "DIALOG_FAILED_RECONNECTION" : \ (type) == DIALOG_FAILED_RECONNECTION ? "DIALOG_FAILED_RECONNECTION" : \
(type) == DIALOG_ENABLE_DEFER_MODE ? "DIALOG_ENABLE_DEFER_MODE" : \ (type) == DIALOG_ENABLE_DEFER_MODE ? "DIALOG_ENABLE_DEFER_MODE" : \
(type) == DIALOG_DISABLE_DEFER_MODE ? "DIALOG_DISABLE_DEFER_MODE" : \ (type) == DIALOG_DISABLE_DEFER_MODE ? "DIALOG_DISABLE_DEFER_MODE" : \
(type) == DIALOG_ENABLE_AUTOGRAB_MODE ? "DIALOG_ENABLE_AUTGRAB_MODE" : \
(type) == DIALOG_DISABLE_AUTOGRAB_MODE ? "DIALOG_DISABLE_AUTOGRAB_MODE" : \
"UNKNOWN_DIALOG") "UNKNOWN_DIALOG")
/* /*
...@@ -214,5 +220,29 @@ Ctrl+Alt+E to enable it again.\ ...@@ -214,5 +220,29 @@ Ctrl+Alt+E to enable it again.\
#define DIALOG_DISABLE_DEFER_MODE_LOCAL 0 #define DIALOG_DISABLE_DEFER_MODE_LOCAL 0
#define DIALOG_ENABLE_AUTOGRAB_MODE_MESSAGE \
\
"\
Keyboard auto-grabbing mode is now enabled. You can press\n\
Ctrl+Alt+G again to disable auto-grabbing.\
"
#define DIALOG_ENABLE_AUTOGRAB_MODE_TYPE "ok"
#define DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL 0
#define DIALOG_DISABLE_AUTOGRAB_MODE_MESSAGE \
\
"\
Keyboard auto-grabbing mode is now disabled. You can press\n\
Ctrl+Alt+G again to re-enable auto-grabbing.\
"
#define DIALOG_DISABLE_AUTOGRAB_MODE_TYPE "ok"
#define DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL 0
#endif /* __Dialog_H__ */ #endif /* __Dialog_H__ */
...@@ -712,6 +712,7 @@ static void nxagentEnableAutoGrab(void) ...@@ -712,6 +712,7 @@ static void nxagentEnableAutoGrab(void)
nxagentGrabPointerAndKeyboard(NULL); nxagentGrabPointerAndKeyboard(NULL);
nxagentChangeOption(AutoGrab, True); nxagentChangeOption(AutoGrab, True);
nxagentLaunchDialog(DIALOG_ENABLE_AUTOGRAB_MODE);
} }
static void nxagentDisableAutoGrab(void) static void nxagentDisableAutoGrab(void)
...@@ -722,6 +723,7 @@ static void nxagentDisableAutoGrab(void) ...@@ -722,6 +723,7 @@ static void nxagentDisableAutoGrab(void)
nxagentUngrabPointerAndKeyboard(NULL); nxagentUngrabPointerAndKeyboard(NULL);
nxagentChangeOption(AutoGrab, False); nxagentChangeOption(AutoGrab, False);
nxagentLaunchDialog(DIALOG_DISABLE_AUTOGRAB_MODE);
} }
static void nxagentToggleAutoGrab(void) static void nxagentToggleAutoGrab(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment