From bcd1774370c9f58c8b1df6ef75fb88539638abd3 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Sat, 15 Oct 2016 13:59:16 +0200 Subject: [PATCH] fix(tray): Put tray above bar in the window stack Closes jaagr/lemonbuddy#94 --- include/components/bar.hpp | 2 ++ include/components/types.hpp | 2 ++ include/components/x11/tray.hpp | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/include/components/bar.hpp b/include/components/bar.hpp index 51aaaf57..924b4d7c 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -465,6 +465,8 @@ class bar : public xpp::event::sink { m_tray.orig_x = m_bar.x + m_borders.at(border::LEFT).size; } + m_tray.sibling = m_window; + // }}} // Connect signal handlers {{{ diff --git a/include/components/types.hpp b/include/components/types.hpp index f6944c03..c1d66167 100644 --- a/include/components/types.hpp +++ b/include/components/types.hpp @@ -71,6 +71,7 @@ struct tray_settings { height = o.height; spacing = o.spacing; slots = o.slots; + sibling = o.sibling; return *this; } @@ -82,6 +83,7 @@ struct tray_settings { uint16_t height{0}; uint16_t spacing{0}; uint16_t slots{0}; + uint32_t sibling; }; struct border_settings { diff --git a/include/components/x11/tray.hpp b/include/components/x11/tray.hpp index b66fe63a..1d30b703 100644 --- a/include/components/x11/tray.hpp +++ b/include/components/x11/tray.hpp @@ -324,6 +324,14 @@ class traymanager m_connection.create_window_checked(scr->root_depth, m_tray, scr->root, x, y, m_settings.width + m_settings.spacing * 2, m_settings.height + m_settings.spacing * 2, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr->root_visual, mask, values); + + // Put the tray window above the defined sibling in the window stack + if (m_settings.sibling != XCB_NONE) { + const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE; + const uint32_t value_list[2]{m_settings.sibling, XCB_STACK_MODE_ABOVE}; + m_connection.configure_window_checked(m_tray, value_mask, value_list); + m_connection.flush(); + } } /**