summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2021-11-15 15:49:37 +0100
committerAndreas Sturmlechner <asturm@gentoo.org>2021-11-23 15:59:09 +0100
commit015f97dc374c025683c8d8c5cb803869a23b740f (patch)
treea5c957058e1f9d95eb57a0c7ef6064ff08812d39 /kde-frameworks
parentkde-apps/kwrite: Add missing DEPEND (diff)
downloadgentoo-015f97dc374c025683c8d8c5cb803869a23b740f.tar.gz
gentoo-015f97dc374c025683c8d8c5cb803869a23b740f.tar.bz2
gentoo-015f97dc374c025683c8d8c5cb803869a23b740f.zip
kde-frameworks/kconfigwidgets: Fix hamburger menu a window on Wayland
Upstream commit 82c40f18709484fd462643aa113a8ccf961b646a KDE-bug: https://bugs.kde.org/show_bug.cgi?id=442375 Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-frameworks')
-rw-r--r--kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch87
-rw-r--r--kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild45
2 files changed, 132 insertions, 0 deletions
diff --git a/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch b/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch
new file mode 100644
index 000000000000..8cf60aeb7594
--- /dev/null
+++ b/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch
@@ -0,0 +1,87 @@
+From 82c40f18709484fd462643aa113a8ccf961b646a Mon Sep 17 00:00:00 2001
+From: Felix Ernst <fe.a.ernst@gmail.com>
+Date: Tue, 26 Oct 2021 17:28:09 +0200
+Subject: [PATCH] Fix hamburger menu opening as a window on Wayland
+
+Before this commit, if an app window is unfocused and the first
+click on the window is the hamburger menu button, the menu would
+appear displaced as a separate window on Wayland.
+
+This commit fixes this by setting a sane transientParent for the
+menu. This is slightly difficult because there can be any number
+of hamburger buttons in any number of different windows so we need
+to figure out spontaneously which button was pressed to open the
+menu.
+
+BUG: 442375
+---
+ src/khamburgermenuhelpers.cpp | 26 ++++++++++++++++++++++++--
+ src/khamburgermenuhelpers_p.h | 2 +-
+ 2 files changed, 25 insertions(+), 3 deletions(-)
+
+diff --git a/src/khamburgermenuhelpers.cpp b/src/khamburgermenuhelpers.cpp
+index 88242aa5..d1ae2835 100644
+--- a/src/khamburgermenuhelpers.cpp
++++ b/src/khamburgermenuhelpers.cpp
+@@ -10,7 +10,10 @@
+ #include "khamburgermenu.h"
+
+ #include <QEvent>
++#include <QMenu>
++#include <QToolButton>
+ #include <QWidget>
++#include <QWindow>
+
+ ListenerContainer::ListenerContainer(KHamburgerMenuPrivate *hamburgerMenuPrivate)
+ : QObject{hamburgerMenuPrivate},
+@@ -28,13 +31,32 @@ bool AddOrRemoveActionListener::eventFilter(QObject * /*watched*/, QEvent *event
+ return false;
+ }
+
+-bool ButtonPressListener::eventFilter(QObject * /*watched*/, QEvent *event)
++bool ButtonPressListener::eventFilter(QObject *watched, QEvent *event)
+ {
+ if (event->type() == QEvent::KeyPress || event->type() == QEvent::MouseButtonPress) {
+ auto hamburgerMenuPrivate = static_cast<KHamburgerMenuPrivate *>(parent());
+ auto q = static_cast<KHamburgerMenu *>(hamburgerMenuPrivate->q_ptr);
+ Q_EMIT q->aboutToShowMenu();
+- hamburgerMenuPrivate->resetMenu();
++ hamburgerMenuPrivate->resetMenu(); // This menu never has a parent which can be
++ // problematic because it can lead to situations in which the QMenu itself is
++ // treated like its own window.
++ // To avoid this we set a sane transientParent() now even if it already has one
++ // because the menu might be opened from another window this time.
++ const auto watchedButton = qobject_cast<QToolButton *>(watched);
++ if (!watchedButton) {
++ return false;
++ }
++ auto menu = watchedButton->menu();
++ if (!menu) {
++ return false;
++ }
++ menu->winId(); // trigger being a native widget already, to ensure windowHandle created
++ // generic code if not known if the available parent widget is a native widget or not
++ auto parentWindowHandle = watchedButton->windowHandle();
++ if (!parentWindowHandle) {
++ parentWindowHandle = watchedButton->nativeParentWidget()->windowHandle();
++ }
++ menu->windowHandle()->setTransientParent(parentWindowHandle);
+ }
+ return false;
+ }
+diff --git a/src/khamburgermenuhelpers_p.h b/src/khamburgermenuhelpers_p.h
+index f0d98790..4993ee61 100644
+--- a/src/khamburgermenuhelpers_p.h
++++ b/src/khamburgermenuhelpers_p.h
+@@ -80,7 +80,7 @@ class ButtonPressListener : public QObject
+ protected:
+ inline ButtonPressListener(QObject *parent) : QObject{parent} { };
+
+- bool eventFilter(QObject * /*watched*/, QEvent *event) override;
++ bool eventFilter(QObject *watched, QEvent *event) override;
+
+ friend class ListenerContainer;
+ };
+--
+GitLab
+
diff --git a/kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild b/kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild
new file mode 100644
index 000000000000..e136bfe34955
--- /dev/null
+++ b/kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_DESIGNERPLUGIN="true"
+PVCUT=$(ver_cut 1-2)
+QTMIN=5.15.2
+VIRTUALX_REQUIRED="test"
+inherit ecm kde.org
+
+DESCRIPTION="Framework providing an assortment of configuration-related widgets"
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
+IUSE="+man"
+
+BDEPEND="
+ man? ( >=kde-frameworks/kdoctools-${PVCUT}:5 )
+"
+DEPEND="
+ >=dev-qt/qtdbus-${QTMIN}:5
+ >=dev-qt/qtgui-${QTMIN}:5
+ >=dev-qt/qtwidgets-${QTMIN}:5
+ =kde-frameworks/kauth-${PVCUT}*:5
+ =kde-frameworks/kcodecs-${PVCUT}*:5
+ =kde-frameworks/kconfig-${PVCUT}*:5
+ =kde-frameworks/kcoreaddons-${PVCUT}*:5
+ =kde-frameworks/kguiaddons-${PVCUT}*:5
+ =kde-frameworks/ki18n-${PVCUT}*:5
+ =kde-frameworks/kwidgetsaddons-${PVCUT}*:5
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-hamburger-menu-no-window-on-wayland.patch
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_DISABLE_FIND_PACKAGE_PythonModuleGeneration=ON # bug 746866
+ $(cmake_use_find_package man KF5DocTools)
+ )
+
+ ecm_src_configure
+}