Layer audioflyin on top of fullscreen windows

LAYER_TOP (The previously hardcoded layer) draws below fullscreen
windows (at least on Hyprland). For the flyin we want it to be always on
top, so LAYER_OVERLAY is used instead now.
This commit is contained in:
scorpion-26 2023-10-21 16:40:41 +02:00
parent 3a0b0e0699
commit b19b091c92
3 changed files with 17 additions and 1 deletions

View file

@ -150,6 +150,8 @@ namespace AudioFlyin
padding = Widget::Create<Box>();
mainWidget->AddChild(std::move(padding));
// We want the audio flyin on top of fullscreen windows
window.SetLayer(Layer::Overlay);
window.SetExclusive(false);
window.SetAnchor(Anchor::Bottom);
window.SetMainWidget(std::move(mainWidget));

View file

@ -48,7 +48,13 @@ void Window::Run()
m_Window = (GtkWindow*)gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_layer_init_for_window(m_Window);
gtk_layer_set_layer(m_Window, GTK_LAYER_SHELL_LAYER_TOP);
switch (m_Layer)
{
case Layer::Top: gtk_layer_set_layer(m_Window, GTK_LAYER_SHELL_LAYER_TOP); break;
case Layer::Overlay: gtk_layer_set_layer(m_Window, GTK_LAYER_SHELL_LAYER_OVERLAY); break;
}
if (m_Exclusive)
gtk_layer_auto_exclusive_zone_enable(m_Window);

View file

@ -12,6 +12,12 @@ enum class Anchor
};
DEFINE_ENUM_FLAGS(Anchor);
enum class Layer
{
Top,
Overlay
};
class Window
{
public:
@ -29,6 +35,7 @@ public:
void SetAnchor(Anchor anchor) { m_Anchor = anchor; }
void SetMargin(Anchor anchor, int32_t margin);
void SetExclusive(bool exclusive) { m_Exclusive = exclusive; }
void SetLayer(Layer layer) { m_Layer = layer;}
void SetMainWidget(std::unique_ptr<Widget>&& mainWidget);
@ -47,6 +54,7 @@ private:
Anchor m_Anchor;
std::array<std::pair<Anchor, int32_t>, 4> m_Margin;
bool m_Exclusive = true;
Layer m_Layer = Layer::Top;
int32_t m_MonitorID;
GdkMonitor* m_Monitor = nullptr;