Commit b3b45721 authored by Benjamin Port's avatar Benjamin Port

fix(kded): center action OSD on wayland

Currently on Wayland the Action OSD is not centered on the screen.

On Wayland we will center it on m_output (laptop, with fallback to primary and
then to first one).

X behavior is not changed.

BUG: 397586

Reviewers: romangg, davidedmundson

Reviewed By: romangg, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent b5f15cc2
......@@ -25,10 +25,13 @@
#include <KScreen/Mode>
#include <QTimer>
#include <QCursor>
#include <QGuiApplication>
#include <QScreen>
#include <QStandardPaths>
#include <QTimer>
#include <KDeclarative/QmlObjectSharedEngine>
#include <QGuiApplication>
using namespace KScreen;
......@@ -138,6 +141,10 @@ void Osd::showActionSelector()
this, SLOT(onOsdActionSelected(int)));
if (auto *rootObject = m_osdActionSelector->rootObject()) {
// On wayland, we use m_output to set an action on OSD position
if (qGuiApp->platformName() == QLatin1String("wayland")) {
rootObject->setProperty("screenGeometry", m_output->geometry());
rootObject->setProperty("visible", true);
} else {
qCWarning(KSCREEN_KDED) << "Could not get root object for action selector.";
......@@ -29,6 +29,12 @@ PlasmaCore.Dialog {
location: PlasmaCore.Types.Floating
type: PlasmaCore.Dialog.Normal
property string infoText
property var screenGeometry
onScreenGeometryChanged: {
root.x = screenGeometry.x + (screenGeometry.width - mainItem.width) / 2
root.y = screenGeometry.y + (screenGeometry.height - mainItem.height) / 2
signal clicked(int actionId)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment