From def2682b8c001c907a354b77c343e93713df307c Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 26 Sep 2022 21:39:10 +0200
Subject: [PATCH] tray: Set _NET_SYSTEM_TRAY_VISUAL
---
include/x11/tray_manager.hpp | 1 +
src/components/renderer.cpp | 1 +
src/x11/tray_client.cpp | 1 +
src/x11/tray_manager.cpp | 9 +++++++++
4 files changed, 12 insertions(+)
diff --git a/include/x11/tray_manager.hpp b/include/x11/tray_manager.hpp
index ead438ff..4b27fd41 100644
--- a/include/x11/tray_manager.hpp
+++ b/include/x11/tray_manager.hpp
@@ -92,6 +92,7 @@ class tray_manager : public xpp::event::sinkflush();
m_connection.clear_area(0, m_window, 0, 0, m_bar.size.w, m_bar.size.h);
+ // TODO
// m_connection.copy_area(m_pixmap, m_window, m_gcontext, 0, 0, 0, 0, m_bar.size.w, m_bar.size.h);
m_connection.flush();
diff --git a/src/x11/tray_client.cpp b/src/x11/tray_client.cpp
index b13d0d07..76788373 100644
--- a/src/x11/tray_client.cpp
+++ b/src/x11/tray_client.cpp
@@ -82,6 +82,7 @@ unsigned int tray_client::height() const {
}
void tray_client::clear_window() const {
+ m_connection.clear_area_checked(1, embedder(), 0, 0, width(), height());
m_connection.clear_area_checked(1, client(), 0, 0, width(), height());
}
diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp
index 4916dc68..0c7f94e6 100644
--- a/src/x11/tray_manager.cpp
+++ b/src/x11/tray_manager.cpp
@@ -132,6 +132,7 @@ void tray_manager::activate() {
try {
set_tray_colors();
set_tray_orientation();
+ set_tray_visual();
} catch (const exception& err) {
m_log.err(err.what());
m_log.err("Cannot activate tray manager... failed to setup window");
@@ -370,6 +371,14 @@ void tray_manager::set_tray_orientation() {
XCB_ATOM_CARDINAL, 32, 1, &orientation);
}
+void tray_manager::set_tray_visual() {
+ // TODO use bar visual
+ const uint32_t visualid = m_connection.visual_type(XCB_VISUAL_CLASS_TRUE_COLOR, 32)->visual_id;
+ m_log.trace("tray: Set _NET_SYSTEM_TRAY_VISUAL to 0x%x", visualid);
+ m_connection.change_property_checked(
+ XCB_PROP_MODE_REPLACE, m_opts.selection_owner, _NET_SYSTEM_TRAY_VISUAL, XCB_ATOM_VISUALID, 32, 1, &visualid);
+}
+
/**
* Acquire the systray selection
*