#pragma once #include "common.hpp" #include "components/ipc.hpp" #include "components/parser.hpp" #include "components/types.hpp" #include "utils/functional.hpp" POLYBAR_NS // fwd enum class mousebtn : uint8_t; enum class syntaxtag : uint8_t; enum class alignment : uint8_t; enum class attribute : uint8_t; namespace signals { namespace detail { class signal { public: explicit signal() = default; virtual ~signal() {} virtual size_t size() const = 0; }; template class base_signal : public signal { public: using base_type = base_signal; explicit base_signal() = default; virtual ~base_signal() {} virtual size_t size() const override { return sizeof(Derived); }; }; template class value_signal : public base_signal { public: using base_type = value_signal; using value_type = ValueType; template explicit value_signal(void* data) : m_data(data), m_size(Size) {} template explicit value_signal(ValueType data) : m_size(Size) { m_data = new char[Size]; m_alloced = true; memcpy(m_data, static_cast(&data), Size); } virtual ~value_signal() { if (m_alloced) { delete[] static_cast(m_data); } } void* data() const { return m_data; } size_t size() const { return m_size; } inline ValueType cast() const { return *static_cast(m_data); } private: void* m_data; size_t m_size; bool m_alloced{false}; }; } namespace eventqueue { struct exit_terminate : public detail::base_signal { using base_type::base_type; }; struct exit_reload : public detail::base_signal { using base_type::base_type; }; struct notify_change : public detail::base_signal { using base_type::base_type; }; struct notify_forcechange : public detail::base_signal { using base_type::base_type; }; struct check_state : public detail::base_signal { using base_type::base_type; }; } namespace ipc { struct command : public detail::value_signal { using base_type::base_type; }; struct hook : public detail::value_signal { using base_type::base_type; }; struct action : public detail::value_signal { using base_type::base_type; }; } namespace ui { struct tick : public detail::base_signal { using base_type::base_type; }; struct button_press : public detail::value_signal { using base_type::base_type; }; struct visibility_change : public detail::value_signal { using base_type::base_type; }; struct dim_window : public detail::value_signal { using base_type::base_type; }; struct shade_window : public detail::base_signal { using base_type::base_type; }; struct unshade_window : public detail::base_signal { using base_type::base_type; }; } namespace ui_tray { struct mapped_clients : public detail::value_signal { using base_type::base_type; }; } namespace parser { struct change_background : public detail::value_signal { using base_type::base_type; }; struct change_foreground : public detail::value_signal { using base_type::base_type; }; struct change_underline : public detail::value_signal { using base_type::base_type; }; struct change_overline : public detail::value_signal { using base_type::base_type; }; struct change_font : public detail::value_signal { using base_type::base_type; }; struct change_alignment : public detail::value_signal { using base_type::base_type; }; struct offset_pixel : public detail::value_signal { using base_type::base_type; }; struct attribute_set : public detail::value_signal { using base_type::base_type; }; struct attribute_unset : public detail::value_signal { using base_type::base_type; }; struct attribute_toggle : public detail::value_signal { using base_type::base_type; }; struct action_begin : public detail::value_signal { using base_type::base_type; }; struct action_end : public detail::value_signal { using base_type::base_type; }; struct write_text_ascii : public detail::value_signal { using base_type::base_type; }; struct write_text_unicode : public detail::value_signal { using base_type::base_type; }; struct write_text_string : public detail::value_signal { using base_type::base_type; }; } } POLYBAR_NS_END