Skip to content

Commit

Permalink
Decide QT and KF versions based on KWin (#263)
Browse files Browse the repository at this point in the history
* Decide QT and KF versions based on KWin
* Fix private literal QString in KF6
  • Loading branch information
matinlotfali authored Aug 6, 2024
1 parent 4c7ff62 commit 8464658
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ project(kwin4_effect_shapecorners VERSION 0.6.2 LANGUAGES CXX)

include(cmake/default-vars.cmake)
include(cmake/qtversion.cmake)
include(cmake/info.cmake)

find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${ECM_MODULE_PATH}
${ECM_KDE_MODULE_DIR}
)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
Expand All @@ -25,6 +33,5 @@ add_subdirectory(src)

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

include(cmake/info.cmake)
include(cmake/test.cmake)
include(cmake/pack.cmake)
10 changes: 1 addition & 9 deletions cmake/info.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
execute_process(
COMMAND sh -c "ldconfig -v 2>&1 | awk '$1 ~ \"libkwin\" {print $1,$2,$3}'"
OUTPUT_VARIABLE KWIN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("--- KWin Version: ${KWIN_VERSION}")

if(${QT_MAJOR_VERSION} EQUAL 6)
set(KWIN_EFFECT_INCLUDE_FILE "/usr/include/kwin/effect/effect.h")
else ()
Expand All @@ -13,6 +7,4 @@ execute_process(
COMMAND sh -c "grep '#define KWIN_EFFECT_API_VERSION_MINOR' ${KWIN_EFFECT_INCLUDE_FILE} | awk '{print \$NF}'"
OUTPUT_VARIABLE KWIN_EFFECT_API_VERSION_MINOR OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("--- KWinEffect Version: ${KWIN_EFFECT_API_VERSION_MINOR}")

message("")
message("-- KWinEffect Version: ${KWIN_EFFECT_API_VERSION_MINOR}")
16 changes: 8 additions & 8 deletions cmake/qtversion.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
execute_process(
COMMAND sh -c "ldconfig -v 2>&1 | awk '$1 ~ \"libkwin.so\" {print $3}' | cut -d '.' -f 3-"
OUTPUT_VARIABLE KWIN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("-- KWin Version: ${KWIN_VERSION}")

set(KF_MIN_VERSION "5.78")
set(QT_MIN_VERSION "5.15")
set(QT_MAJOR_VERSION 5)

find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${ECM_MODULE_PATH}
${ECM_KDE_MODULE_DIR}
)
if(ECM_VERSION VERSION_GREATER "5.200.0")
if(KWIN_VERSION VERSION_GREATER "6")
set(QT_MIN_VERSION "6.4.0")
set(QT_MAJOR_VERSION 6)
set(KF_MIN_VERSION ${ECM_VERSION})
set(KF_MIN_VERSION 6)
endif()
5 changes: 3 additions & 2 deletions src/Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ ShapeCorners::Effect::windowAdded(KWin::EffectWindow *w)
}

const QSet<QString> hardExceptions {
"kwin", "kwin_x11", "kwin_wayland", "kscreenlocker_greet", "ksmserver", "krunner"
QStringLiteral("kwin"), QStringLiteral("kwin_x11"), QStringLiteral("kwin_wayland"),
QStringLiteral("kscreenlocker_greet"), QStringLiteral("ksmserver"), QStringLiteral("krunner")
};
const auto name = w->windowClass().split(QChar::Space).first();
if (hardExceptions.contains(name)) {
Expand Down Expand Up @@ -220,7 +221,7 @@ QString ShapeCorners::Effect::get_window_titles() const {
if (!response.contains(window.name))
response.push_back(window.name);
}
return response.join("\n");
return response.join(QStringLiteral("\n"));
}

void ShapeCorners::Effect::checkTiled() {
Expand Down

0 comments on commit 8464658

Please sign in to comment.