Commit 29554d56 authored by Konrad Materka's avatar Konrad Materka

[XembedSNIProxy] If available, always use 32-bit color.

Summary:
If available, always use 32-bit color. We don't need Composite extension to handle transparency - all client windows are our children and transparency in handled in QML, inside the panel (so no need to composite real windows).

BUG: 356937
FIXED-IN: 5.17.1

Test Plan:
Disable compositor, run:
  - pidgin (make sure pidgin-libnotify is NOT installed)
  - keepassx
  - xchat
  - liferea

Before changes: black backgroud
After changes: transparent background

Reviewers: davidedmundson, #plasma_workspaces, #plasma

Reviewed By: davidedmundson, #plasma_workspaces, #plasma

Subscribers: mlaurent, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24530
parent 726262b9
......@@ -28,7 +28,6 @@
#include <QTextDocument>
#include <QX11Info>
#include <KWindowSystem>
#include <KSelectionOwner>
#include <xcb/xcb.h>
......@@ -187,8 +186,7 @@ void FdoSelectionManager::onClaimedOwnership()
{
qCDebug(SNIPROXY) << "Manager selection claimed";
connect(KWindowSystem::self(), &KWindowSystem::compositingChanged, this, &FdoSelectionManager::compositingChanged);
compositingChanged();
setSystemTrayVisual();
}
void FdoSelectionManager::onFailedToClaimOwnership()
......@@ -200,37 +198,34 @@ void FdoSelectionManager::onFailedToClaimOwnership()
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);
}
}
......
......@@ -51,7 +51,7 @@ private:
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment