summaryrefslogtreecommitdiff
path: root/hw/xquartz
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-11-03 16:35:27 -0800
committerJeremy Huddleston <jeremyhu@freedesktop.org>2009-11-03 16:35:27 -0800
commit5e79976c13c5b94b12392b493846ca26be11750b (patch)
tree90c2699e6bc98eaa4b57ca1ac929bc9c26296993 /hw/xquartz
parent412c56ef3332d09efbd861e41c3e985f44729729 (diff)
XQuartz: Run xmodmap after programatically updating the keymap.
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org> Signed-off-by: Martin Otte <otte@duke.edu>
Diffstat (limited to 'hw/xquartz')
-rw-r--r--hw/xquartz/X11Application.m6
-rw-r--r--hw/xquartz/X11Controller.h1
-rw-r--r--hw/xquartz/quartzKeyboard.c23
3 files changed, 30 insertions, 0 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index f4fbb1abe..2c9548534 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -961,6 +961,12 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
/* not reached */
}
+void launch_client(const char *cmd) {
+ NSString *string = [[NSString alloc] initWithUTF8String:cmd];
+ [[X11App controller] launch_client:string];
+ [string release];
+}
+
@implementation X11Application (Private)
#ifdef NX_DEVICELCMDKEYMASK
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index a86b20f17..3d8e007e7 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -144,5 +144,6 @@ typedef unsigned int NSUInteger;
#endif /* __OBJC__ */
void X11ControllerMain(int argc, char **argv, char **envp);
+void launch_client(const char *cmd);
#endif /* X11CONTROLLER_H */
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 06b981e02..5bbb9c9cf 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -52,6 +52,8 @@
#include "quartzKeyboard.h"
#include "quartzAudio.h"
+#include "X11Application.h"
+
#include "threadSafety.h"
#ifdef NDEBUG
@@ -359,6 +361,10 @@ void DarwinKeyboardReloadHandler(void) {
CFIndex initialKeyRepeatValue, keyRepeatValue;
BOOL ok;
DeviceIntPtr pDev = darwinKeyboard;
+ const char *xmodmap = PROJECTROOT "/bin/xmodmap";
+ const char *sysmodmap = PROJECTROOT "/lib/X11/xinit/.Xmodmap";
+ const char *homedir = getenv("HOME");
+ char usermodmap[PATH_MAX], cmd[PATH_MAX];
DEBUG_LOG("DarwinKeyboardReloadHandler\n");
@@ -397,6 +403,23 @@ void DarwinKeyboardReloadHandler(void) {
}
}
} pthread_mutex_unlock(&keyInfo_mutex);
+
+ /* Check for system .Xmodmap */
+ if (access(xmodmap, F_OK) == 0) {
+ if (access(sysmodmap, F_OK) == 0) {
+ snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap);
+ launch_client(cmd);
+ }
+ }
+
+ /* Check for user's local .Xmodmap */
+ if (homedir != NULL) {
+ snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir);
+ if (access(usermodmap, F_OK) == 0) {
+ snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap);
+ launch_client(cmd);
+ }
+ }
}
//-----------------------------------------------------------------------------