From 00ac4bea635099ce2e1e9ff735fe11381ec188ae Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Mon, 26 Dec 2016 10:27:30 +0100 Subject: [PATCH] refactor(x11): Header cleanup --- include/components/controller.hpp | 2 +- include/components/renderer.hpp | 2 +- include/components/screen.hpp | 5 +++-- include/config.hpp.cmake | 2 +- include/x11/connection.hpp | 8 +++++--- include/x11/events.hpp | 4 +--- include/x11/types.hpp | 4 ++++ src/components/bar.cpp | 3 +-- src/components/renderer.cpp | 5 ++--- src/components/screen.cpp | 5 ++++- src/main.cpp | 1 - src/x11/events.cpp | 4 ---- 12 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 src/x11/events.cpp diff --git a/include/components/controller.hpp b/include/components/controller.hpp index 10bbe5a1..fd3d54a6 100644 --- a/include/components/controller.hpp +++ b/include/components/controller.hpp @@ -4,11 +4,11 @@ #include #include "common.hpp" -#include "config.hpp" #include "events/signal_fwd.hpp" #include "events/signal_receiver.hpp" #include "events/types.hpp" #include "x11/types.hpp" +#include "x11/events.hpp" POLYBAR_NS diff --git a/include/components/renderer.hpp b/include/components/renderer.hpp index 97c6f253..52a348be 100644 --- a/include/components/renderer.hpp +++ b/include/components/renderer.hpp @@ -2,7 +2,6 @@ #include "common.hpp" #include "components/types.hpp" -#include "events/signal_emitter.hpp" #include "events/signal_fwd.hpp" #include "events/signal_receiver.hpp" #include "x11/extensions/fwd.hpp" @@ -15,6 +14,7 @@ POLYBAR_NS class connection; class font_manager; class logger; +class signal_emitter; using namespace signals::parser; using std::map; diff --git a/include/components/screen.hpp b/include/components/screen.hpp index 03ecc668..b92b6f8d 100644 --- a/include/components/screen.hpp +++ b/include/components/screen.hpp @@ -1,11 +1,12 @@ #pragma once #include "common.hpp" -#include "components/config.hpp" -#include "components/logger.hpp" #include "components/types.hpp" #include "events/signal_emitter.hpp" +#include "events/signal_fwd.hpp" #include "x11/events.hpp" +#include "x11/extensions/fwd.hpp" +#include "x11/types.hpp" #include "x11/window.hpp" POLYBAR_NS diff --git a/include/config.hpp.cmake b/include/config.hpp.cmake index a695f4cb..2f2b6683 100644 --- a/include/config.hpp.cmake +++ b/include/config.hpp.cmake @@ -65,7 +65,7 @@ static constexpr const char* BUILDER_SPACE_TOKEN{"%__"}; auto version_details = [](const std::vector& args) { for (auto&& arg : args) { - if (arg.compare(0, 3, "-vv") == 0) + if (arg.compare(0, 3, "-vv") == 0) return true; } return false; diff --git a/include/x11/connection.hpp b/include/x11/connection.hpp index 1e1d3197..d08258a6 100644 --- a/include/x11/connection.hpp +++ b/include/x11/connection.hpp @@ -1,14 +1,16 @@ #pragma once #include -#include #include #include #include "common.hpp" +#include "components/screen.hpp" #include "utils/file.hpp" +#include "x11/events.hpp" #include "x11/extensions/all.hpp" #include "x11/registry.hpp" +#include "x11/types.hpp" POLYBAR_NS @@ -71,7 +73,7 @@ namespace detail { } catch (const shared_ptr& error) { check(error); } - throw; // re-throw any exception caused by wait_for_event + throw; // re-throw exception } shared_ptr wait_for_special_event(xcb_special_event_t* se) const { @@ -80,7 +82,7 @@ namespace detail { } catch (const shared_ptr& error) { check(error); } - throw; // re-throw any exception caused by wait_for_event + throw; // re-throw exception } private: diff --git a/include/x11/events.hpp b/include/x11/events.hpp index deb070ab..78f74613 100644 --- a/include/x11/events.hpp +++ b/include/x11/events.hpp @@ -1,8 +1,6 @@ #pragma once -#include "config.hpp" - -#include +#include #include "common.hpp" diff --git a/include/x11/types.hpp b/include/x11/types.hpp index 284cf84d..b02a2dfa 100644 --- a/include/x11/types.hpp +++ b/include/x11/types.hpp @@ -17,6 +17,10 @@ namespace xpp { class font; template class...> class cursor; + namespace event { + template + class sink; + } } POLYBAR_NS diff --git a/src/components/bar.cpp b/src/components/bar.cpp index 051d304c..0c23ced5 100644 --- a/src/components/bar.cpp +++ b/src/components/bar.cpp @@ -17,9 +17,8 @@ #include "utils/math.hpp" #include "utils/string.hpp" #include "x11/atoms.hpp" -#include "x11/extensions/all.hpp" #include "x11/connection.hpp" -#include "x11/fonts.hpp" +#include "x11/extensions/all.hpp" #include "x11/tray_manager.hpp" #include "x11/wm.hpp" #include "x11/xutils.hpp" diff --git a/src/components/renderer.cpp b/src/components/renderer.cpp index d24874a6..84689a2e 100644 --- a/src/components/renderer.cpp +++ b/src/components/renderer.cpp @@ -1,13 +1,12 @@ #include "components/renderer.hpp" #include "components/logger.hpp" -#include "components/types.hpp" #include "errors.hpp" #include "events/signal.hpp" -#include "events/signal_receiver.hpp" #include "events/signal_emitter.hpp" +#include "events/signal_receiver.hpp" #include "x11/connection.hpp" #include "x11/draw.hpp" -#include "x11/fonts.hpp" +#include "x11/extensions/all.hpp" #include "x11/generic.hpp" #include "x11/winspec.hpp" #include "x11/xlib.hpp" diff --git a/src/components/screen.cpp b/src/components/screen.cpp index b6232a1b..9549d1ba 100644 --- a/src/components/screen.cpp +++ b/src/components/screen.cpp @@ -8,7 +8,10 @@ #include "events/signal.hpp" #include "events/signal_emitter.hpp" #include "x11/connection.hpp" -#include "x11/extensions/randr.hpp" +#include "x11/events.hpp" +#include "x11/extensions/all.hpp" +#include "x11/registry.hpp" +#include "x11/types.hpp" #include "x11/winspec.hpp" POLYBAR_NS diff --git a/src/main.cpp b/src/main.cpp index 0152629a..fa03d860 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,7 +85,6 @@ int main(int argc, char** argv) { conn.query_extensions(); conn.ensure_event_mask(conn.root(), XCB_EVENT_MASK_PROPERTY_CHANGE); - //================================================== // Load user configuration //================================================== diff --git a/src/x11/events.cpp b/src/x11/events.cpp deleted file mode 100644 index 2954805f..00000000 --- a/src/x11/events.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include - -#include "x11/events.hpp"