From 20f3d9a1419ea3cbf5694d442847eccb4c8f148c Mon Sep 17 00:00:00 2001 From: patrick96 Date: Sun, 6 May 2018 17:45:43 +0200 Subject: [PATCH] refactor: Don't initialize forward declared members Using brace initialization here causes bar.hpp to not compile when included on its own, forcing all clients to also include tray_manager.hpp and so on, which defeats the purpose of forward declaring those classes. This also allows us to remove the tray_manager.hpp, renderer.hpp and parser.hpp includes from the clients of bar.hpp --- include/components/bar.hpp | 6 +++--- src/components/controller.cpp | 2 -- src/main.cpp | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/components/bar.hpp b/include/components/bar.hpp index 8efab743..a5cfbeda 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -97,9 +97,9 @@ class bar : public xpp::event::sink m_screen; - unique_ptr m_tray{}; - unique_ptr m_renderer{}; - unique_ptr m_parser{}; + unique_ptr m_tray; + unique_ptr m_renderer; + unique_ptr m_parser; unique_ptr m_taskqueue; bar_settings m_opts{}; diff --git a/src/components/controller.cpp b/src/components/controller.cpp index 2f93c969..ab33311f 100644 --- a/src/components/controller.cpp +++ b/src/components/controller.cpp @@ -5,7 +5,6 @@ #include "components/controller.hpp" #include "components/ipc.hpp" #include "components/logger.hpp" -#include "components/renderer.hpp" #include "components/types.hpp" #include "events/signal.hpp" #include "events/signal_emitter.hpp" @@ -18,7 +17,6 @@ #include "utils/time.hpp" #include "x11/connection.hpp" #include "x11/extensions/all.hpp" -#include "x11/tray_manager.hpp" #include "x11/types.hpp" POLYBAR_NS diff --git a/src/main.cpp b/src/main.cpp index 319c29ba..7451d4e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,12 +3,9 @@ #include "components/config.hpp" #include "components/controller.hpp" #include "components/ipc.hpp" -#include "components/parser.hpp" -#include "components/renderer.hpp" #include "utils/env.hpp" #include "utils/inotify.hpp" #include "utils/process.hpp" -#include "x11/tray_manager.hpp" using namespace polybar;