Skip to content

Commit

Permalink
backlight: clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jul 23, 2024
1 parent 49f580f commit 16f5e2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 1 addition & 6 deletions include/modules/backlight.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#pragma once

#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>

#include "ALabel.hpp"
#include "util/backlight_backend.hpp"
#include "util/json.hpp"

struct udev;
struct udev_device;
Expand All @@ -18,7 +13,7 @@ namespace waybar::modules {
class Backlight : public ALabel {
public:
Backlight(const std::string &, const Json::Value &);
virtual ~Backlight() = default;
~Backlight() override = default;
auto update() -> void override;

bool handleScroll(GdkEventScroll *e) override;
Expand Down
7 changes: 3 additions & 4 deletions src/modules/backlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
#include <sys/epoll.h>
#include <unistd.h>

#include <algorithm>
#include <chrono>
#include <memory>
#include <cmath>

#include "util/backend_common.hpp"
#include "util/backlight_backend.hpp"
Expand All @@ -27,7 +26,7 @@ waybar::modules::Backlight::Backlight(const std::string &id, const Json::Value &
auto waybar::modules::Backlight::update() -> void {
GET_BEST_DEVICE(best, backend, preferred_device_);

const auto previous_best_device = backend.get_previous_best_device();
const auto *const previous_best_device = backend.get_previous_best_device();
if (best != nullptr) {
if (previous_best_device != nullptr && *previous_best_device == *best &&
!previous_format_.empty() && previous_format_ == format_) {
Expand All @@ -37,7 +36,7 @@ auto waybar::modules::Backlight::update() -> void {
if (best->get_powered()) {
event_box_.show();
const uint8_t percent =
best->get_max() == 0 ? 100 : round(best->get_actual() * 100.0f / best->get_max());
best->get_max() == 0 ? 100 : std::round(best->get_actual() * 100.0F / best->get_max());
std::string desc = fmt::format(fmt::runtime(format_), fmt::arg("percent", percent),
fmt::arg("icon", getIcon(percent)));
label_.set_markup(desc);
Expand Down

0 comments on commit 16f5e2e

Please sign in to comment.