d78601b5c8b89011402a2c268710e10474c047bb

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

Correctly handle small tab bar sizes

Diff

 1diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
 2index 077623da71aa966e2e07042f8243f0b6b2b9dc58..81fcfbbf02aaa38d1e8a93105259519e0ed2be1b 100644
 3--- a/src/TabGroup.cpp
 4+++ b/src/TabGroup.cpp
 5@@ -22,11 +22,12 @@ bool Hy3TabBarEntry::operator==(const Hy3Node& node) const {
 6 
 7 void Hy3TabBarEntry::prepareTexture(float scale, Vector2D size) {
 8 	static const auto* rounding_setting = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue;
 9-	auto rounding = *rounding_setting;
10 
11 	auto width = size.x * scale;
12 	auto height = size.y * scale;
13 
14+	auto rounding = std::min((double) *rounding_setting, std::min(width * 0.5, height * 0.5));
15+
16 	if (this->needs_redraw
17 			|| this->texture.m_iTexID == 0
18 			|| this->last_render_rounding == rounding
19@@ -302,6 +303,8 @@ void Hy3TabGroup::renderTabBar() {
20 
21 	auto render_entry = [&](Hy3TabBarEntry& entry) {
22 		Vector2D entry_size = { (entry.width.fl() * size.x) - *padding, size.y };
23+		if (entry_size.x < 0 || entry_size.y < 0) return;
24+
25 		entry.prepareTexture(scale, entry_size);
26 
27 		wlr_box box = {