575b616c1e24f3aa4b4eda049e7bfa205c9a8ea7

Author
Arjun31415 <arjunp0710@gmail.com>
Committer
Arjun31415 <arjunp0710@gmail.com>
Date

Message

use Hyprland internal CBox instead of wlr_box

Diff

  1diff --git a/flake.lock b/flake.lock
  2index ef5e1264a401a9180cff31b1730483f0ebb1f5c4..8cb6ce619bc24835d870898069b79aadf55bd3f6 100644
  3--- a/flake.lock
  4+++ b/flake.lock
  5@@ -9,11 +9,11 @@
  6         "xdph": "xdph"
  7       },
  8       "locked": {
  9-        "lastModified": 1698945632,
 10-        "narHash": "sha256-D49t5G6JBDLRZv5nrMoOoC4J611z1S0LQ7RkNImpGI0=",
 11+        "lastModified": 1699144342,
 12+        "narHash": "sha256-QqWHFZCIyEKrMt0M/ErboC4uL3ASDNDDJjBw5O7MXhw=",
 13         "owner": "hyprwm",
 14         "repo": "Hyprland",
 15-        "rev": "f10996b5753bfc854b019f6889d6bc0c91961e3f",
 16+        "rev": "3b786419d817a76b834d5e010afbed4d0cf98804",
 17         "type": "github"
 18       },
 19       "original": {
 20diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
 21index 33c56637bda1df31169fe70fa4237ee1405f3544..99c2b47b98306087229e71f9d298864daaf42ff0 100644
 22--- a/src/Hy3Node.cpp
 23+++ b/src/Hy3Node.cpp
 24@@ -1,6 +1,7 @@
 25 #include <sstream>
 26 
 27 #include <hyprland/src/Compositor.hpp>
 28+#include <hyprland/src/helpers/Box.hpp>
 29 #include <hyprland/src/plugins/PluginAPI.hpp>
 30 
 31 #include "Hy3Node.hpp"
 32@@ -354,7 +355,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
 33 	{
 34 		group->focused_child->setHidden(false);
 35 
 36-		auto box = wlr_box {tpos.x, tpos.y, tsize.x, tsize.y};
 37+		auto box = CBox {tpos.x, tpos.y, tsize.x, tsize.y};
 38 		g_pHyprRenderer->damageBox(&box);
 39 	}
 40 
 41diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
 42index afa40d5ce1e915505f123f186fbc822bfd5feb0e..28ced1d4fad3599a4f00016b6d5346a62506a90b 100644
 43--- a/src/TabGroup.cpp
 44+++ b/src/TabGroup.cpp
 45@@ -2,6 +2,7 @@
 46 
 47 #include <cairo/cairo.h>
 48 #include <hyprland/src/Compositor.hpp>
 49+#include <hyprland/src/helpers/Box.hpp>
 50 #include <hyprland/src/helpers/Color.hpp>
 51 #include <hyprland/src/render/OpenGL.hpp>
 52 #include <pango/pangocairo.h>
 53@@ -123,7 +124,7 @@ bool Hy3TabBarEntry::shouldRemove() {
 54 	return this->destroying && (this->vertical_pos.fl() == 1.0 || this->width.fl() == 0.0);
 55 }
 56 
 57-void Hy3TabBarEntry::prepareTexture(float scale, wlr_box& box) {
 58+void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
 59 	// clang-format off
 60 	static const auto* s_rounding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue;
 61 	static const auto* render_text = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:render_text")->intValue;
 62@@ -500,7 +501,7 @@ void Hy3TabGroup::tick() {
 63 	auto size = this->size.vec();
 64 
 65 	if (this->last_pos != pos || this->last_size != size) {
 66-		wlr_box damage_box = {this->last_pos.x, this->last_pos.y, this->last_size.x, this->last_size.y};
 67+		CBox damage_box = {this->last_pos.x, this->last_pos.y, this->last_size.x, this->last_size.y};
 68 		g_pHyprRenderer->damageBox(&damage_box);
 69 
 70 		this->bar.damaged = true;
 71@@ -515,7 +516,7 @@ void Hy3TabGroup::tick() {
 72 			pos.y -= *padding;
 73 		}
 74 
 75-		wlr_box damage_box = {pos.x, pos.y, size.x, size.y};
 76+		CBox damage_box = {pos.x, pos.y, size.x, size.y};
 77 		g_pHyprRenderer->damageBox(&damage_box);
 78 
 79 		this->bar.damaged = true;
 80@@ -589,8 +590,9 @@ void Hy3TabGroup::renderTabBar() {
 81 			auto wpos = window->m_vRealPosition.vec() - monitor->vecPosition;
 82 			auto wsize = window->m_vRealSize.vec();
 83 
 84-			wlr_box window_box = {wpos.x, wpos.y, wsize.x, wsize.y};
 85-			scaleBox(&window_box, scale);
 86+			CBox window_box = {wpos.x, wpos.y, wsize.x, wsize.y};
 87+			// scaleBox(&window_box, scale);
 88+			window_box.scale(scale);
 89 
 90 			if (window_box.width > 0 && window_box.height > 0)
 91 				g_pHyprOpenGL->renderRect(&window_box, CColor(0, 0, 0, 0), *window_rounding);
 92@@ -616,7 +618,7 @@ void Hy3TabGroup::renderTabBar() {
 93 		Vector2D entry_size = {((entry.width.fl() * size.x) - *padding) * scale, scaled_size.y};
 94 		if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return;
 95 
 96-		wlr_box box = {
 97+		CBox box = {
 98 		    entry_pos.x,
 99 		    entry_pos.y,
100 		    entry_size.x,
101diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
102index e0deb481e768d9e943bc6f7d25cc12aa59362c12..6cf92c7af9bbc78668d80221416f4d3f4b4de69f 100644
103--- a/src/TabGroup.hpp
104+++ b/src/TabGroup.hpp
105@@ -54,7 +54,7 @@ struct Hy3TabBarEntry {
106 	void beginDestroy();
107 	void unDestroy();
108 	bool shouldRemove();
109-	void prepareTexture(float, wlr_box&);
110+	void prepareTexture(float, CBox&);
111 };
112 
113 class Hy3TabBar {