rpms/fedora-setup-keyboard/devel fedora-setup-keyboard-0.3-merge-terminate.patch, NONE, 1.1 fedora-setup-keyboard.spec, 1.2, 1.3
Peter Hutterer
whot at fedoraproject.org
Thu Apr 9 05:24:42 UTC 2009
Author: whot
Update of /cvs/pkgs/rpms/fedora-setup-keyboard/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25877
Modified Files:
fedora-setup-keyboard.spec
Added Files:
fedora-setup-keyboard-0.3-merge-terminate.patch
Log Message:
* Thu Apr 09 2009 Peter Hutterer <peter.hutterer at redhat.com> 0.3-4
- fedora-setup-keyboard-0.3-merge-terminate.patch: merge xkb options for
termination.
fedora-setup-keyboard-0.3-merge-terminate.patch:
--- NEW FILE fedora-setup-keyboard-0.3-merge-terminate.patch ---
>From d7fbf641c4e897aefc038d19830e39f992467b08 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu, 9 Apr 2009 11:04:37 +1000
Subject: [PATCH] Merge input.xkb.options terminate:ctrl_alt_bksp by default.
Prepend to options already existing if necessary.
---
10-x11-keymap.fdi | 1 +
fedora-setup-keyboard.c | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/10-x11-keymap.fdi b/10-x11-keymap.fdi
index c78f05b..3c86017 100644
--- a/10-x11-keymap.fdi
+++ b/10-x11-keymap.fdi
@@ -2,6 +2,7 @@
<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>
diff --git a/fedora-setup-keyboard.c b/fedora-setup-keyboard.c
index e656983..8af28a0 100644
--- a/fedora-setup-keyboard.c
+++ b/fedora-setup-keyboard.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#define KBDCONFIG "/etc/sysconfig/keyboard"
+#define KEY_OPTIONS "input.xkb.options"
gchar* remove_quotes(gchar *str) {
gchar *tmp;
@@ -52,6 +53,34 @@ 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 mergess 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;
@@ -103,16 +132,21 @@ int main() {
list = g_strsplit(keytable, " ", 4);
n = g_strv_length(list);
for ( i = 0; i < n; i++) {
+ gchar *value;
/* honor user setting */
tmp = g_ascii_strup(map[i], -1);
property = remove_quotes(g_key_file_get_value(cfg_file, "kbd", tmp, NULL));
g_free(tmp);
key = g_strdup_printf("input.xkb.%s", map[i]);
- libhal_device_set_property_string(hal_ctx, udi, key, (property != NULL) ? property : list[i], NULL);
+
+ 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);
g_free(key);
}
--
1.6.2.2.447.g4afa7
Index: fedora-setup-keyboard.spec
===================================================================
RCS file: /cvs/pkgs/rpms/fedora-setup-keyboard/devel/fedora-setup-keyboard.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- fedora-setup-keyboard.spec 4 Mar 2009 22:53:44 -0000 1.2
+++ fedora-setup-keyboard.spec 9 Apr 2009 05:24:11 -0000 1.3
@@ -1,6 +1,6 @@
Name: fedora-setup-keyboard
Version: 0.3
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Hal keyboard layout callout
Group: Applications/System
@@ -9,6 +9,8 @@
Source0: https://fedorahosted.org/releases/f/e/%{name}/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch1: fedora-setup-keyboard-0.3-merge-terminate.patch
+
BuildRequires: hal-devel
BuildRequires: glib2-devel
BuildRequires: rhpl
@@ -22,6 +24,7 @@
%prep
%setup -q
+%patch1 -p1 -b .terminate
%build
@@ -44,6 +47,10 @@
%doc COPYING
%changelog
+* Thu Apr 09 2009 Peter Hutterer <peter.hutterer at redhat.com> 0.3-4
+- fedora-setup-keyboard-0.3-merge-terminate.patch: merge xkb options for
+ termination.
+
* Thu Mar 05 2009 Peter Hutterer <peter.hutterer at redhat.com> 0.3-3
- Conflict xorg-x11-server-Xorg < 1.6.0-7 (10-x11-keymap.fdi and
fedora-setup-keyboard up to 1.6.0-5)
More information about the fedora-extras-commits
mailing list