diff options
-rw-r--r-- | 10-x11-keymap.fdi | 9 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | fedora-setup-keyboard.c | 53 |
3 files changed, 2 insertions, 63 deletions
diff --git a/10-x11-keymap.fdi b/10-x11-keymap.fdi deleted file mode 100644 index 3c86017..0000000 --- a/10-x11-keymap.fdi +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- --> -<deviceinfo version="0.2"> - <device> - <match key="info.capabilities" contains="input.keyboard"> - <merge key="input.xkb.options" type="string">terminate:ctrl_alt_bksp</merge> - <append key="info.callouts.add" type="strlist">fedora-setup-keyboard</append> - </match> - </device> -</deviceinfo> @@ -3,11 +3,10 @@ CFLAGS= all: python get_layouts.py > keyboards.h - $(CC) -Wall fedora-setup-keyboard.c `pkg-config --cflags --libs hal glib-2.0` $(CFLAGS) -o fedora-setup-keyboard + $(CC) -Wall fedora-setup-keyboard.c `pkg-config --cflags --libs glib-2.0` $(CFLAGS) -o fedora-setup-keyboard install: install -D -m 755 fedora-setup-keyboard $(DESTDIR)/usr/bin/fedora-setup-keyboard - install -D -m 644 10-x11-keymap.fdi $(DESTDIR)/usr/share/hal/fdi/policy/10osvendor/10-x11-keymap.fdi clean: rm -f fedora-setup-keyboard keyboards.h diff --git a/fedora-setup-keyboard.c b/fedora-setup-keyboard.c index 0c4f217..212c12a 100644 --- a/fedora-setup-keyboard.c +++ b/fedora-setup-keyboard.c @@ -1,5 +1,6 @@ /* * Copyright © 2009 Adel Gadllah + * Copyright © 2009 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +24,6 @@ * */ -#include <libhal.h> #include <glib.h> #include <string.h> #include <stdlib.h> @@ -53,34 +53,6 @@ gchar* remove_quotes(gchar *str) { return tmp; } -/** - * Append the given value to the current value of matching key. - * Memory for the returned string must be freed by the caller. - * - * Only merges input.xkb.options ATM - */ -gchar *merge_key(LibHalContext *hal_ctx, gchar *udi, gchar* key, gchar *value) { - gchar *xkb_opts; - gchar *merged = NULL; - - /* We only need to merge xkb.options */ - if (strcmp(key, KEY_OPTIONS) != 0) - return g_strdup(value); - xkb_opts = libhal_device_get_property_string(hal_ctx, udi, - KEY_OPTIONS, NULL); - if (!xkb_opts || strlen(xkb_opts) == 0) - merged = g_strdup(value); - else if (!value || strlen(value) == 0) - merged = g_strdup(xkb_opts); - else - merged = g_strdup_printf("%s,%s", xkb_opts, value); - - if (xkb_opts) - libhal_free_string(xkb_opts); - - return merged; -} - int main() { GKeyFile *cfg_file; gchar *buffer, *conf; @@ -93,24 +65,6 @@ int main() { gchar **list; gchar *key, *udi, *tmp; - /* connect to HAL */ - LibHalContext *hal_ctx; - - if((udi = getenv("UDI")) == NULL) - return 1; - - if((hal_ctx = libhal_ctx_init_direct(NULL)) == NULL) { - if((hal_ctx = libhal_ctx_new()) == NULL) - return 1; - - if(!libhal_ctx_set_dbus_connection(hal_ctx, dbus_bus_get(DBUS_BUS_SYSTEM, NULL))) - return 1; - - if(!libhal_ctx_init(hal_ctx, NULL)) - return 1; - } - - /* Parse the config file */ cfg_file = g_key_file_new(); g_file_get_contents(KBDCONFIG, &buffer, NULL, NULL); @@ -140,10 +94,6 @@ int main() { key = g_strdup_printf("input.xkb.%s", map[i]); - value = merge_key(hal_ctx, udi, key, - (property != NULL) ? property : list[i]); - libhal_device_set_property_string(hal_ctx, udi, key, value, NULL); - if(property != NULL) g_free(property); g_free(value); @@ -154,7 +104,6 @@ int main() { /* cleanup */ g_free(conf); g_free(list); - libhal_ctx_free(hal_ctx); g_hash_table_destroy(kbd_models); return 0; |