[systemd-commits] src/vconsole-setup.c

Lennart Poettering lennart at kemper.freedesktop.org
Wed Nov 10 14:42:22 PST 2010


 src/vconsole-setup.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 5b396b06e0bed91f3e6837994a9c2d5c9fc1de8d
Author: Andrey Borzenkov <arvidjaar at gmail.com>
Date:   Sat Nov 6 19:11:03 2010 +0300

    vconsole: support additional keymap for toggling layouts
    
    At least Mandriva offers configuring characters to toggle
    keyboard layout independently from main keymap. This functions
    much the same as XkbOptions for X11 and actually is configured
    together. The patch adds support for additional keymap,
    KEYMAP_TOGGLE, to /etc/vconsole.conf, that is intended to be
    used for the same purpose.

diff --git a/src/vconsole-setup.c b/src/vconsole-setup.c
index 7703361..27e4178 100644
--- a/src/vconsole-setup.c
+++ b/src/vconsole-setup.c
@@ -78,8 +78,8 @@ static int disable_utf8(int fd) {
         return r;
 }
 
-static int load_keymap(const char *vc, const char *map, bool utf8, pid_t *_pid) {
-        const char *args[7];
+static int load_keymap(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
+        const char *args[8];
         int i = 0;
         pid_t pid;
 
@@ -90,6 +90,8 @@ static int load_keymap(const char *vc, const char *map, bool utf8, pid_t *_pid)
         if (utf8)
                 args[i++] = "-u";
         args[i++] = map;
+        if (map_toggle)
+                args[i++] = map_toggle;
         args[i++] = NULL;
 
         if ((pid = fork()) < 0) {
@@ -138,6 +140,7 @@ static int load_font(const char *vc, const char *font, const char *map, const ch
 int main(int argc, char **argv) {
         const char *vc;
         char *vc_keymap = NULL;
+        char *vc_keymap_toggle = NULL;
         char *vc_font = NULL;
         char *vc_font_map = NULL;
         char *vc_font_unimap = NULL;
@@ -176,6 +179,7 @@ int main(int argc, char **argv) {
                                 "KEYTABLE", &vc_keymap,
 #endif
                                 "vconsole.keymap", &vc_keymap,
+                                "vconsole.keymap.toggle", &vc_keymap_toggle,
                                 "vconsole.font", &vc_font,
                                 "vconsole.font.map", &vc_font_map,
                                 "vconsole.font.unimap", &vc_font_unimap,
@@ -190,6 +194,7 @@ int main(int argc, char **argv) {
         if (r <= 0 &&
             (r = parse_env_file("/etc/vconsole.conf", NEWLINE,
                                 "KEYMAP", &vc_keymap,
+                                "KEYMAP_TOGGLE", &vc_keymap_toggle,
                                 "FONT", &vc_font,
                                 "FONT_MAP", &vc_font_map,
                                 "FONT_UNIMAP", &vc_font_unimap,
@@ -325,7 +330,7 @@ int main(int argc, char **argv) {
         if (!utf8)
                 disable_utf8(fd);
 
-        if (load_keymap(vc, vc_keymap, utf8, &keymap_pid) >= 0 &&
+        if (load_keymap(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 &&
             load_font(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0)
                 r = EXIT_SUCCESS;
 



More information about the systemd-commits mailing list