use Hyprland internal CBox instead of wlr_box

This commit is contained in:
Arjun31415 2023-11-05 12:48:01 +05:30
parent f4081531bd
commit 575b616c1e
4 changed files with 14 additions and 11 deletions

6
flake.lock generated
View file

@ -9,11 +9,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1698945632,
"narHash": "sha256-D49t5G6JBDLRZv5nrMoOoC4J611z1S0LQ7RkNImpGI0=",
"lastModified": 1699144342,
"narHash": "sha256-QqWHFZCIyEKrMt0M/ErboC4uL3ASDNDDJjBw5O7MXhw=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "f10996b5753bfc854b019f6889d6bc0c91961e3f",
"rev": "3b786419d817a76b834d5e010afbed4d0cf98804",
"type": "github"
},
"original": {

View file

@ -1,6 +1,7 @@
#include <sstream>
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/helpers/Box.hpp>
#include <hyprland/src/plugins/PluginAPI.hpp>
#include "Hy3Node.hpp"
@ -354,7 +355,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
{
group->focused_child->setHidden(false);
auto box = wlr_box {tpos.x, tpos.y, tsize.x, tsize.y};
auto box = CBox {tpos.x, tpos.y, tsize.x, tsize.y};
g_pHyprRenderer->damageBox(&box);
}

View file

@ -2,6 +2,7 @@
#include <cairo/cairo.h>
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/helpers/Box.hpp>
#include <hyprland/src/helpers/Color.hpp>
#include <hyprland/src/render/OpenGL.hpp>
#include <pango/pangocairo.h>
@ -123,7 +124,7 @@ bool Hy3TabBarEntry::shouldRemove() {
return this->destroying && (this->vertical_pos.fl() == 1.0 || this->width.fl() == 0.0);
}
void Hy3TabBarEntry::prepareTexture(float scale, wlr_box& box) {
void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
// clang-format off
static const auto* s_rounding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue;
static const auto* render_text = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:render_text")->intValue;
@ -500,7 +501,7 @@ void Hy3TabGroup::tick() {
auto size = this->size.vec();
if (this->last_pos != pos || this->last_size != size) {
wlr_box damage_box = {this->last_pos.x, this->last_pos.y, this->last_size.x, this->last_size.y};
CBox damage_box = {this->last_pos.x, this->last_pos.y, this->last_size.x, this->last_size.y};
g_pHyprRenderer->damageBox(&damage_box);
this->bar.damaged = true;
@ -515,7 +516,7 @@ void Hy3TabGroup::tick() {
pos.y -= *padding;
}
wlr_box damage_box = {pos.x, pos.y, size.x, size.y};
CBox damage_box = {pos.x, pos.y, size.x, size.y};
g_pHyprRenderer->damageBox(&damage_box);
this->bar.damaged = true;
@ -589,8 +590,9 @@ void Hy3TabGroup::renderTabBar() {
auto wpos = window->m_vRealPosition.vec() - monitor->vecPosition;
auto wsize = window->m_vRealSize.vec();
wlr_box window_box = {wpos.x, wpos.y, wsize.x, wsize.y};
scaleBox(&window_box, scale);
CBox window_box = {wpos.x, wpos.y, wsize.x, wsize.y};
// scaleBox(&window_box, scale);
window_box.scale(scale);
if (window_box.width > 0 && window_box.height > 0)
g_pHyprOpenGL->renderRect(&window_box, CColor(0, 0, 0, 0), *window_rounding);
@ -616,7 +618,7 @@ void Hy3TabGroup::renderTabBar() {
Vector2D entry_size = {((entry.width.fl() * size.x) - *padding) * scale, scaled_size.y};
if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return;
wlr_box box = {
CBox box = {
entry_pos.x,
entry_pos.y,
entry_size.x,

View file

@ -54,7 +54,7 @@ struct Hy3TabBarEntry {
void beginDestroy();
void unDestroy();
bool shouldRemove();
void prepareTexture(float, wlr_box&);
void prepareTexture(float, CBox&);
};
class Hy3TabBar {