Skip to content

Commit

Permalink
Port deprecated KWindowSystem
Browse files Browse the repository at this point in the history
Bump KF5 minimum version to 5.101.0. KX11Extras was introduced on that
version.
  • Loading branch information
luis-pereira committed May 25, 2023
1 parent 7eaea6c commit fae2576
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(liblxqt)


set(LXQTBT_MINIMUM_VERSION "0.13.0")
set(KF5_MINIMUM_VERSION "5.36.0")
set(KF5_MINIMUM_VERSION "5.101.0")
set(QT_MINIMUM_VERSION "5.15.0")
set(QTXDG_MINIMUM_VERSION "3.11.0")

Expand Down
12 changes: 8 additions & 4 deletions lxqtsingleapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "lxqtsingleapplication.h"
#include "singleapplicationadaptor.h"
#include <KWindowSystem/KWindowSystem>
#include <KWindowSystem/KX11Extras>
#include <QDBusMessage>
#include <QWidget>
#include <QDebug>
Expand Down Expand Up @@ -95,13 +96,16 @@ void SingleApplication::activateWindow()
if (mActivationWindow) {
mActivationWindow->show();
WId window = mActivationWindow->effectiveWinId();

KWindowInfo info(window, KWindowSystem::WMDesktop);
int windowDesktop = info.desktop();

if (windowDesktop != KWindowSystem::currentDesktop())
KWindowSystem::setCurrentDesktop(windowDesktop);
KWindowSystem::activateWindow(window);
if (windowDesktop != KX11Extras::currentDesktop())
KX11Extras::setCurrentDesktop(windowDesktop);

if (QWindow *w = mActivationWindow->windowHandle())
KWindowSystem::activateWindow(w);
else
qDebug() << Q_FUNC_INFO << "Got null windowHandle";
} else {
qDebug() << Q_FUNC_INFO << "activationWindow not set or null";
}
Expand Down

0 comments on commit fae2576

Please sign in to comment.