mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
use Hyprland internal CBox instead of wlr_box
This commit is contained in:
parent
f4081531bd
commit
575b616c1e
4 changed files with 14 additions and 11 deletions
6
flake.lock
generated
6
flake.lock
generated
|
@ -9,11 +9,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1698945632,
|
"lastModified": 1699144342,
|
||||||
"narHash": "sha256-D49t5G6JBDLRZv5nrMoOoC4J611z1S0LQ7RkNImpGI0=",
|
"narHash": "sha256-QqWHFZCIyEKrMt0M/ErboC4uL3ASDNDDJjBw5O7MXhw=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "Hyprland",
|
"repo": "Hyprland",
|
||||||
"rev": "f10996b5753bfc854b019f6889d6bc0c91961e3f",
|
"rev": "3b786419d817a76b834d5e010afbed4d0cf98804",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <hyprland/src/Compositor.hpp>
|
#include <hyprland/src/Compositor.hpp>
|
||||||
|
#include <hyprland/src/helpers/Box.hpp>
|
||||||
#include <hyprland/src/plugins/PluginAPI.hpp>
|
#include <hyprland/src/plugins/PluginAPI.hpp>
|
||||||
|
|
||||||
#include "Hy3Node.hpp"
|
#include "Hy3Node.hpp"
|
||||||
|
@ -354,7 +355,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
{
|
{
|
||||||
group->focused_child->setHidden(false);
|
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);
|
g_pHyprRenderer->damageBox(&box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
#include <hyprland/src/Compositor.hpp>
|
#include <hyprland/src/Compositor.hpp>
|
||||||
|
#include <hyprland/src/helpers/Box.hpp>
|
||||||
#include <hyprland/src/helpers/Color.hpp>
|
#include <hyprland/src/helpers/Color.hpp>
|
||||||
#include <hyprland/src/render/OpenGL.hpp>
|
#include <hyprland/src/render/OpenGL.hpp>
|
||||||
#include <pango/pangocairo.h>
|
#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);
|
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
|
// clang-format off
|
||||||
static const auto* s_rounding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue;
|
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;
|
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();
|
auto size = this->size.vec();
|
||||||
|
|
||||||
if (this->last_pos != pos || this->last_size != size) {
|
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);
|
g_pHyprRenderer->damageBox(&damage_box);
|
||||||
|
|
||||||
this->bar.damaged = true;
|
this->bar.damaged = true;
|
||||||
|
@ -515,7 +516,7 @@ void Hy3TabGroup::tick() {
|
||||||
pos.y -= *padding;
|
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);
|
g_pHyprRenderer->damageBox(&damage_box);
|
||||||
|
|
||||||
this->bar.damaged = true;
|
this->bar.damaged = true;
|
||||||
|
@ -589,8 +590,9 @@ void Hy3TabGroup::renderTabBar() {
|
||||||
auto wpos = window->m_vRealPosition.vec() - monitor->vecPosition;
|
auto wpos = window->m_vRealPosition.vec() - monitor->vecPosition;
|
||||||
auto wsize = window->m_vRealSize.vec();
|
auto wsize = window->m_vRealSize.vec();
|
||||||
|
|
||||||
wlr_box window_box = {wpos.x, wpos.y, wsize.x, wsize.y};
|
CBox window_box = {wpos.x, wpos.y, wsize.x, wsize.y};
|
||||||
scaleBox(&window_box, scale);
|
// scaleBox(&window_box, scale);
|
||||||
|
window_box.scale(scale);
|
||||||
|
|
||||||
if (window_box.width > 0 && window_box.height > 0)
|
if (window_box.width > 0 && window_box.height > 0)
|
||||||
g_pHyprOpenGL->renderRect(&window_box, CColor(0, 0, 0, 0), *window_rounding);
|
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};
|
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;
|
if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return;
|
||||||
|
|
||||||
wlr_box box = {
|
CBox box = {
|
||||||
entry_pos.x,
|
entry_pos.x,
|
||||||
entry_pos.y,
|
entry_pos.y,
|
||||||
entry_size.x,
|
entry_size.x,
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct Hy3TabBarEntry {
|
||||||
void beginDestroy();
|
void beginDestroy();
|
||||||
void unDestroy();
|
void unDestroy();
|
||||||
bool shouldRemove();
|
bool shouldRemove();
|
||||||
void prepareTexture(float, wlr_box&);
|
void prepareTexture(float, CBox&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Hy3TabBar {
|
class Hy3TabBar {
|
||||||
|
|
Loading…
Add table
Reference in a new issue