summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2022-11-23 21:12:59 +0100
committerAndreas Sturmlechner <asturm@gentoo.org>2022-11-23 21:19:23 +0100
commita6962353882cd9bb16f7e7f98040e3bc9d6c1eeb (patch)
treee1f74c41df34dc696f834ab3f328819fbecb92a4 /media-gfx
parentapp-text/kbibtex: Backport two upstream fixes, update EAPI 7 -> 8 (diff)
downloadgentoo-a6962353882cd9bb16f7e7f98040e3bc9d6c1eeb.tar.gz
gentoo-a6962353882cd9bb16f7e7f98040e3bc9d6c1eeb.tar.bz2
gentoo-a6962353882cd9bb16f7e7f98040e3bc9d6c1eeb.zip
media-gfx/kxstitch: Backport various upstream fixes, update EAPI 7 -> 8
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'media-gfx')
-rw-r--r--media-gfx/kxstitch/files/kxstitch-2.2.0-drop-xkeylock.patch180
-rw-r--r--media-gfx/kxstitch/files/kxstitch-2.2.0-fix-hidpi.patch26
-rw-r--r--media-gfx/kxstitch/files/kxstitch-2.2.0-fix-render-scaled-painter.patch202
-rw-r--r--media-gfx/kxstitch/kxstitch-2.2.0-r1.ebuild44
4 files changed, 452 insertions, 0 deletions
diff --git a/media-gfx/kxstitch/files/kxstitch-2.2.0-drop-xkeylock.patch b/media-gfx/kxstitch/files/kxstitch-2.2.0-drop-xkeylock.patch
new file mode 100644
index 000000000000..805a67ea97c8
--- /dev/null
+++ b/media-gfx/kxstitch/files/kxstitch-2.2.0-drop-xkeylock.patch
@@ -0,0 +1,180 @@
+From f97d3eaf4c06b4740fcec63c9c0ca64a5bd56281 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <pino@kde.org>
+Date: Sun, 28 Jun 2020 12:01:49 +0200
+Subject: [PATCH] cmake: require KGuiAddons
+
+It will be used soon.
+---
+ CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 36e3169..7ccf7f0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -32,6 +32,7 @@ find_package (KF5 REQUIRED COMPONENTS
+ Config
+ ConfigWidgets
+ Completion
++ GuiAddons
+ I18n
+ KIO
+ TextWidgets
+@@ -145,6 +146,7 @@ target_link_libraries (kxstitch
+ Qt5::X11Extras
+ KF5::Completion
+ KF5::ConfigGui
++ KF5::GuiAddons
+ KF5::KIOFileWidgets
+ KF5::I18n
+ KF5::TextWidgets
+--
+GitLab
+
+From 817be56369a25de4dd12f2548f97e4ebcfb73571 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <pino@kde.org>
+Date: Sun, 28 Jun 2020 12:02:34 +0200
+Subject: [PATCH] Switch from XKeyLock to KModifierKeyInfo
+
+Use KModifierKeyInfo from the KGuiAddons framework to get the status
+of keys. In particular, use it to get the status of the Caps Lock key
+instead of the local XKeyLock implementation.
+
+The KModifierKeyInfo object is kept as class member to avoid recreating
+it at each key press in Alphabet mode.
+---
+ src/Editor.cpp | 4 +---
+ src/Editor.h | 4 ++++
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/Editor.cpp b/src/Editor.cpp
+index bba0760..163e88e 100644
+--- a/src/Editor.cpp
++++ b/src/Editor.cpp
+@@ -46,7 +46,6 @@
+ #include "Scale.h"
+ #include "SchemeManager.h"
+ #include "TextToolDlg.h"
+-#include "XKeyLock.h"
+
+
+ const Editor::keyPressCallPointer Editor::keyPressCallPointers[] = {
+@@ -858,10 +857,9 @@ void Editor::keyPressText(QKeyEvent *e)
+
+ void Editor::keyPressAlphabet(QKeyEvent *e)
+ {
+- XKeyLock keylock(QX11Info::display());
+ Qt::KeyboardModifiers modifiers = e->modifiers();
+
+- if (keylock.getCapsLock() && Configuration::alphabet_UseCapsLock()) {
++ if (m_keyInfo.isKeyPressed(Qt::Key_CapsLock) && Configuration::alphabet_UseCapsLock()) {
+ modifiers = static_cast<Qt::KeyboardModifiers>(modifiers ^ Qt::ShiftModifier);
+ }
+
+diff --git a/src/Editor.h b/src/Editor.h
+index 3189249..8345a38 100644
+--- a/src/Editor.h
++++ b/src/Editor.h
+@@ -16,6 +16,8 @@
+ #include <QStack>
+ #include <QWidget>
+
++#include <KModifierKeyInfo>
++
+ #include "Stitch.h"
+
+ #include "configuration.h"
+@@ -337,6 +339,8 @@ private:
+ QStack<QPoint> m_cursorStack;
+ QMap<int, int> m_cursorCommands;
+
++ KModifierKeyInfo m_keyInfo;
++
+ typedef void (Editor::*keyPressCallPointer)(QKeyEvent*);
+ typedef void (Editor::*toolInitCallPointer)();
+ typedef void (Editor::*toolCleanupCallPointer)();
+--
+GitLab
+
+From 17d6a17830ce190cd21f266dd319e36e4865e30a Mon Sep 17 00:00:00 2001
+From: Pino Toscano <pino@kde.org>
+Date: Sun, 28 Jun 2020 12:13:37 +0200
+Subject: [PATCH] Drop XKeyLock & X11 leftovers
+
+XKeyLock is not used anymore, so it can be dropped together with the
+X11 and QX11Extras requirements.
+---
+ CMakeLists.txt | 6 --
+ src/Editor.cpp | 1 -
+ src/XKeyLock.cpp | 202 -----------------------------------------------
+ src/XKeyLock.h | 70 ----------------
+ 4 files changed, 279 deletions(-)
+ delete mode 100644 src/XKeyLock.cpp
+ delete mode 100644 src/XKeyLock.h
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7ccf7f0..c225859 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,7 +23,6 @@ find_package (Qt5 CONFIG REQUIRED
+ Core
+ PrintSupport
+ Widgets
+- X11Extras
+ )
+
+ find_package (KF5DocTools)
+@@ -41,7 +40,6 @@ find_package (KF5 REQUIRED COMPONENTS
+ )
+
+ find_package (ImageMagick COMPONENTS MagickCore Magick++ REQUIRED)
+-find_package (X11 REQUIRED)
+ find_package (Doxygen)
+ find_package (SharedMimeInfo)
+
+@@ -57,7 +55,6 @@ include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_D
+ # only in older cmake versions, while the latter only in newer ones
+ include_directories (${ImageMagick_Magick++_INCLUDE_DIR} ${ImageMagick_MagickCore_INCLUDE_DIR})
+ include_directories (${ImageMagick_Magick++_INCLUDE_DIRS} ${ImageMagick_MagickCore_INCLUDE_DIRS})
+-include_directories (${X11_INCLUDE_DIR})
+
+ set (kxstitch_SRCS
+ src/BackgroundImage.cpp
+@@ -96,7 +93,6 @@ set (kxstitch_SRCS
+ src/Symbol.cpp
+ src/SymbolLibrary.cpp
+ src/SymbolManager.cpp
+- src/XKeyLock.cpp
+
+ src/AlphaSelect.cpp
+ src/CalibrateFlossDlg.cpp
+@@ -143,7 +139,6 @@ target_link_libraries (kxstitch
+ Qt5::Core
+ Qt5::PrintSupport
+ Qt5::Widgets
+- Qt5::X11Extras
+ KF5::Completion
+ KF5::ConfigGui
+ KF5::GuiAddons
+@@ -153,7 +148,6 @@ target_link_libraries (kxstitch
+ KF5::WidgetsAddons
+ KF5::XmlGui
+ ${ImageMagick_Magick++_LIBRARY} ${ImageMagick_MagickCore_LIBRARY}
+- ${X11_LIBRARIES}
+ )
+
+ set (WITH_PROFILING OFF CACHE BOOL "Build with profiling support")
+diff --git a/src/Editor.cpp b/src/Editor.cpp
+index 163e88e..4d314e4 100644
+--- a/src/Editor.cpp
++++ b/src/Editor.cpp
+@@ -24,7 +24,6 @@
+ #include <QScrollArea>
+ #include <QStyleOptionRubberBand>
+ #include <QToolTip>
+-#include <QX11Info>
+
+ #include <KLocalizedString>
+ #include <KMessageBox>
+--
+GitLab
diff --git a/media-gfx/kxstitch/files/kxstitch-2.2.0-fix-hidpi.patch b/media-gfx/kxstitch/files/kxstitch-2.2.0-fix-hidpi.patch
new file mode 100644
index 000000000000..bf5d94dae4d6
--- /dev/null
+++ b/media-gfx/kxstitch/files/kxstitch-2.2.0-fix-hidpi.patch
@@ -0,0 +1,26 @@
+From 44d231b5604480601bedc623ca2f5204bd4a3ac8 Mon Sep 17 00:00:00 2001
+From: Nicolas Fella <nicolas.fella@gmx.de>
+Date: Sun, 11 Sep 2022 15:55:44 +0200
+Subject: [PATCH] Enable highdpi scaling and pixmaps
+
+---
+ src/Main.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/Main.cpp b/src/Main.cpp
+index 0af162a..4088d37 100644
+--- a/src/Main.cpp
++++ b/src/Main.cpp
+@@ -85,6 +85,9 @@
+ */
+ int main(int argc, char *argv[])
+ {
++ QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
++ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
++
+ QApplication app(argc, argv);
+ KLocalizedString::setApplicationDomain("kxstitch");
+
+--
+GitLab
+
diff --git a/media-gfx/kxstitch/files/kxstitch-2.2.0-fix-render-scaled-painter.patch b/media-gfx/kxstitch/files/kxstitch-2.2.0-fix-render-scaled-painter.patch
new file mode 100644
index 000000000000..5b2bc07aa1ed
--- /dev/null
+++ b/media-gfx/kxstitch/files/kxstitch-2.2.0-fix-render-scaled-painter.patch
@@ -0,0 +1,202 @@
+From c9e6a03c32fe6e6901fad8439bf2235ddb8c288c Mon Sep 17 00:00:00 2001
+From: Steve Allewell <steve.allewell@gmail.com>
+Date: Sun, 3 Jan 2021 13:43:59 +0000
+Subject: [PATCH] Fix for rendering on scaled painter
+
+Fixes for rendering seletion areas on scaled painter in recent versions
+of Qt which were half a square out.
+---
+ src/Editor.cpp | 74 ++++++++++++++++++++++++++++----------------------
+ 1 file changed, 41 insertions(+), 33 deletions(-)
+
+diff --git a/src/Editor.cpp b/src/Editor.cpp
+index 4d314e4..263df1e 100644
+--- a/src/Editor.cpp
++++ b/src/Editor.cpp
+@@ -1388,11 +1388,12 @@ void Editor::renderRubberBandRectangle(QPainter *painter, const QRect&)
+ if (m_rubberBand.isValid()) {
+ painter->setRenderHint(QPainter::Qt4CompatiblePainting, true);
+
++ painter->resetTransform();
+ QStyleOptionRubberBand opt;
+ opt.initFrom(this);
+ opt.shape = QRubberBand::Rectangle;
+ opt.opaque = false;
+- opt.rect = m_rubberBand.adjusted(0, 0, 1, 1);
++ opt.rect = rectToContents(m_rubberBand);
+
+ style()->drawControl(QStyle::CE_RubberBand, &opt, painter);
+ }
+@@ -1408,14 +1409,15 @@ void Editor::renderRubberBandEllipse(QPainter *painter, const QRect&)
+ if (m_rubberBand.isValid()) {
+ painter->setRenderHint(QPainter::Qt4CompatiblePainting, true);
+
+- painter->setPen(Qt::NoPen);
+- painter->setBrush(QColor(200,225,255));
+- painter->setOpacity(0.5);
+- painter->drawEllipse(m_rubberBand);
++ painter->resetTransform();
++ QStyleOptionRubberBand opt;
++ opt.initFrom(this);
+
+- painter->setPen(Qt::darkBlue);
+- painter->setBrush(Qt::NoBrush);
+- painter->drawEllipse(m_rubberBand);
++ painter->setPen(opt.palette.color(QPalette::WindowText));
++ painter->setBrush(QBrush(opt.palette.color(QPalette::Highlight), Qt::Dense4Pattern));
++ painter->setBackground(QBrush(opt.palette.base()));
++ painter->setBackgroundMode(Qt::TransparentMode);
++ painter->drawEllipse(rectToContents(m_rubberBand));
+ }
+
+ painter->restore();
+@@ -1427,7 +1429,10 @@ void Editor::renderFillPolygon(QPainter *painter, const QRect&)
+ QPolygonF polyline;
+ painter->save();
+
+- painter->setPen(Qt::green); // use green for the first point
++ QPen pen(Qt::green);
++ pen.setWidth(0);
++
++ painter->setPen(pen); // use green for the first point
+ painter->setBrush(Qt::green);
+
+ QVector<QPoint>::const_iterator i;
+@@ -1435,7 +1440,8 @@ void Editor::renderFillPolygon(QPainter *painter, const QRect&)
+ for (i = m_polygon.constBegin() ; i != m_polygon.constEnd() ; ++i) {
+ QPointF cell = QPointF(*i) + QPointF(0.5, 0.5);
+ painter->drawEllipse(QRectF(-0.5, -0.5, 1, 1).translated(cell));
+- painter->setPen(Qt::blue); // use blue for subsequent points
++ pen.setColor(Qt::blue);
++ painter->setPen(pen); // use blue for subsequent points
+ painter->setBrush(Qt::blue);
+ polyline.append(cell);
+ }
+@@ -1555,9 +1561,9 @@ void Editor::mouseMoveEvent_Draw(QMouseEvent *e)
+
+ dynamic_cast<QScrollArea *>(parentWidget()->parentWidget())->ensureVisible(p.x(), p.y());
+
+- m_cellTracking = contentsToCell(p);
+- m_cellEnd = m_cellTracking;
+- m_rubberBand = QRect(m_cellStart, m_cellEnd).normalized();
++ m_cellEnd = m_cellTracking = contentsToCell(p);
++ m_rubberBand = QRect(m_cellStart, QSize(1, 1)).united(QRect(m_cellEnd, QSize(1, 1)));
++
+ update();
+ }
+
+@@ -1703,9 +1709,9 @@ void Editor::mouseMoveEvent_Rectangle(QMouseEvent *e)
+
+ dynamic_cast<QScrollArea *>(parentWidget()->parentWidget())->ensureVisible(p.x(), p.y());
+
+- m_cellTracking = contentsToCell(p);
+- m_cellEnd = m_cellTracking;
+- m_rubberBand = QRect(m_cellStart, m_cellEnd).normalized();
++ m_cellEnd = m_cellTracking = contentsToCell(p);
++ m_rubberBand = QRect(m_cellStart, QSize(1, 1)).united(QRect(m_cellEnd, QSize(1, 1)));
++
+ update();
+ }
+
+@@ -1757,9 +1763,9 @@ void Editor::mouseMoveEvent_FillRectangle(QMouseEvent *e)
+
+ dynamic_cast<QScrollArea *>(parentWidget()->parentWidget())->ensureVisible(p.x(), p.y());
+
+- m_cellTracking = contentsToCell(p);
+- m_cellEnd = m_cellTracking;
+- m_rubberBand = QRect(m_cellStart, m_cellEnd).normalized();
++ m_cellEnd = m_cellTracking = contentsToCell(p);
++ m_rubberBand = QRect(m_cellStart, QSize(1, 1)).united(QRect(m_cellEnd, QSize(1, 1)));
++
+ update();
+ }
+
+@@ -1793,9 +1799,9 @@ void Editor::mouseMoveEvent_Ellipse(QMouseEvent *e)
+
+ dynamic_cast<QScrollArea *>(parentWidget()->parentWidget())->ensureVisible(p.x(), p.y());
+
+- m_cellTracking = contentsToCell(p);
+- m_cellEnd = m_cellTracking;
+- m_rubberBand = QRect(m_cellStart, m_cellEnd).normalized();
++ m_cellEnd = m_cellTracking = contentsToCell(p);
++ m_rubberBand = QRect(m_cellStart, QSize(1, 1)).united(QRect(m_cellEnd, QSize(1, 1)));
++
+ update();
+ }
+
+@@ -1848,9 +1854,9 @@ void Editor::mouseMoveEvent_FillEllipse(QMouseEvent *e)
+
+ dynamic_cast<QScrollArea *>(parentWidget()->parentWidget())->ensureVisible(p.x(), p.y());
+
+- m_cellTracking = contentsToCell(p);
+- m_cellEnd = m_cellTracking;
+- m_rubberBand = QRect(m_cellStart, m_cellEnd).normalized();
++ m_cellEnd = m_cellTracking = contentsToCell(p);
++ m_rubberBand = QRect(m_cellStart, QSize(1, 1)).united(QRect(m_cellEnd, QSize(1, 1)));
++
+ update();
+ }
+
+@@ -1877,7 +1883,7 @@ void Editor::mouseReleaseEvent_FillEllipse(QMouseEvent*)
+ painter.setRenderHint(QPainter::Antialiasing, !useFractionals);
+ painter.setPen(QPen(Qt::color1));
+ painter.setBrush(Qt::color1);
+- painter.drawEllipse(QRect(m_cellStart, m_cellEnd).normalized());
++ painter.drawEllipse(QRect(m_cellStart, QSize(1,1)).united(QRect(m_cellEnd, QSize(1, 1))));
+ painter.end();
+
+ QUndoCommand *cmd = new FillEllipseCommand(m_document);
+@@ -1894,6 +1900,7 @@ void Editor::mousePressEvent_FillPolygon(QMouseEvent *e)
+ {
+ m_cellStart = m_cellTracking = m_cellEnd = contentsToCell(e->pos());
+ m_polygon.append(m_cellStart);
++
+ update();
+ }
+
+@@ -2001,6 +2008,7 @@ void Editor::mouseReleaseEvent_Alphabet(QMouseEvent *e)
+
+ m_cellStart = m_cellTracking = m_cellEnd = contentsToCell(e->pos());
+ m_cursorStack.push(m_cellEnd);
++
+ update();
+ }
+
+@@ -2023,9 +2031,9 @@ void Editor::mouseMoveEvent_Select(QMouseEvent *e)
+
+ dynamic_cast<QScrollArea *>(parentWidget()->parentWidget())->ensureVisible(p.x(), p.y());
+
+- m_cellTracking = contentsToCell(p);
+- m_cellEnd = m_cellTracking;
+- m_rubberBand = QRect(m_cellStart, m_cellEnd).normalized();
++ m_cellEnd = m_cellTracking = contentsToCell(p);
++ m_rubberBand = QRect(m_cellStart, QSize(1, 1)).united(QRect(m_cellEnd, QSize(1, 1)));
++
+ update();
+
+ QToolTip::showText(QCursor::pos(), QString::fromLatin1("%1,%2 %3 x %4").arg(m_rubberBand.left()).arg(m_rubberBand.top()).arg(m_rubberBand.width()).arg(m_rubberBand.height()));
+@@ -2034,7 +2042,7 @@ void Editor::mouseMoveEvent_Select(QMouseEvent *e)
+
+ void Editor::mouseReleaseEvent_Select(QMouseEvent*)
+ {
+- m_selectionArea = QRect(m_cellStart, m_cellEnd).normalized();
++ m_selectionArea = m_rubberBand;
+ emit(selectionMade(true));
+ }
+
+@@ -2052,9 +2060,9 @@ void Editor::mouseMoveEvent_Backstitch(QMouseEvent *e)
+
+ dynamic_cast<QScrollArea *>(parentWidget()->parentWidget())->ensureVisible(p.x(), p.y());
+
+- m_cellTracking = contentsToSnap(p);
+- m_cellEnd = m_cellTracking;
+- m_rubberBand = (snapToCells(m_cellStart).united(snapToCells(m_cellEnd))).normalized();
++ m_cellEnd = m_cellTracking = contentsToSnap(p);
++ m_rubberBand = snapToCells(m_cellStart).united(snapToCells(m_cellEnd));
++
+ update();
+ }
+
+--
+GitLab
+
diff --git a/media-gfx/kxstitch/kxstitch-2.2.0-r1.ebuild b/media-gfx/kxstitch/kxstitch-2.2.0-r1.ebuild
new file mode 100644
index 000000000000..927de1cf02ef
--- /dev/null
+++ b/media-gfx/kxstitch/kxstitch-2.2.0-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_HANDBOOK="forceoptional"
+KFMIN=5.82.0
+QTMIN=5.15.5
+inherit ecm kde.org
+
+DESCRIPTION="Program to create cross stitch patterns"
+HOMEPAGE="https://apps.kde.org/kxstitch/ https://userbase.kde.org/KXStitch"
+SRC_URI="mirror://kde/stable/${PN}/${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2+"
+SLOT="5"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND="
+ >=dev-qt/qtgui-${QTMIN}:5
+ >=dev-qt/qtprintsupport-${QTMIN}:5
+ >=dev-qt/qtwidgets-${QTMIN}:5
+ >=dev-qt/qtxml-${QTMIN}:5
+ >=kde-frameworks/kcompletion-${KFMIN}:5
+ >=kde-frameworks/kconfig-${KFMIN}:5
+ >=kde-frameworks/kconfigwidgets-${KFMIN}:5
+ >=kde-frameworks/kcoreaddons-${KFMIN}:5
+ >=kde-frameworks/kguiaddons-${KFMIN}:5
+ >=kde-frameworks/ki18n-${KFMIN}:5
+ >=kde-frameworks/kio-${KFMIN}:5
+ >=kde-frameworks/ktextwidgets-${KFMIN}:5
+ >=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+ >=kde-frameworks/kxmlgui-${KFMIN}:5
+ media-gfx/imagemagick[cxx]
+"
+RDEPEND="${DEPEND}"
+BDEPEND="sys-devel/gettext"
+
+PATCHES=(
+ "${FILESDIR}/${P}-drop-xkeylock.patch"
+ "${FILESDIR}/${P}-fix-render-scaled-painter.patch"
+ "${FILESDIR}/${P}-fix-hidpi.patch"
+)