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;
int nxagentDisableRandRModeDialogPid = 0;
int nxagentEnableDeferModePid = 0;
int nxagentDisableDeferModePid = 0;
int nxagentEnableAutograbModePid = 0;
int nxagentDisableAutograbModePid = 0;
static int nxagentFailedReconnectionDialogPid = 0;
......@@ -158,6 +160,24 @@ void nxagentResetDialog(int pid)
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)
......@@ -263,6 +283,24 @@ void nxagentLaunchDialog(DialogType dialogType)
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:
{
#ifdef WARNING
......@@ -496,6 +534,18 @@ void nxagentTerminateDialog(DialogType type)
break;
}
case DIALOG_ENABLE_AUTOGRAB_MODE:
{
pid = nxagentEnableAutograbModePid;
break;
}
case DIALOG_DISABLE_AUTOGRAB_MODE:
{
pid = nxagentDisableAutograbModePid;
break;
}
default:
{
#ifdef WARNING
......
......@@ -41,6 +41,8 @@ typedef enum
DIALOG_FAILED_RECONNECTION,
DIALOG_ENABLE_DEFER_MODE,
DIALOG_DISABLE_DEFER_MODE,
DIALOG_ENABLE_AUTOGRAB_MODE,
DIALOG_DISABLE_AUTOGRAB_MODE,
DIALOG_LAST_TAG
} DialogType;
......@@ -54,6 +56,8 @@ extern int nxagentEnableRandRModeDialogPid;
extern int nxagentDisableRandRModeDialogPid;
extern int nxagentEnableDeferModePid;
extern int nxagentDisableDeferModePid;
extern int nxagentEnableAutograbModePid;
extern int nxagentDisableAutograbModePid;
#define NXAGENTFAILEDRECONNECTIONMESSAGELENGTH 256
extern char nxagentFailedReconnectionMessage[NXAGENTFAILEDRECONNECTIONMESSAGELENGTH];
......@@ -87,6 +91,8 @@ extern void nxagentTerminateDialogs(void);
(type) == DIALOG_FAILED_RECONNECTION ? "DIALOG_FAILED_RECONNECTION" : \
(type) == DIALOG_ENABLE_DEFER_MODE ? "DIALOG_ENABLE_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")
/*
......@@ -214,5 +220,29 @@ Ctrl+Alt+E to enable it again.\
#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__ */
......@@ -712,6 +712,7 @@ static void nxagentEnableAutoGrab(void)
nxagentGrabPointerAndKeyboard(NULL);
nxagentChangeOption(AutoGrab, True);
nxagentLaunchDialog(DIALOG_ENABLE_AUTOGRAB_MODE);
}
static void nxagentDisableAutoGrab(void)
......@@ -722,6 +723,7 @@ static void nxagentDisableAutoGrab(void)
nxagentUngrabPointerAndKeyboard(NULL);
nxagentChangeOption(AutoGrab, False);
nxagentLaunchDialog(DIALOG_DISABLE_AUTOGRAB_MODE);
}
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