mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2025-01-08 05:19:48 +01:00
borderspp: chase hyprland
This commit is contained in:
parent
859b9cd371
commit
3cd8d37a5d
5 changed files with 61 additions and 1 deletions
19
borders-plus-plus/BorderppPassElement.cpp
Normal file
19
borders-plus-plus/BorderppPassElement.cpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#include "BorderppPassElement.hpp"
|
||||||
|
#include <hyprland/src/render/OpenGL.hpp>
|
||||||
|
#include "borderDeco.hpp"
|
||||||
|
|
||||||
|
CBorderPPPassElement::CBorderPPPassElement(const CBorderPPPassElement::SBorderPPData& data_) : data(data_) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBorderPPPassElement::draw(const CRegion& damage) {
|
||||||
|
data.deco->drawPass(g_pHyprOpenGL->m_RenderData.pMonitor.lock(), data.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CBorderPPPassElement::needsLiveBlur() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CBorderPPPassElement::needsPrecomputeBlur() {
|
||||||
|
return false;
|
||||||
|
}
|
26
borders-plus-plus/BorderppPassElement.hpp
Normal file
26
borders-plus-plus/BorderppPassElement.hpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#pragma once
|
||||||
|
#include <hyprland/src/render/pass/PassElement.hpp>
|
||||||
|
|
||||||
|
class CBordersPlusPlus;
|
||||||
|
|
||||||
|
class CBorderPPPassElement : public IPassElement {
|
||||||
|
public:
|
||||||
|
struct SBorderPPData {
|
||||||
|
CBordersPlusPlus* deco = nullptr;
|
||||||
|
float a = 1.F;
|
||||||
|
};
|
||||||
|
|
||||||
|
CBorderPPPassElement(const SBorderPPData& data_);
|
||||||
|
virtual ~CBorderPPPassElement() = default;
|
||||||
|
|
||||||
|
virtual void draw(const CRegion& damage);
|
||||||
|
virtual bool needsLiveBlur();
|
||||||
|
virtual bool needsPrecomputeBlur();
|
||||||
|
|
||||||
|
virtual const char* passName() {
|
||||||
|
return "CBorderPPPassElement";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SBorderPPData data;
|
||||||
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
all:
|
all:
|
||||||
$(CXX) -shared -fPIC --no-gnu-unique main.cpp borderDeco.cpp -o borders-plus-plus.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -O2
|
$(CXX) -shared -fPIC --no-gnu-unique main.cpp borderDeco.cpp BorderppPassElement.cpp -o borders-plus-plus.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -O2
|
||||||
clean:
|
clean:
|
||||||
rm ./borders-plus-plus.so
|
rm ./borders-plus-plus.so
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
#include <hyprland/src/Compositor.hpp>
|
#include <hyprland/src/Compositor.hpp>
|
||||||
#include <hyprland/src/desktop/Window.hpp>
|
#include <hyprland/src/desktop/Window.hpp>
|
||||||
|
#include <hyprland/src/render/Renderer.hpp>
|
||||||
|
|
||||||
|
#include "BorderppPassElement.hpp"
|
||||||
#include "globals.hpp"
|
#include "globals.hpp"
|
||||||
|
|
||||||
CBordersPlusPlus::CBordersPlusPlus(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
|
CBordersPlusPlus::CBordersPlusPlus(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
|
||||||
|
@ -68,6 +70,15 @@ void CBordersPlusPlus::draw(PHLMONITOR pMonitor, const float& a) {
|
||||||
if (!PWINDOW->m_sWindowData.decorate.valueOrDefault())
|
if (!PWINDOW->m_sWindowData.decorate.valueOrDefault())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CBorderPPPassElement::SBorderPPData data;
|
||||||
|
data.deco = this;
|
||||||
|
|
||||||
|
g_pHyprRenderer->m_sRenderPass.add(makeShared<CBorderPPPassElement>(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBordersPlusPlus::drawPass(PHLMONITOR pMonitor, const float& a) {
|
||||||
|
const auto PWINDOW = m_pWindow.lock();
|
||||||
|
|
||||||
static std::vector<Hyprlang::INT* const*> PCOLORS;
|
static std::vector<Hyprlang::INT* const*> PCOLORS;
|
||||||
static std::vector<Hyprlang::INT* const*> PSIZES;
|
static std::vector<Hyprlang::INT* const*> PSIZES;
|
||||||
for (size_t i = 0; i < 9; ++i) {
|
for (size_t i = 0; i < 9; ++i) {
|
||||||
|
|
|
@ -28,6 +28,8 @@ class CBordersPlusPlus : public IHyprWindowDecoration {
|
||||||
virtual std::string getDisplayName();
|
virtual std::string getDisplayName();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void drawPass(PHLMONITOR, float const& a);
|
||||||
|
|
||||||
SBoxExtents m_seExtents;
|
SBoxExtents m_seExtents;
|
||||||
|
|
||||||
PHLWINDOWREF m_pWindow;
|
PHLWINDOWREF m_pWindow;
|
||||||
|
@ -39,4 +41,6 @@ class CBordersPlusPlus : public IHyprWindowDecoration {
|
||||||
Vector2D m_vLastWindowSize;
|
Vector2D m_vLastWindowSize;
|
||||||
|
|
||||||
double m_fLastThickness = 0;
|
double m_fLastThickness = 0;
|
||||||
|
|
||||||
|
friend class CBorderPPPassElement;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue