aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Error.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Error.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c45
3 files changed, 48 insertions, 1 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c
index d9016436e..df62cf4f7 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 e55fd71a5..51d6171da 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 6039e5c43..1637f0c4c 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 ||