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.
This commit is contained in:
Vlad Zahorodnii 2022-12-14 11:34:27 +02:00
parent da229ebe85
commit eec07c477d
3 changed files with 3 additions and 18 deletions

View file

@ -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()

View file

@ -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);

View file

@ -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;