From eec07c477da865aa11812eb29366b061a3d829d5 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 14 Dec 2022 11:34:27 +0200 Subject: [PATCH] wayland: Require to reboot computer after changing primary selection option Not all clients handle well withdrawing the primary selection global at runtime, so apply the new primary selection option only after a reboot. --- src/main_wayland.cpp | 4 ---- src/wayland_server.cpp | 14 +++----------- src/wayland_server.h | 3 --- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index 37a3a7e149..e75464bfcd 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -200,10 +200,6 @@ void ApplicationWayland::refreshSettings(const KConfigGroup &group, const QByteA if (m_startXWayland && group.name() == "Xwayland" && names.contains("Scale")) { setXwaylandScale(group.readEntry("Scale", 1.0)); } - - if (group.name() == "Wayland" && names.contains("EnablePrimarySelection")) { - waylandServer()->setEnablePrimarySelection(group.readEntry("EnablePrimarySelection", true)); - } } void ApplicationWayland::startSession() diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index eaa80a9450..9ed8c4d4cf 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -320,16 +320,6 @@ void WaylandServer::handleOutputDisabled(Output *output) } } -void WaylandServer::setEnablePrimarySelection(bool enable) -{ - if (!enable && m_primarySelectionDeviceManager != nullptr) { - delete m_primarySelectionDeviceManager; - m_primarySelectionDeviceManager = nullptr; - } else if (enable && m_primarySelectionDeviceManager == nullptr) { - m_primarySelectionDeviceManager = new PrimarySelectionDeviceManagerV1Interface(m_display, m_display); - } -} - bool WaylandServer::start() { return m_display->start(); @@ -430,7 +420,9 @@ bool WaylandServer::init(InitializationFlags flags) new DataControlDeviceManagerV1Interface(m_display, m_display); const auto kwinConfig = kwinApp()->config(); - setEnablePrimarySelection(kwinConfig->group("Wayland").readEntry("EnablePrimarySelection", true)); + if (kwinConfig->group("Wayland").readEntry("EnablePrimarySelection", true)) { + new PrimarySelectionDeviceManagerV1Interface(m_display, m_display); + } m_idle = new IdleInterface(m_display, m_display); auto idleInhibition = new IdleInhibition(m_idle); diff --git a/src/wayland_server.h b/src/wayland_server.h index 45caa8c1e3..b0bc11c507 100644 --- a/src/wayland_server.h +++ b/src/wayland_server.h @@ -47,7 +47,6 @@ class LinuxDmaBufV1ClientBuffer; class TabletManagerV2Interface; class KeyboardShortcutsInhibitManagerV1Interface; class XdgDecorationManagerV1Interface; -class PrimarySelectionDeviceManagerV1Interface; class XWaylandKeyboardGrabManagerV1Interface; class ContentTypeManagerV1Interface; class DrmLeaseManagerV1; @@ -228,7 +227,6 @@ public: { m_linuxDmabufBuffers.remove(buffer); } - void setEnablePrimarySelection(bool enable); /** * Returns the first socket name that can be used to connect to this server. @@ -295,7 +293,6 @@ private: KWaylandServer::ClientConnection *m_screenLockerClientConnection = nullptr; KWaylandServer::XdgForeignV2Interface *m_XdgForeign = nullptr; XdgActivationV1Integration *m_xdgActivationIntegration = nullptr; - KWaylandServer::PrimarySelectionDeviceManagerV1Interface *m_primarySelectionDeviceManager = nullptr; KWaylandServer::XWaylandKeyboardGrabManagerV1Interface *m_xWaylandKeyboardGrabManager = nullptr; KWaylandServer::ContentTypeManagerV1Interface *m_contentTypeManager = nullptr; KWaylandServer::TearingControlManagerV1Interface *m_tearingControlInterface = nullptr;