XQuartz: Run xmodmap after programatically updating the keymap.

Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
Signed-off-by: Martin Otte <otte@duke.edu>
(cherry picked from commit 5e79976c13)
This commit is contained in:
Jeremy Huddleston 2009-11-03 16:35:27 -08:00
parent 9e9ff04320
commit ccbf949abb
3 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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);
}
}
}
//-----------------------------------------------------------------------------