[systemd-commits] 3 commits - src/libsystemd-terminal src/locale
David Herrmann
dvdhrm at kemper.freedesktop.org
Tue Nov 25 01:27:36 PST 2014
src/libsystemd-terminal/idev-keyboard.c | 26 +++++++++++++++++++++++++-
src/locale/localed.c | 10 +++++-----
2 files changed, 30 insertions(+), 6 deletions(-)
New commits:
commit 8623d3a3b2e3463fa6e4ded734323483540c3ed4
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Tue Nov 25 10:26:08 2014 +0100
localed: verify xkb keymaps after pk-queries
Make sure not to run xkb-keymap validation twice if pk-queries are used.
Move it below pk-checks.
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 4e56382..7fe7324 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -1087,17 +1087,17 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat
(options && !string_is_safe(options)))
return sd_bus_error_set_errnof(error, -EINVAL, "Received invalid keyboard data");
- r = verify_xkb_rmlvo(model, layout, variant, options);
- if (r < 0)
- log_warning("Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %s",
- strempty(model), strempty(layout), strempty(variant), strempty(options), strerror(-r));
-
r = bus_verify_polkit_async(m, CAP_SYS_ADMIN, "org.freedesktop.locale1.set-keyboard", interactive, &c->polkit_registry, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
+ r = verify_xkb_rmlvo(model, layout, variant, options);
+ if (r < 0)
+ log_warning("Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %s",
+ strempty(model), strempty(layout), strempty(variant), strempty(options), strerror(-r));
+
if (free_and_strdup(&c->x11_layout, layout) < 0 ||
free_and_strdup(&c->x11_model, model) < 0 ||
free_and_strdup(&c->x11_variant, variant) < 0 ||
commit 2f0dd5164d36956197b9e649a100d5cfe08bb247
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Tue Nov 25 10:24:39 2014 +0100
terminal/idev: forward xkb-messages
Properly forward all XKB messages. You can use XKB_LOG_VERBOSITY= to
control the amount of messages sent by XKB. We explicitly set
XKB_LOG_LEVEL to 7 you can use SYSTEMD_LOG_LEVEL to control the log-level
generically.
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index c690c66..ad2d74a 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -504,6 +504,27 @@ static int kbdctx_setup_bus(kbdctx *kc) {
return kbdctx_query_locale(kc);
}
+static void kbdctx_log_fn(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) {
+ char buf[LINE_MAX];
+ int sd_lvl;
+
+ if (lvl >= XKB_LOG_LEVEL_DEBUG)
+ sd_lvl = LOG_DEBUG;
+ else if (lvl >= XKB_LOG_LEVEL_INFO)
+ sd_lvl = LOG_INFO;
+ else if (lvl >= XKB_LOG_LEVEL_WARNING)
+ sd_lvl = LOG_INFO; /* most XKB warnings really are informational */
+ else if (lvl >= XKB_LOG_LEVEL_ERROR)
+ sd_lvl = LOG_ERR;
+ else if (lvl >= XKB_LOG_LEVEL_CRITICAL)
+ sd_lvl = LOG_CRIT;
+ else
+ sd_lvl = LOG_CRIT;
+
+ snprintf(buf, sizeof(buf), "idev-xkb: %s", format);
+ log_metav(sd_lvl, __FILE__, __LINE__, __func__, buf, args);
+}
+
static kbdctx *kbdctx_ref(kbdctx *kc) {
assert_return(kc, NULL);
assert_return(kc->ref > 0, NULL);
@@ -562,6 +583,9 @@ static int kbdctx_new(kbdctx **out, idev_context *c) {
if (!kc->xkb_context)
return errno > 0 ? -errno : -EFAULT;
+ xkb_context_set_log_fn(kc->xkb_context, kbdctx_log_fn);
+ xkb_context_set_log_level(kc->xkb_context, XKB_LOG_LEVEL_DEBUG);
+
r = kbdctx_refresh_keymap(kc);
if (r < 0)
return r;
commit 123a8dc84db405d3001fd02d224a02ebe6ec0b18
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Tue Nov 25 10:24:08 2014 +0100
terminal/idev: avoid magic numbers
Use XKB_CONTEXT_NO_FLAGS instead of magic 0.
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index eca38fc..c690c66 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -558,7 +558,7 @@ static int kbdctx_new(kbdctx **out, idev_context *c) {
kc->context = c;
errno = 0;
- kc->xkb_context = xkb_context_new(0);
+ kc->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (!kc->xkb_context)
return errno > 0 ? -errno : -EFAULT;
More information about the systemd-commits
mailing list