[X2Go-Commits] [nx-libs] 05/24: Export remote keyboard configuration to session directory (105_nxagent_export-remote-keyboard-config.full.patch)

git-admin at x2go.org git-admin at x2go.org
Tue Feb 10 21:50:50 CET 2015


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 c91fe980b952d4d357a291fcda89f35ea1a83993
Author: Marcelo Boveto Shima <marceloshima at gmail.com>
Date:   Tue Feb 10 18:56:59 2015 +0100

    Export remote keyboard configuration to session directory (105_nxagent_export-remote-keyboard-config.full.patch)
    
      Let nxagent write the keyboard configuration to <session_directory>/keyboard
      and make it available within the NX session.
---
 ...xagent_export-remote-keyboard-config.full.patch |   96 --------------------
 debian/patches/series                              |    1 -
 nx-X11/programs/Xserver/hw/nxagent/Error.c         |    2 +-
 nx-X11/programs/Xserver/hw/nxagent/Error.h         |    2 +
 nx-X11/programs/Xserver/hw/nxagent/Keyboard.c      |   45 +++++++++
 5 files changed, 48 insertions(+), 98 deletions(-)

diff --git a/debian/patches/105_nxagent_export-remote-keyboard-config.full.patch b/debian/patches/105_nxagent_export-remote-keyboard-config.full.patch
deleted file mode 100644
index 389feaf..0000000
--- a/debian/patches/105_nxagent_export-remote-keyboard-config.full.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-Description: Export remote keyboard configuration to session directory
- Let nxagent write the keyboard configuration to <session_directory>/keyboard
- and make it available within the NX session.
- .
- Originally contributed by Marcelo Boveto Shima <marceloshima at gmail.com>.
-Forwarded: pending...
-Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-Last-Update: 2011-12-31
---- a/nx-X11/programs/Xserver/hw/nxagent/Error.c
-+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c
-@@ -497,7 +497,7 @@
-   return rootPath;
- }
- 
--char *nxagentGetSessionPath()
-+char *nxagentGetSessionPath(void)
- {
- 
-   char *rootPath;
---- a/nx-X11/programs/Xserver/hw/nxagent/Error.h
-+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.h
-@@ -34,4 +34,6 @@
- 
- void nxagentEndRedirectToClientsLog(void);
- 
-+char *nxagentGetSessionPath(void);
-+
- #endif /* __Error_H__ */
---- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
-+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
-@@ -52,6 +52,7 @@
- #include "Keyboard.h"
- #include "Events.h"
- #include "Options.h"
-+#include "Error.h"
- 
- #include "NXlib.h"
- 
-@@ -72,6 +73,8 @@
- 
- #include "Xatom.h"
- 
-+#include <errno.h>
-+
- static int nxagentXkbGetNames(char **rules, char **model, char **layout,
-                                   char **variant, char **options);
- 
-@@ -1790,6 +1793,48 @@
-   }
-   #endif
- 
-+  if (drulesLen != 0)
-+  {
-+    char *sessionpath = nxagentGetSessionPath();
-+    if (sessionpath != NULL){
-+      int keyboard_file_path_size = strlen(sessionpath) + strlen("/keyboard");
-+      char *keyboard_file_path = malloc((keyboard_file_path_size + 1) * sizeof(char));
-+      FILE *keyboard_file;
-+      if ( keyboard_file_path == NULL)
-+      {
-+        FatalError("nxagentKeyboardProc: malloc failed.");
-+      }
-+      strcpy(keyboard_file_path, sessionpath);
-+      strcat(keyboard_file_path, "/keyboard");
-+      if ((keyboard_file = fopen(keyboard_file_path, "w")) != NULL) {
-+        if ( drules != NULL )
-+          fprintf(keyboard_file, "rules=%s\n", drules);
-+        if ( dmodel != NULL )
-+          fprintf(keyboard_file, "model=%s\n", dmodel);
-+        if ( dlayout != NULL )
-+          fprintf(keyboard_file, "layout=%s\n", dlayout);
-+        if ( dvariant != NULL )
-+          fprintf(keyboard_file, "variant=%s\n", dvariant);
-+        if ( doptions != NULL )
-+          fprintf(keyboard_file, "options=%s\n", doptions);
-+        fclose(keyboard_file);
-+        fprintf(stderr, "keyboard file created\n");
-+      }
-+      else {
-+        int save_err = errno;
-+        fprintf(stderr, "keyboard file not created: %s\n", strerror(save_err));
-+      }
-+      free(keyboard_file_path);
-+    }
-+    else {
-+      fprintf(stderr, "SessionPath not defined\n");
-+    }
-+  }
-+  else
-+  {
-+    fprintf(stderr, "Failed to create the keyboard file\n");
-+  }
-+
-   if (nxagentOption(ClientOs) == ClientOsLinux &&
-             drules != NULL && dmodel != NULL &&
-                 (strcmp(drules, "evdev") == 0 ||
diff --git a/debian/patches/series b/debian/patches/series
index cfe913d..d342015 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
-105_nxagent_export-remote-keyboard-config.full.patch
 106_nxagent_utf8-copy-clipboard.full.patch
 107_nxagent_clipboard-compound-text+small-bed-sheets.full.patch
 108_nxagent_wine-close-delay.full.patch
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c
index d901643..df62cf4 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Error.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c
@@ -497,7 +497,7 @@ char *nxagentGetRootPath(void)
   return rootPath;
 }
 
-char *nxagentGetSessionPath()
+char *nxagentGetSessionPath(void)
 {
 
   char *rootPath;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.h b/nx-X11/programs/Xserver/hw/nxagent/Error.h
index e55fd71..51d6171 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Error.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.h
@@ -34,4 +34,6 @@ void nxagentStartRedirectToClientsLog(void);
 
 void nxagentEndRedirectToClientsLog(void);
 
+char *nxagentGetSessionPath(void);
+
 #endif /* __Error_H__ */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 6039e5c..1637f0c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -52,6 +52,7 @@ is" without express or implied warranty.
 #include "Keyboard.h"
 #include "Events.h"
 #include "Options.h"
+#include "Error.h"
 
 #include "NXlib.h"
 
@@ -72,6 +73,8 @@ is" without express or implied warranty.
 
 #include "Xatom.h"
 
+#include <errno.h>
+
 static int nxagentXkbGetNames(char **rules, char **model, char **layout,
                                   char **variant, char **options);
 
@@ -1790,6 +1793,48 @@ void nxagentKeycodeConversionSetup(void)
   }
   #endif
 
+  if (drulesLen != 0)
+  {
+    char *sessionpath = nxagentGetSessionPath();
+    if (sessionpath != NULL){
+      int keyboard_file_path_size = strlen(sessionpath) + strlen("/keyboard");
+      char *keyboard_file_path = malloc((keyboard_file_path_size + 1) * sizeof(char));
+      FILE *keyboard_file;
+      if ( keyboard_file_path == NULL)
+      {
+        FatalError("nxagentKeyboardProc: malloc failed.");
+      }
+      strcpy(keyboard_file_path, sessionpath);
+      strcat(keyboard_file_path, "/keyboard");
+      if ((keyboard_file = fopen(keyboard_file_path, "w")) != NULL) {
+        if ( drules != NULL )
+          fprintf(keyboard_file, "rules=%s\n", drules);
+        if ( dmodel != NULL )
+          fprintf(keyboard_file, "model=%s\n", dmodel);
+        if ( dlayout != NULL )
+          fprintf(keyboard_file, "layout=%s\n", dlayout);
+        if ( dvariant != NULL )
+          fprintf(keyboard_file, "variant=%s\n", dvariant);
+        if ( doptions != NULL )
+          fprintf(keyboard_file, "options=%s\n", doptions);
+        fclose(keyboard_file);
+        fprintf(stderr, "keyboard file created\n");
+      }
+      else {
+        int save_err = errno;
+        fprintf(stderr, "keyboard file not created: %s\n", strerror(save_err));
+      }
+      free(keyboard_file_path);
+    }
+    else {
+      fprintf(stderr, "SessionPath not defined\n");
+    }
+  }
+  else
+  {
+    fprintf(stderr, "Failed to create the keyboard file\n");
+  }
+
   if (nxagentOption(ClientOs) == ClientOsLinux &&
             drules != NULL && dmodel != NULL &&
                 (strcmp(drules, "evdev") == 0 ||

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list