diff --git a/xembed-sni-proxy/fdoselectionmanager.h b/xembed-sni-proxy/fdoselectionmanager.h --- a/xembed-sni-proxy/fdoselectionmanager.h +++ b/xembed-sni-proxy/fdoselectionmanager.h @@ -51,7 +51,7 @@ bool addDamageWatch(xcb_window_t client); void dock(xcb_window_t embed_win); void undock(xcb_window_t client); - void compositingChanged(); + void setSystemTrayVisual(); uint8_t m_damageEventBase; diff --git a/xembed-sni-proxy/fdoselectionmanager.cpp b/xembed-sni-proxy/fdoselectionmanager.cpp --- a/xembed-sni-proxy/fdoselectionmanager.cpp +++ b/xembed-sni-proxy/fdoselectionmanager.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -187,8 +186,7 @@ { qCDebug(SNIPROXY) << "Manager selection claimed"; - connect(KWindowSystem::self(), &KWindowSystem::compositingChanged, this, &FdoSelectionManager::compositingChanged); - compositingChanged(); + setSystemTrayVisual(); } void FdoSelectionManager::onFailedToClaimOwnership() @@ -200,37 +198,34 @@ void FdoSelectionManager::onLostOwnership() { qCWarning(SNIPROXY) << "lost ownership of Systray Manager"; - disconnect(KWindowSystem::self(), &KWindowSystem::compositingChanged, this, &FdoSelectionManager::compositingChanged); qApp->exit(-1); } -void FdoSelectionManager::compositingChanged() +void FdoSelectionManager::setSystemTrayVisual() { xcb_connection_t *c = QX11Info::connection(); auto screen = xcb_setup_roots_iterator(xcb_get_setup(c)).data; auto trayVisual = screen->root_visual; - if (KWindowSystem::compositingActive()) { - xcb_depth_iterator_t depth_iterator = xcb_screen_allowed_depths_iterator(screen); - xcb_depth_t *depth = nullptr; + xcb_depth_iterator_t depth_iterator = xcb_screen_allowed_depths_iterator(screen); + xcb_depth_t *depth = nullptr; - while (depth_iterator.rem) { - if (depth_iterator.data->depth == 32) { - depth = depth_iterator.data; - break; - } - xcb_depth_next(&depth_iterator); + while (depth_iterator.rem) { + if (depth_iterator.data->depth == 32) { + depth = depth_iterator.data; + break; } + xcb_depth_next(&depth_iterator); + } - if (depth) { - xcb_visualtype_iterator_t visualtype_iterator = xcb_depth_visuals_iterator(depth); - while (visualtype_iterator.rem) { - xcb_visualtype_t *visualtype = visualtype_iterator.data; - if (visualtype->_class == XCB_VISUAL_CLASS_TRUE_COLOR) { - trayVisual = visualtype->visual_id; - break; - } - xcb_visualtype_next(&visualtype_iterator); + if (depth) { + xcb_visualtype_iterator_t visualtype_iterator = xcb_depth_visuals_iterator(depth); + while (visualtype_iterator.rem) { + xcb_visualtype_t *visualtype = visualtype_iterator.data; + if (visualtype->_class == XCB_VISUAL_CLASS_TRUE_COLOR) { + trayVisual = visualtype->visual_id; + break; } + xcb_visualtype_next(&visualtype_iterator); } }