Port away from deprecated KWindowSystem API

This commit is contained in:
Nicolas Fella 2022-12-01 02:15:26 +01:00 committed by Vlad Zahorodnii
parent 1d640cc013
commit a6a022f00f
2 changed files with 8 additions and 8 deletions

View file

@ -15,7 +15,7 @@
#include "workspace.h"
#include "x11window.h"
#include <KWindowSystem>
#include <KX11Extras>
#include <QDebug>
namespace KWin
@ -51,7 +51,7 @@ QIcon Group::icon() const
QIcon ic;
NETWinInfo info(kwinApp()->x11Connection(), leader_wid, kwinApp()->x11RootWindow(), NET::WMIcon, NET::WM2IconPixmap);
auto readIcon = [&ic, &info, this](int size, bool scale = true) {
const QPixmap pix = KWindowSystem::icon(leader_wid, size, size, scale, KWindowSystem::NETWM | KWindowSystem::WMHints, &info);
const QPixmap pix = KX11Extras::icon(leader_wid, size, size, scale, KX11Extras::NETWM | KX11Extras::WMHints, &info);
if (!pix.isNull()) {
ic.addPixmap(pix);
}

View file

@ -38,7 +38,7 @@
// KDE
#include <KLocalizedString>
#include <KStartupInfo>
#include <KWindowSystem>
#include <KX11Extras>
// Qt
#include <QApplication>
#include <QDebug>
@ -2283,7 +2283,7 @@ void X11Window::getIcons()
}
QIcon icon;
auto readIcon = [this, &icon](int size, bool scale = true) {
const QPixmap pix = KWindowSystem::icon(window(), size, size, scale, KWindowSystem::NETWM | KWindowSystem::WMHints, info);
const QPixmap pix = KX11Extras::icon(window(), size, size, scale, KX11Extras::NETWM | KX11Extras::WMHints, info);
if (!pix.isNull()) {
icon.addPixmap(pix);
}
@ -2309,10 +2309,10 @@ void X11Window::getIcons()
}
if (icon.isNull()) {
// And if nothing else, load icon from classhint or xapp icon
icon.addPixmap(KWindowSystem::icon(window(), 32, 32, true, KWindowSystem::ClassHint | KWindowSystem::XApp, info));
icon.addPixmap(KWindowSystem::icon(window(), 16, 16, true, KWindowSystem::ClassHint | KWindowSystem::XApp, info));
icon.addPixmap(KWindowSystem::icon(window(), 64, 64, false, KWindowSystem::ClassHint | KWindowSystem::XApp, info));
icon.addPixmap(KWindowSystem::icon(window(), 128, 128, false, KWindowSystem::ClassHint | KWindowSystem::XApp, info));
icon.addPixmap(KX11Extras::icon(window(), 32, 32, true, KX11Extras::ClassHint | KX11Extras::XApp, info));
icon.addPixmap(KX11Extras::icon(window(), 16, 16, true, KX11Extras::ClassHint | KX11Extras::XApp, info));
icon.addPixmap(KX11Extras::icon(window(), 64, 64, false, KX11Extras::ClassHint | KX11Extras::XApp, info));
icon.addPixmap(KX11Extras::icon(window(), 128, 128, false, KX11Extras::ClassHint | KX11Extras::XApp, info));
}
setIcon(icon);
}