From 4fa01583cb6a46548944f060c9fe6246145a424e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 16 Sep 2015 13:51:44 +0200 Subject: [PATCH] [backends/x11] Use NETWinInfo for our window. --- backends/x11/x11windowed_backend.cpp | 23 +++++++++++++++++++++++ backends/x11/x11windowed_backend.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/backends/x11/x11windowed_backend.cpp b/backends/x11/x11windowed_backend.cpp index 03db04b84f..9f88b83757 100644 --- a/backends/x11/x11windowed_backend.cpp +++ b/backends/x11/x11windowed_backend.cpp @@ -25,11 +25,14 @@ along with this program. If not, see . #include "xcbutils.h" #include "eglonxbackend.h" #include +// KDE +#include #include #include #include // kwayland #include +#include #include #include // system @@ -115,6 +118,26 @@ void X11WindowedBackend::createWindow() xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_window, m_screen->root, 0, 0, m_size.width(), m_size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, mask, values); + + m_winInfo = new NETWinInfo(m_connection, m_window, m_screen->root, NET::WMWindowType, NET::Properties2()); + m_winInfo->setWindowType(NET::Normal); + m_winInfo->setName(i18n("KDE Wayland Compositor (%1)", waylandServer()->display()->socketName()).toUtf8().constData()); + m_winInfo->setPid(QCoreApplication::applicationPid()); + QIcon windowIcon = QIcon::fromTheme(QStringLiteral("kwin")); + auto addIcon = [this, &windowIcon] (const QSize &size) { + if (windowIcon.actualSize(size) != size) { + return; + } + NETIcon icon; + icon.data = windowIcon.pixmap(size).toImage().bits(); + icon.size.width = size.width(); + icon.size.height = size.height(); + m_winInfo->setIcon(icon, false); + }; + addIcon(QSize(16, 16)); + addIcon(QSize(32, 32)); + addIcon(QSize(48, 48)); + xcb_map_window(m_connection, m_window); m_protocols = protocolsAtom; diff --git a/backends/x11/x11windowed_backend.h b/backends/x11/x11windowed_backend.h index e8c3a01b19..c2ac8634aa 100644 --- a/backends/x11/x11windowed_backend.h +++ b/backends/x11/x11windowed_backend.h @@ -30,6 +30,7 @@ along with this program. If not, see . struct _XDisplay; typedef struct _XDisplay Display; +class NETWinInfo; namespace KWin { @@ -93,6 +94,7 @@ private: xcb_atom_t m_deleteWindowProtocol = XCB_ATOM_NONE; xcb_cursor_t m_cursor = XCB_CURSOR_NONE; Display *m_display = nullptr; + NETWinInfo *m_winInfo = nullptr; }; }