From 2f3c2e952edea531bee42ecf058268b458fd94c0 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Wed, 30 Nov 2016 11:29:41 +0100 Subject: [PATCH] fix(xkeyboard): Minor tweaks --- .gitmodules | 2 +- include/x11/extensions_fwd.hpp | 11 ++++------- lib/xpp | 2 +- src/modules/xkeyboard.cpp | 6 ++++-- src/x11/registry.cpp | 1 + 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitmodules b/.gitmodules index f4d7f5ee..1f20a3d2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,4 +5,4 @@ [submodule "lib/xpp"] path = lib/xpp url = https://github.com/jaagr/xpp - branch = 1.3.3 + branch = 1.3.4 diff --git a/include/x11/extensions_fwd.hpp b/include/x11/extensions_fwd.hpp index f1098168..666b6be6 100644 --- a/include/x11/extensions_fwd.hpp +++ b/include/x11/extensions_fwd.hpp @@ -28,12 +28,9 @@ namespace xpp { class extension; } #endif -} - -POLYBAR_NS - #if ENABLE_XKB_EXT - class xkb_extension; + namespace xkb { + class extension; + } #endif - -POLYBAR_NS_END +} diff --git a/lib/xpp b/lib/xpp index 34d0cf14..49ed2c14 160000 --- a/lib/xpp +++ b/lib/xpp @@ -1 +1 @@ -Subproject commit 34d0cf14e928270e3dd2ff3aab97f2208d409bff +Subproject commit 49ed2c142109fe92932ae906fc4b40b5138b2809 diff --git a/src/modules/xkeyboard.cpp b/src/modules/xkeyboard.cpp index ac2675c3..5ba927ba 100644 --- a/src/modules/xkeyboard.cpp +++ b/src/modules/xkeyboard.cpp @@ -99,12 +99,14 @@ namespace modules { if (tag == TAG_LABEL_LAYOUT) { builder->node(m_layout); } else if (tag == TAG_LABEL_INDICATOR) { + size_t n{0}; for (auto&& indicator : m_indicators) { - if (indicator != *m_indicators.begin()) { + if (n++) { builder->space(m_formatter->get(DEFAULT_FORMAT)->spacing); } builder->node(indicator.second); } + return n > 0; } else { return false; } @@ -154,7 +156,7 @@ namespace modules { * Handler for XCB_XKB_INDICATOR_STATE_NOTIFY events */ void xkeyboard_module::handle(const evt::xkb_indicator_state_notify& evt) { - if (m_xkbnotify.allow(evt->time)) { + if (m_xkbnotify.allow(evt->time) && m_keyboard) { m_keyboard->set(m_connection.xkb().get_state(XCB_XKB_ID_USE_CORE_KBD)->lockedMods); update(); } diff --git a/src/x11/registry.cpp b/src/x11/registry.cpp index 329b0993..262eaac3 100644 --- a/src/x11/registry.cpp +++ b/src/x11/registry.cpp @@ -1,5 +1,6 @@ #include "x11/connection.hpp" #include "x11/extensions.hpp" + #include "x11/registry.hpp" POLYBAR_NS