commit: 9ad91c22aef7e32bbca7fa86189f009e6a748e8f Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Thu Oct 23 08:34:22 2025 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Thu Oct 23 12:18:46 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ad91c22
media-libs/kimageannotator: Fix broken HighDPI scaling, CMake minimum 3.16 See also: https://github.com/ksnip/kImageAnnotator/issues/326 Closes: https://bugs.gentoo.org/965014 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> ...imageannotator-0.7.1-cmake-minreqver-3.16.patch | 65 ++++++++++++++++++++++ ...mageannotator-0.7.1-revert-custom-scaling.patch | 64 +++++++++++++++++++++ .../kimageannotator-0.7.1-r1.ebuild | 56 +++++++++++++++++++ 3 files changed, 185 insertions(+) diff --git a/media-libs/kimageannotator/files/kimageannotator-0.7.1-cmake-minreqver-3.16.patch b/media-libs/kimageannotator/files/kimageannotator-0.7.1-cmake-minreqver-3.16.patch new file mode 100644 index 000000000000..a5f115b42c28 --- /dev/null +++ b/media-libs/kimageannotator/files/kimageannotator-0.7.1-cmake-minreqver-3.16.patch @@ -0,0 +1,65 @@ +Source: https://github.com/ksnip/kImageAnnotator/pull/344 + +From 357c66330ac99fbfd3a1aa884a318750e7774237 Mon Sep 17 00:00:00 2001 +From: Andreas Sturmlechner <[email protected]> +Date: Thu, 23 Oct 2025 10:28:26 +0200 +Subject: [PATCH] Raise minimum CMake version to 3.16 and cleanup related + conditionals + +CMake 3.31 warns about compat. for <3.10 being removed in the future. +Qt6 CMake modules already require 3.16 though, and it allows to clean +up existing CMAKE_VERSION conditionals a bit. + +CMake 3.16 was released in 2019. + +Signed-off-by: Andreas Sturmlechner <[email protected]> +--- + CMakeLists.txt | 9 ++------- + tests/CMakeLists.txt | 7 +------ + 2 files changed, 3 insertions(+), 13 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 24dd825..360b555 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.5) ++cmake_minimum_required(VERSION 3.16) + project(kImageAnnotator LANGUAGES CXX VERSION 0.7.1) + + set(CMAKE_CXX_STANDARD 17) +@@ -79,12 +79,7 @@ target_include_directories(kImageAnnotator + target_link_libraries(kImageAnnotator PUBLIC Qt${QT_MAJOR_VERSION}::Widgets Qt${QT_MAJOR_VERSION}::Svg PRIVATE kColorPicker::kColorPicker) + + if (UNIX AND NOT APPLE) +- # X11::X11 imported target only available with sufficiently new CMake +- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14.0) +- target_link_libraries(kImageAnnotator PRIVATE X11::X11) +- else() +- target_link_libraries(kImageAnnotator PRIVATE X11) +- endif() ++ target_link_libraries(kImageAnnotator PRIVATE X11::X11) + endif () + + target_compile_definitions(kImageAnnotator PRIVATE KIMAGEANNOTATOR_LIB) +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +index fe2d1da..4dcddb1 100644 +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -75,12 +75,7 @@ target_link_libraries(KIMAGEANNOTATOR_STATIC + Qt${QT_MAJOR_VERSION}::Svg) + + if (UNIX AND NOT APPLE) +- # X11::X11 imported target only available with sufficiently new CMake +- if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14.0) +- target_link_libraries(KIMAGEANNOTATOR_STATIC X11::X11) +- else() +- target_link_libraries(KIMAGEANNOTATOR_STATIC X11) +- endif() ++ target_link_libraries(KIMAGEANNOTATOR_STATIC X11::X11) + endif () + + target_compile_definitions(KIMAGEANNOTATOR_STATIC PRIVATE KIMAGEANNOTATOR_LANG_INSTALL_DIR="${KIMAGEANNOTATOR_LANG_INSTALL_DIR}") +-- +2.51.1 + diff --git a/media-libs/kimageannotator/files/kimageannotator-0.7.1-revert-custom-scaling.patch b/media-libs/kimageannotator/files/kimageannotator-0.7.1-revert-custom-scaling.patch new file mode 100644 index 000000000000..e7cf42b03cf2 --- /dev/null +++ b/media-libs/kimageannotator/files/kimageannotator-0.7.1-revert-custom-scaling.patch @@ -0,0 +1,64 @@ +Issue: https://github.com/ksnip/kImageAnnotator/issues/326 +Source: https://github.com/ksnip/kImageAnnotator/pull/339 + +From 74a85ecc256e9404f764ee7394301813d0af53c2 Mon Sep 17 00:00:00 2001 +From: Dashon Wells <[email protected]> +Date: Sun, 24 Mar 2024 15:11:21 -0500 +Subject: [PATCH] Revert custom scaling for kde + +--- + src/common/provider/ScaledSizeProvider.cpp | 17 ++++++++++------- + src/common/provider/ScaledSizeProvider.h | 4 ++++ + 2 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/src/common/provider/ScaledSizeProvider.cpp b/src/common/provider/ScaledSizeProvider.cpp +index cb2a1631..1df26365 100644 +--- a/src/common/provider/ScaledSizeProvider.cpp ++++ b/src/common/provider/ScaledSizeProvider.cpp +@@ -55,21 +55,24 @@ qreal ScaledSizeProvider::scaleFactor() + qreal ScaledSizeProvider::getScaleFactor() + { + #if defined(__linux__) +- DesktopEnvironmentChecker desktopEnvironmentChecker; +- auto environment = desktopEnvironmentChecker.getDesktopEnvironment(); +- +- if (environment == DesktopEnvironmentType::Gnome) { ++ if(isGnomeEnvironment()) { + auto screen = QApplication::primaryScreen(); + auto logicalDotsPerInch = (int) screen->logicalDotsPerInch(); + auto physicalDotsPerInch = (int) screen->physicalDotsPerInch(); + return (qreal)logicalDotsPerInch / (qreal)physicalDotsPerInch; +- } else if (environment == DesktopEnvironmentType::Kde) { +- auto screen = QApplication::primaryScreen(); +- return screen->devicePixelRatio(); + } + #endif + + return 1; + } + ++#if defined(__linux__) ++bool ScaledSizeProvider::isGnomeEnvironment() ++{ ++ auto currentDesktop = QString(qgetenv("XDG_CURRENT_DESKTOP")); ++ return currentDesktop.contains(QLatin1String("gnome"), Qt::CaseInsensitive) ++ || currentDesktop.contains(QLatin1String("unity"), Qt::CaseInsensitive); ++} ++#endif ++ + } // namespace kImageAnnotator +diff --git a/src/common/provider/ScaledSizeProvider.h b/src/common/provider/ScaledSizeProvider.h +index e66f58a1..bb9c6ce4 100644 +--- a/src/common/provider/ScaledSizeProvider.h ++++ b/src/common/provider/ScaledSizeProvider.h +@@ -46,6 +46,10 @@ class ScaledSizeProvider + static qreal scaleFactor(); + static qreal getScaleFactor(); + ++#if defined(__linux__) ++ static bool isGnomeEnvironment(); ++#endif ++ + ScaledSizeProvider() = default; + ~ScaledSizeProvider() = default; + }; diff --git a/media-libs/kimageannotator/kimageannotator-0.7.1-r1.ebuild b/media-libs/kimageannotator/kimageannotator-0.7.1-r1.ebuild new file mode 100644 index 000000000000..13c1ca3980c5 --- /dev/null +++ b/media-libs/kimageannotator/kimageannotator-0.7.1-r1.ebuild @@ -0,0 +1,56 @@ +# Copyright 2020-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +MY_PN=kImageAnnotator +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="Tool for annotating images" +HOMEPAGE="https://github.com/ksnip/kImageAnnotator" +SRC_URI="https://github.com/ksnip/${MY_PN}/archive/v${PV}.tar.gz -> ${MY_P}.tar.gz" +S="${WORKDIR}/${MY_P}" + +LICENSE="LGPL-3+" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86" +IUSE="test" + +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-qt/qtbase:6[gui,widgets] + dev-qt/qtsvg:6 + >=media-libs/kcolorpicker-0.3.1 + x11-libs/libX11 +" +DEPEND="${RDEPEND} + x11-base/xorg-proto + test? ( + dev-cpp/gtest + dev-qt/qtbase:6 + ) +" +BDEPEND="dev-qt/qttools:6[linguist]" + +PATCHES=( + "${FILESDIR}/${P}-fix_KeyInputHelperTest.patch" + # Pending upstream fixes: + "${FILESDIR}/${P}-revert-custom-scaling.patch" + "${FILESDIR}/${P}-cmake-minreqver-3.16.patch" # bug #965014 +) + +src_configure() { + local mycmakeargs=( + -DBUILD_TESTS=$(usex test) + -DBUILD_WITH_QT6=ON + ) + cmake_src_configure +} + +src_test() { + local -x QT_QPA_PLATFORM=offscreen + BUILD_DIR="${BUILD_DIR}/tests" cmake_src_test +}
