From 7049c755c5cfd8156c4bc1b459c864935eeef4f3 Mon Sep 17 00:00:00 2001 From: patrick96 Date: Sun, 16 Oct 2022 21:31:24 +0200 Subject: [PATCH] --wip-- [skip ci] tray experiments --- src/x11/tray_client.cpp | 19 +++++++++++++++++++ src/x11/tray_manager.cpp | 11 ++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/x11/tray_client.cpp b/src/x11/tray_client.cpp index 30b3d706..916939df 100644 --- a/src/x11/tray_client.cpp +++ b/src/x11/tray_client.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "utils/memory.hpp" #include "x11/connection.hpp" @@ -136,6 +137,19 @@ void tray_client::clear_window() const { // Do not produce Expose events for the embedder because that triggers an infinite loop. m_connection.clear_area_checked(0, embedder(), 0, 0, width(), height()); + + auto send_visibility = [&](uint8_t state) { + xcb_visibility_notify_event_t evt{}; + evt.response_type = XCB_VISIBILITY_NOTIFY; + evt.window = client(); + evt.state = state; + + m_connection.send_event_checked(true, client(), XCB_EVENT_MASK_NO_EVENT, reinterpret_cast(&evt)); + }; + + send_visibility(XCB_VISIBILITY_FULLY_OBSCURED); + send_visibility(XCB_VISIBILITY_UNOBSCURED); + m_connection.clear_area_checked(1, client(), 0, 0, width(), height()); } @@ -300,6 +314,11 @@ void tray_client::set_position(int x, int y) { connection::pack_values(configure_mask, &configure_params, configure_values); m_connection.configure_window_checked(client(), configure_mask, configure_values.data()); + // TODO + xcb_size_hints_t size_hints{}; + xcb_icccm_size_hints_set_size(&size_hints, false, m_size.w, m_size.h); + xcb_icccm_set_wm_size_hints(m_connection, client(), XCB_ATOM_WM_NORMAL_HINTS, &size_hints); + // The position has changed, we need a new background slice. observe_background(); } diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp index dbb34b42..cf06962c 100644 --- a/src/x11/tray_manager.cpp +++ b/src/x11/tray_manager.cpp @@ -156,13 +156,14 @@ void tray_manager::activate() { m_state = state::ACTIVE; + notify_clients(); // Send delayed notification // TODO try to remove this? - if (!m_firstactivation) { - notify_clients(); - } else { - notify_clients_delayed(); - } + // if (!m_firstactivation) { + // notify_clients(); + // } else { + // notify_clients_delayed(); + // } m_firstactivation = false; }