From d78601b5c8b89011402a2c268710e10474c047bb Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 28 May 2023 17:15:39 -0700 Subject: [PATCH] Correctly handle small tab bar sizes --- src/TabGroup.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp index 077623d..81fcfbb 100644 --- a/src/TabGroup.cpp +++ b/src/TabGroup.cpp @@ -22,11 +22,12 @@ bool Hy3TabBarEntry::operator==(const Hy3Node& node) const { void Hy3TabBarEntry::prepareTexture(float scale, Vector2D size) { static const auto* rounding_setting = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue; - auto rounding = *rounding_setting; auto width = size.x * scale; auto height = size.y * scale; + auto rounding = std::min((double) *rounding_setting, std::min(width * 0.5, height * 0.5)); + if (this->needs_redraw || this->texture.m_iTexID == 0 || this->last_render_rounding == rounding @@ -302,6 +303,8 @@ void Hy3TabGroup::renderTabBar() { auto render_entry = [&](Hy3TabBarEntry& entry) { Vector2D entry_size = { (entry.width.fl() * size.x) - *padding, size.y }; + if (entry_size.x < 0 || entry_size.y < 0) return; + entry.prepareTexture(scale, entry_size); wlr_box box = {