core: Add clang-tidy (#8664)

This adds a .clang-tidy file for us.

It's not a strict requirement to be compliant, but I tuned it to be alright.
This commit is contained in:
Vaxry 2024-12-07 18:51:18 +01:00 committed by GitHub
parent b1e5cc66bd
commit 8bbeee1173
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
118 changed files with 720 additions and 679 deletions

View file

@ -3,8 +3,8 @@
#include "../../config/ConfigValue.hpp"
#include "../../managers/eventLoop/EventLoopManager.hpp"
CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
m_pWindow = pWindow;
CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
;
}
CHyprBorderDecoration::~CHyprBorderDecoration() {

View file

@ -3,11 +3,11 @@
#include "../../Compositor.hpp"
#include "../../config/ConfigValue.hpp"
CHyprDropShadowDecoration::CHyprDropShadowDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
m_pWindow = pWindow;
CHyprDropShadowDecoration::CHyprDropShadowDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
;
}
CHyprDropShadowDecoration::~CHyprDropShadowDecoration() {}
CHyprDropShadowDecoration::~CHyprDropShadowDecoration() = default;
eDecorationType CHyprDropShadowDecoration::getDecorationType() {
return DECORATION_SHADOW;

View file

@ -17,16 +17,15 @@ constexpr int BAR_PADDING_OUTER_HORZ = 2;
constexpr int BAR_TEXT_PAD = 2;
constexpr int BAR_HORIZONTAL_PADDING = 2;
CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
m_pWindow = pWindow;
if (m_tGradientActive->m_iTexID == 0 && *PENABLED && *PGRADIENTS)
refreshGroupBarGradients();
}
CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {}
CHyprGroupBarDecoration::~CHyprGroupBarDecoration() = default;
SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
static auto PHEIGHT = CConfigValue<Hyprlang::INT>("group:groupbar:height");

View file

@ -85,12 +85,7 @@ CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor
}
void CDecorationPositioner::sanitizeDatas() {
std::erase_if(m_mWindowDatas, [](const auto& other) {
if (!valid(other.first))
return true;
return false;
});
std::erase_if(m_mWindowDatas, [](const auto& other) { return !valid(other.first); });
std::erase_if(m_vWindowPositioningDatas, [](const auto& other) {
if (!validMapped(other->pWindow))
return true;

View file

@ -9,12 +9,12 @@
class CWindow;
class IHyprWindowDecoration;
enum eDecorationPositioningPolicy {
enum eDecorationPositioningPolicy : uint8_t {
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
};
enum eDecorationEdges {
enum eDecorationEdges : uint8_t {
DECORATION_EDGE_TOP = 1 << 0,
DECORATION_EDGE_BOTTOM = 1 << 1,
DECORATION_EDGE_LEFT = 1 << 2,

View file

@ -2,11 +2,11 @@
class CWindow;
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) {
m_pWindow = pWindow;
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) : m_pWindow(pWindow) {
;
}
IHyprWindowDecoration::~IHyprWindowDecoration() {}
IHyprWindowDecoration::~IHyprWindowDecoration() = default;
bool IHyprWindowDecoration::onInputOnDeco(const eInputType, const Vector2D&, std::any) {
return false;

View file

@ -5,7 +5,7 @@
#include "../../helpers/math/Math.hpp"
#include "DecorationPositioner.hpp"
enum eDecorationType {
enum eDecorationType : int8_t {
DECORATION_NONE = -1,
DECORATION_GROUPBAR,
DECORATION_SHADOW,
@ -13,14 +13,14 @@ enum eDecorationType {
DECORATION_CUSTOM
};
enum eDecorationLayer {
enum eDecorationLayer : uint8_t {
DECORATION_LAYER_BOTTOM = 0, /* lowest. */
DECORATION_LAYER_UNDER, /* under the window, but above BOTTOM */
DECORATION_LAYER_OVER, /* above the window, but below its popups */
DECORATION_LAYER_OVERLAY /* above everything of the window, including popups */
};
enum eDecorationFlags {
enum eDecorationFlags : uint8_t {
DECORATION_ALLOWS_MOUSE_INPUT = 1 << 0, /* this decoration accepts mouse input */
DECORATION_PART_OF_MAIN_WINDOW = 1 << 1, /* this decoration is a *seamless* part of the main window, so stuff like shadows will include it */
DECORATION_NON_SOLID = 1 << 2, /* this decoration is not solid. Other decorations should draw on top of it. Example: shadow */