[X2Go-Commits] [nx-libs] 212/219: Dialog.c: Add NXTransDialog() call for autograb toggling.

git-admin at x2go.org git-admin at x2go.org
Sat Sep 28 12:11:09 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 14d8e0a2a69f2468a49fcb53c4ba7e12cea10b1d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Mon Jul 24 14:48:29 2017 +0200

    Dialog.c: Add NXTransDialog() call for autograb toggling.
---
 nx-X11/programs/Xserver/hw/nxagent/Dialog.c | 50 +++++++++++++++++++++++++++++
 nx-X11/programs/Xserver/hw/nxagent/Dialog.h | 30 +++++++++++++++++
 nx-X11/programs/Xserver/hw/nxagent/Events.c |  2 ++
 3 files changed, 82 insertions(+)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
index 753b9d708..0dcdda5a4 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
@@ -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
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h
index ffcdf48f2..42bba290d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h
@@ -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__ */
 
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index d62bb6866..020278841 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -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)

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list