Skip to content

Commit

Permalink
use Hyprland internal CBox instead of wlr_box
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjun31415 committed Nov 5, 2023
1 parent f408153 commit 575b616
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/Hy3Node.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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);
}

Expand Down
14 changes: 8 additions & 6 deletions src/TabGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/TabGroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct Hy3TabBarEntry {
void beginDestroy();
void unDestroy();
bool shouldRemove();
void prepareTexture(float, wlr_box&);
void prepareTexture(float, CBox&);
};

class Hy3TabBar {
Expand Down

0 comments on commit 575b616

Please sign in to comment.