From 21751b2faab327e839f3d0d24960539679220eb4 Mon Sep 17 00:00:00 2001 From: Benjamin Voisin Date: Thu, 9 May 2024 20:59:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20clang-tidy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/ALabel.hpp | 4 ++-- include/AModule.hpp | 4 ++-- src/ALabel.cpp | 12 ++++++++---- src/AModule.cpp | 3 +-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/ALabel.hpp b/include/ALabel.hpp index 8855a3ed..a1aae9da 100644 --- a/include/ALabel.hpp +++ b/include/ALabel.hpp @@ -28,9 +28,9 @@ class ALabel : public AModule { bool handleToggle(GdkEventButton *const &e) override; virtual std::string getState(uint8_t value, bool lesser = false); - std::map submenus_; + std::map submenus_; std::map menuActionsMap_; - static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data); + static void handleGtkMenuEvent(GtkMenuItem *menuitem, gpointer data); }; } // namespace waybar diff --git a/include/AModule.hpp b/include/AModule.hpp index 961f2a7f..90f34187 100644 --- a/include/AModule.hpp +++ b/include/AModule.hpp @@ -2,9 +2,9 @@ #include #include +#include #include #include -#include #include "IModule.hpp" @@ -45,7 +45,7 @@ class AModule : public IModule { virtual bool handleMouseLeave(GdkEventCrossing *const &ev); virtual bool handleScroll(GdkEventScroll *); virtual bool handleRelease(GdkEventButton *const &ev); - GObject* menu_; + GObject *menu_; private: bool handleUserEvent(GdkEventButton *const &ev); diff --git a/src/ALabel.cpp b/src/ALabel.cpp index 4befb5b5..56850617 100644 --- a/src/ALabel.cpp +++ b/src/ALabel.cpp @@ -9,7 +9,9 @@ namespace waybar { ALabel::ALabel(const Json::Value& config, const std::string& name, const std::string& id, const std::string& format, uint16_t interval, bool ellipsize, bool enable_click, bool enable_scroll) - : AModule(config, name, id, config["format-alt"].isString() || config["menu"].isString() || enable_click, enable_scroll), + : AModule(config, name, id, + config["format-alt"].isString() || config["menu"].isString() || enable_click, + enable_scroll), format_(config_["format"].isString() ? config_["format"].asString() : format), interval_(config_["interval"] == "once" ? std::chrono::seconds::max() @@ -59,11 +61,13 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st submenus_ = std::map(); menuActionsMap_ = std::map(); // Linking actions to the GTKMenu based on - for (Json::Value::const_iterator it = config_["menu-actions"].begin(); it != config_["menu-actions"].end(); ++it) { + for (Json::Value::const_iterator it = config_["menu-actions"].begin(); + it != config_["menu-actions"].end(); ++it) { std::string key = it.key().asString(); submenus_[key] = GTK_MENU_ITEM(gtk_builder_get_object(builder, key.c_str())); menuActionsMap_[key] = it->asString(); - g_signal_connect(submenus_[key], "activate", G_CALLBACK(handleGtkMenuEvent), (gpointer) menuActionsMap_[key].c_str()); + g_signal_connect(submenus_[key], "activate", G_CALLBACK(handleGtkMenuEvent), + (gpointer)menuActionsMap_[key].c_str()); } } @@ -142,7 +146,7 @@ bool waybar::ALabel::handleToggle(GdkEventButton* const& e) { } void ALabel::handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data) { - waybar::util::command::res res = waybar::util::command::exec((char*) data, "GtkMenu"); + waybar::util::command::res res = waybar::util::command::exec((char*)data, "GtkMenu"); } std::string ALabel::getState(uint8_t value, bool lesser) { diff --git a/src/AModule.cpp b/src/AModule.cpp index b2cf2fca..77b82cee 100644 --- a/src/AModule.cpp +++ b/src/AModule.cpp @@ -138,8 +138,7 @@ bool AModule::handleUserEvent(GdkEventButton* const& e) { if (rec->second == config_["menu"].asString()) { // Popup the menu gtk_widget_show_all(GTK_WIDGET(menu_)); - gtk_menu_popup_at_pointer (GTK_MENU(menu_), reinterpret_cast(e)); - + gtk_menu_popup_at_pointer(GTK_MENU(menu_), reinterpret_cast(e)); } // Second call user scripts if (!format.empty()) {