aboutsummaryrefslogtreecommitdiff
path: root/src/gui/List.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-16 18:07:01 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-16 18:07:01 +0100
commitc5162dbb45e66e7fd25430c9417a8e6a6b78080c (patch)
treeaa83462b1b15c2b9930ea7342f7af7d0717d4115 /src/gui/List.cpp
parente0ddfa82dd585fe33cb5dc397ad418f336c56724 (diff)
Only show app audio option if using pipewire
Diffstat (limited to 'src/gui/List.cpp')
-rw-r--r--src/gui/List.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/List.cpp b/src/gui/List.cpp
index 510de6b..5294e36 100644
--- a/src/gui/List.cpp
+++ b/src/gui/List.cpp
@@ -45,6 +45,7 @@ namespace gsr {
const mgl::vec2f parent_inner_size = parent_widget ? parent_widget->get_inner_size() : mgl::vec2f(0.0f, 0.0f);
const float spacing = floor(spacing_scale * get_theme().window_height);
+ bool first_visible_widget = true;
switch(orientation) {
case Orientation::VERTICAL: {
for(size_t i = 0; i < widgets.size(); ++i) {
@@ -52,8 +53,9 @@ namespace gsr {
if(!widget->visible)
continue;
- if(i > 0)
+ if(!first_visible_widget)
draw_pos.y += spacing;
+ first_visible_widget = false;
const auto widget_size = widget->get_size();
// TODO: Do this parent widget alignment for horizontal alignment and for other types of widget alignment
@@ -79,8 +81,9 @@ namespace gsr {
if(!widget->visible)
continue;
- if(i > 0)
+ if(!first_visible_widget)
draw_pos.x += spacing;
+ first_visible_widget = false;
const auto widget_size = widget->get_size();
if(content_alignment == Alignment::CENTER)
@@ -145,6 +148,7 @@ namespace gsr {
mgl::vec2f size;
const float spacing = floor(spacing_scale * get_theme().window_height);
+ bool first_visible_widget = true;
switch(orientation) {
case Orientation::VERTICAL: {
for(size_t i = 0; i < widgets.size(); ++i) {
@@ -152,8 +156,9 @@ namespace gsr {
if(!widget->visible)
continue;
- if(i > 0)
+ if(!first_visible_widget)
size.y += spacing;
+ first_visible_widget = false;
const auto widget_size = widget->get_size();
size.x = std::max(size.x, widget_size.x);
@@ -167,8 +172,9 @@ namespace gsr {
if(!widget->visible)
continue;
- if(i > 0)
+ if(!first_visible_widget)
size.x += spacing;
+ first_visible_widget = false;
const auto widget_size = widget->get_size();
size.x += widget_size.x;