WaylandServer: Add a setting to disable PrimarySelection
CCBUG: 441668
This commit is contained in:
parent
d86563a836
commit
4082fdf960
5 changed files with 29 additions and 9 deletions
|
@ -318,6 +318,9 @@
|
|||
<entry name="DoubleTapWakeup" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="EnablePrimarySelection" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
</group>
|
||||
<group name="Xwayland">
|
||||
<entry name="XwaylandCrashPolicy" type="Enum">
|
||||
|
|
|
@ -93,7 +93,7 @@ Application::Application(Application::OperationMode mode, int &argc, char **argv
|
|||
: QApplication(argc, argv)
|
||||
, m_eventFilter(new XcbEventFilter())
|
||||
, m_configLock(false)
|
||||
, m_config()
|
||||
, m_config(KSharedConfig::openConfig(QStringLiteral("kwinrc")))
|
||||
, m_kxkbConfig()
|
||||
, m_operationMode(mode)
|
||||
{
|
||||
|
@ -134,9 +134,6 @@ void Application::start()
|
|||
|
||||
setQuitOnLastWindowClosed(false);
|
||||
|
||||
if (!m_config) {
|
||||
m_config = KSharedConfig::openConfig();
|
||||
}
|
||||
if (!m_config->isImmutable() && m_configLock) {
|
||||
// TODO: This shouldn't be necessary
|
||||
// config->setReadOnly( true );
|
||||
|
|
|
@ -201,17 +201,21 @@ 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()
|
||||
{
|
||||
if (!m_inputMethodServerToStart.isEmpty()) {
|
||||
InputMethod::self()->setInputMethodCommand(m_inputMethodServerToStart);
|
||||
} else {
|
||||
KSharedConfig::Ptr kwinSettings = kwinApp()->config();
|
||||
m_settingsWatcher = KConfigWatcher::create(kwinSettings);
|
||||
connect(m_settingsWatcher.data(), &KConfigWatcher::configChanged, this, &ApplicationWayland::refreshSettings);
|
||||
|
||||
if (!m_inputMethodServerToStart.isEmpty()) {
|
||||
InputMethod::self()->setInputMethodCommand(m_inputMethodServerToStart);
|
||||
} else {
|
||||
refreshSettings(kwinSettings->group("Wayland"), {"InputMethod"});
|
||||
}
|
||||
|
||||
|
|
|
@ -327,6 +327,16 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
Output *WaylandServer::findOutput(KWaylandServer::OutputInterface *outputIface) const
|
||||
{
|
||||
for (auto it = m_waylandOutputs.constBegin(); it != m_waylandOutputs.constEnd(); ++it) {
|
||||
|
@ -415,7 +425,10 @@ bool WaylandServer::init(InitializationFlags flags)
|
|||
new RelativePointerManagerV1Interface(m_display, m_display);
|
||||
m_dataDeviceManager = new DataDeviceManagerInterface(m_display, m_display);
|
||||
new DataControlDeviceManagerV1Interface(m_display, m_display);
|
||||
new PrimarySelectionDeviceManagerV1Interface(m_display, m_display);
|
||||
|
||||
const auto kwinConfig = kwinApp()->config();
|
||||
setEnablePrimarySelection(kwinConfig->group("Wayland").readEntry("EnablePrimarySelection", true));
|
||||
|
||||
m_idle = new IdleInterface(m_display, m_display);
|
||||
auto idleInhibition = new IdleInhibition(m_idle);
|
||||
connect(this, &WaylandServer::windowAdded, idleInhibition, &IdleInhibition::registerClient);
|
||||
|
|
|
@ -47,6 +47,7 @@ class LinuxDmaBufV1ClientBuffer;
|
|||
class TabletManagerV2Interface;
|
||||
class KeyboardShortcutsInhibitManagerV1Interface;
|
||||
class XdgDecorationManagerV1Interface;
|
||||
class PrimarySelectionDeviceManagerV1Interface;
|
||||
}
|
||||
|
||||
namespace KWin
|
||||
|
@ -222,6 +223,7 @@ public:
|
|||
{
|
||||
m_linuxDmabufBuffers.remove(buffer);
|
||||
}
|
||||
void setEnablePrimarySelection(bool enable);
|
||||
|
||||
Output *findOutput(KWaylandServer::OutputInterface *output) const;
|
||||
|
||||
|
@ -291,6 +293,7 @@ private:
|
|||
KWaylandServer::XdgForeignV2Interface *m_XdgForeign = nullptr;
|
||||
KWaylandServer::PrimaryOutputV1Interface *m_primary = nullptr;
|
||||
XdgActivationV1Integration *m_xdgActivationIntegration = nullptr;
|
||||
KWaylandServer::PrimarySelectionDeviceManagerV1Interface *m_primarySelectionDeviceManager = nullptr;
|
||||
QList<Window *> m_windows;
|
||||
InitializationFlags m_initFlags;
|
||||
QHash<Output *, WaylandOutput *> m_waylandOutputs;
|
||||
|
|
Loading…
Reference in a new issue