KCM/Kwinoptions: Port focus tab to KConfigXT
Summary: * remove singleton of KWinOptionsSettings Depends on D27477 Test Plan: * No functional change * default / reset button work as expected. Reviewers: ervin, bport, hchain, crossi, #kwin, zzag Reviewed By: ervin, #kwin, zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D27934
This commit is contained in:
parent
519c4df57c
commit
5498ed9565
9 changed files with 241 additions and 324 deletions
|
@ -22,12 +22,12 @@
|
|||
<string>Window &activation policy:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>windowFocusPolicyCombo</cstring>
|
||||
<cstring>windowFocusPolicy</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="windowFocusPolicyCombo">
|
||||
<widget class="QComboBox" name="windowFocusPolicy">
|
||||
<property name="whatsThis">
|
||||
<string>With this option you can specify how and when windows will be focused.</string>
|
||||
</property>
|
||||
|
@ -72,12 +72,12 @@
|
|||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>delayFocus</cstring>
|
||||
<cstring>kcfg_DelayFocusInterval</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="delayFocus">
|
||||
<widget class="QSpinBox" name="kcfg_DelayFocusInterval">
|
||||
<property name="whatsThis">
|
||||
<string>This is the delay after which the window the mouse pointer is over will automatically receive focus.</string>
|
||||
</property>
|
||||
|
@ -104,12 +104,12 @@
|
|||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>focusStealing</cstring>
|
||||
<cstring>kcfg_FocusStealingPreventionLevel</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KComboBox" name="focusStealing">
|
||||
<widget class="KComboBox" name="kcfg_FocusStealingPreventionLevel">
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>This option specifies how much KWin will try to prevent unwanted focus stealing caused by unexpected activation of new windows. (Note: This feature does not work with the <span style=" font-style:italic;">Focus under mouse</span> or <span style=" font-style:italic;">Focus strictly under mouse</span> focus policies.) </p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">None:</span> Prevention is turned off and new windows always become activated.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Low:</span> Prevention is enabled; when some window does not have support for the underlying mechanism and KWin cannot reliably decide whether to activate the window or not, it will be activated. This setting may have both worse and better results than the medium level, depending on the applications.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Medium:</span> Prevention is enabled.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">High:</span> New windows get activated only if no window is currently active or if they belong to the currently active application. This setting is probably not really usable when not using mouse focus policy.</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Extreme:</span> All windows must be explicitly activated by the user.</li></ul><p>Windows that are prevented from stealing focus are marked as demanding attention, which by default means their taskbar entry will be highlighted. This can be changed in the Notifications control module.</p></body></html></string>
|
||||
</property>
|
||||
|
@ -148,7 +148,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="clickRaiseOn">
|
||||
<widget class="QCheckBox" name="kcfg_ClickRaise">
|
||||
<property name="whatsThis">
|
||||
<string>When this option is enabled, the active window will be brought to the front when you click somewhere into the window contents. To change it for inactive windows, you need to change the settings in the Actions tab.</string>
|
||||
</property>
|
||||
|
@ -160,7 +160,7 @@
|
|||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoRaiseOn">
|
||||
<widget class="QCheckBox" name="kcfg_AutoRaise">
|
||||
<property name="whatsThis">
|
||||
<string>When this option is enabled, a window in the background will automatically come to the front when the mouse pointer has been over it for some time.</string>
|
||||
</property>
|
||||
|
@ -170,7 +170,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="autoRaise">
|
||||
<widget class="QSpinBox" name="kcfg_AutoRaiseInterval">
|
||||
<property name="whatsThis">
|
||||
<string>This is the delay after which the window that the mouse pointer is over will automatically come to the front.</string>
|
||||
</property>
|
||||
|
@ -198,7 +198,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="activeMouseScreen">
|
||||
<widget class="QCheckBox" name="kcfg_ActiveMouseScreen">
|
||||
<property name="whatsThis">
|
||||
<string>When this option is enabled, the active Xinerama screen (where new windows appear, for example) is the screen containing the mouse pointer. When disabled, the active Xinerama screen is the screen containing the focused window. By default this option is disabled for Click to focus and enabled for other focus policies.</string>
|
||||
</property>
|
||||
|
@ -208,7 +208,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="separateScreenFocus">
|
||||
<widget class="QCheckBox" name="kcfg_SeparateScreenFocus">
|
||||
<property name="whatsThis">
|
||||
<string>When this option is enabled, focus operations are limited only to the active Xinerama screen</string>
|
||||
</property>
|
||||
|
@ -261,5 +261,38 @@
|
|||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>kcfg_AutoRaise</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>kcfg_AutoRaiseInterval</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>338</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>485</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>kcfg_AutoRaise</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>kcfg_ClickRaise</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>338</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>333</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
@ -100,6 +100,52 @@
|
|||
</choices>
|
||||
</entry>
|
||||
|
||||
<entry key="FocusPolicy" type="Enum">
|
||||
<default>ClickToFocus</default>
|
||||
<choices>
|
||||
<choice name="ClickToFocus"/>
|
||||
<choice name="FocusFollowsMouse"/>
|
||||
<choice name="FocusUnderMouse"/>
|
||||
<choice name="FocusStrictlyUnderMouse"/>
|
||||
</choices>
|
||||
</entry>
|
||||
|
||||
<entry key="NextFocusPrefersMouse" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
|
||||
<entry key="AutoRaiseInterval" type="Int">
|
||||
<default>750</default>
|
||||
<min>0</min>
|
||||
</entry>
|
||||
|
||||
<entry key="DelayFocusInterval" type="Int">
|
||||
<default>300</default>
|
||||
<min>0</min>
|
||||
</entry>
|
||||
|
||||
<entry key="AutoRaise" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
|
||||
<entry key="ClickRaise" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
|
||||
<entry key="SeparateScreenFocus" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
|
||||
<entry key="ActiveMouseScreen" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
|
||||
<entry key="FocusStealingPreventionLevel" type="Int">
|
||||
<default>1</default>
|
||||
<min>0</min>
|
||||
<max>4</max>
|
||||
</entry>
|
||||
|
||||
</group>
|
||||
|
||||
<group name="MouseBindings">
|
||||
|
|
|
@ -3,4 +3,3 @@ ClassName=KWinOptionsSettings
|
|||
Mutators=true
|
||||
DefaultValueGetters=true
|
||||
ParentInConstructor=true
|
||||
Singleton=true
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "mouse.h"
|
||||
#include "windows.h"
|
||||
#include "kwinoptions_settings.h"
|
||||
|
||||
K_PLUGIN_FACTORY_DECLARATION(KWinOptionsFactory)
|
||||
|
||||
|
@ -41,7 +42,7 @@ class KFocusConfigStandalone : public KFocusConfig
|
|||
Q_OBJECT
|
||||
public:
|
||||
KFocusConfigStandalone(QWidget* parent, const QVariantList &)
|
||||
: KFocusConfig(true, new KConfig("kwinrc"), parent)
|
||||
: KFocusConfig(true, new KWinOptionsSettings(this), parent)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -50,7 +51,7 @@ class KMovingConfigStandalone : public KMovingConfig
|
|||
Q_OBJECT
|
||||
public:
|
||||
KMovingConfigStandalone(QWidget* parent, const QVariantList &)
|
||||
: KMovingConfig(true, parent)
|
||||
: KMovingConfig(true, new KWinOptionsSettings(this), parent)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -59,44 +60,49 @@ class KAdvancedConfigStandalone : public KAdvancedConfig
|
|||
Q_OBJECT
|
||||
public:
|
||||
KAdvancedConfigStandalone(QWidget* parent, const QVariantList &)
|
||||
: KAdvancedConfig(true, parent)
|
||||
: KAdvancedConfig(true, new KWinOptionsSettings(this), parent)
|
||||
{}
|
||||
};
|
||||
|
||||
KWinOptions::KWinOptions(QWidget *parent, const QVariantList &)
|
||||
: KCModule(parent)
|
||||
{
|
||||
mConfig = new KConfig("kwinrc");
|
||||
mSettings = new KWinOptionsSettings(this);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
tab = new QTabWidget(this);
|
||||
layout->addWidget(tab);
|
||||
|
||||
mFocus = new KFocusConfig(false, mConfig, this);
|
||||
mFocus = new KFocusConfig(false, mSettings, this);
|
||||
mFocus->setObjectName(QLatin1String("KWin Focus Config"));
|
||||
tab->addTab(mFocus, i18n("&Focus"));
|
||||
connect(mFocus, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
|
||||
connect(mFocus, qOverload<bool>(&KCModule::defaulted), this, qOverload<bool>(&KCModule::defaulted));
|
||||
|
||||
mTitleBarActions = new KTitleBarActionsConfig(false, this);
|
||||
// Need to relay unmanagedWidgetDefaultState and unmanagedWidgetChangeState to wrapping KCModule
|
||||
connect(mFocus, &KFocusConfig::unmanagedWidgetDefaulted, this, &KWinOptions::unmanagedWidgetDefaultState);
|
||||
connect(mFocus, &KFocusConfig::unmanagedWidgetStateChanged, this, &KWinOptions::unmanagedWidgetChangeState);
|
||||
|
||||
mTitleBarActions = new KTitleBarActionsConfig(false, mSettings, this);
|
||||
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
|
||||
tab->addTab(mTitleBarActions, i18n("Titlebar A&ctions"));
|
||||
connect(mTitleBarActions, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
|
||||
connect(mTitleBarActions, qOverload<bool>(&KCModule::defaulted), this, qOverload<bool>(&KCModule::defaulted));
|
||||
|
||||
mWindowActions = new KWindowActionsConfig(false, this);
|
||||
mWindowActions = new KWindowActionsConfig(false, mSettings, this);
|
||||
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
|
||||
tab->addTab(mWindowActions, i18n("W&indow Actions"));
|
||||
connect(mWindowActions, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
|
||||
connect(mWindowActions, qOverload<bool>(&KCModule::defaulted), this, qOverload<bool>(&KCModule::defaulted));
|
||||
|
||||
mMoving = new KMovingConfig(false, this);
|
||||
mMoving = new KMovingConfig(false, mSettings, this);
|
||||
mMoving->setObjectName(QLatin1String("KWin Moving"));
|
||||
tab->addTab(mMoving, i18n("Mo&vement"));
|
||||
connect(mMoving, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
|
||||
connect(mMoving, qOverload<bool>(&KCModule::defaulted), this, qOverload<bool>(&KCModule::defaulted));
|
||||
|
||||
mAdvanced = new KAdvancedConfig(false, this);
|
||||
mAdvanced = new KAdvancedConfig(false, mSettings, this);
|
||||
mAdvanced->setObjectName(QLatin1String("KWin Advanced"));
|
||||
tab->addTab(mAdvanced, i18n("Adva&nced"));
|
||||
connect(mAdvanced, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
|
||||
|
@ -119,23 +125,17 @@ KWinOptions::KWinOptions(QWidget *parent, const QVariantList &)
|
|||
setAboutData(about);
|
||||
}
|
||||
|
||||
KWinOptions::~KWinOptions()
|
||||
{
|
||||
delete mConfig;
|
||||
}
|
||||
|
||||
void KWinOptions::load()
|
||||
{
|
||||
mConfig->reparseConfiguration();
|
||||
mFocus->load();
|
||||
mTitleBarActions->load();
|
||||
mWindowActions->load();
|
||||
mMoving->load();
|
||||
mAdvanced->load();
|
||||
emit KCModule::changed(false);
|
||||
// mFocus is last because it may send unmanagedWidgetStateChanged
|
||||
// that need to have the final word
|
||||
mFocus->load();
|
||||
}
|
||||
|
||||
|
||||
void KWinOptions::save()
|
||||
{
|
||||
mFocus->save();
|
||||
|
@ -145,8 +145,7 @@ void KWinOptions::save()
|
|||
mAdvanced->save();
|
||||
|
||||
emit KCModule::changed(false);
|
||||
// Send signal to kwin
|
||||
mConfig->sync();
|
||||
|
||||
// Send signal to all kwin instances
|
||||
QDBusMessage message =
|
||||
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
||||
|
@ -156,11 +155,13 @@ void KWinOptions::save()
|
|||
|
||||
void KWinOptions::defaults()
|
||||
{
|
||||
mFocus->defaults();
|
||||
mTitleBarActions->defaults();
|
||||
mWindowActions->defaults();
|
||||
mMoving->defaults();
|
||||
mAdvanced->defaults();
|
||||
// mFocus is last because it may send unmanagedWidgetDefaulted
|
||||
// that need to have the final word
|
||||
mFocus->defaults();
|
||||
}
|
||||
|
||||
QString KWinOptions::quickHelp() const
|
||||
|
@ -176,31 +177,26 @@ QString KWinOptions::quickHelp() const
|
|||
KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &)
|
||||
: KCModule(parent)
|
||||
{
|
||||
mConfig = new KConfig("kwinrc");
|
||||
mSettings = new KWinOptionsSettings(this);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
tab = new QTabWidget(this);
|
||||
layout->addWidget(tab);
|
||||
|
||||
mTitleBarActions = new KTitleBarActionsConfig(false, this);
|
||||
mTitleBarActions = new KTitleBarActionsConfig(false, mSettings, this);
|
||||
mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions"));
|
||||
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
|
||||
connect(mTitleBarActions, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
|
||||
connect(mTitleBarActions, qOverload<bool>(&KCModule::defaulted), this, qOverload<bool>(&KCModule::defaulted));
|
||||
|
||||
mWindowActions = new KWindowActionsConfig(false, this);
|
||||
mWindowActions = new KWindowActionsConfig(false, mSettings, this);
|
||||
mWindowActions->setObjectName(QLatin1String("KWin Window Actions"));
|
||||
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
|
||||
connect(mWindowActions, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
|
||||
connect(mWindowActions, qOverload<bool>(&KCModule::defaulted), this, qOverload<bool>(&KCModule::defaulted));
|
||||
}
|
||||
|
||||
KActionsOptions::~KActionsOptions()
|
||||
{
|
||||
delete mConfig;
|
||||
}
|
||||
|
||||
void KActionsOptions::load()
|
||||
{
|
||||
mTitleBarActions->load();
|
||||
|
@ -213,8 +209,6 @@ void KActionsOptions::save()
|
|||
mWindowActions->save();
|
||||
|
||||
emit KCModule::changed(false);
|
||||
// Send signal to kwin
|
||||
mConfig->sync();
|
||||
// Send signal to all kwin instances
|
||||
QDBusMessage message =
|
||||
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <QTabWidget>
|
||||
#include <kcmodule.h>
|
||||
|
||||
class KConfig;
|
||||
class KWinOptionsSettings;
|
||||
class KFocusConfig;
|
||||
class KTitleBarActionsConfig;
|
||||
class KWindowActionsConfig;
|
||||
|
@ -42,7 +42,6 @@ class KWinOptions : public KCModule
|
|||
public:
|
||||
|
||||
KWinOptions(QWidget *parent, const QVariantList &args);
|
||||
~KWinOptions() override;
|
||||
|
||||
void load() override;
|
||||
void save() override;
|
||||
|
@ -59,7 +58,7 @@ private:
|
|||
KMovingConfig *mMoving;
|
||||
KAdvancedConfig *mAdvanced;
|
||||
|
||||
KConfig *mConfig;
|
||||
KWinOptionsSettings *mSettings;
|
||||
};
|
||||
|
||||
class KActionsOptions : public KCModule
|
||||
|
@ -69,7 +68,6 @@ class KActionsOptions : public KCModule
|
|||
public:
|
||||
|
||||
KActionsOptions(QWidget *parent, const QVariantList &args);
|
||||
~KActionsOptions() override;
|
||||
|
||||
void load() override;
|
||||
void save() override;
|
||||
|
@ -79,7 +77,6 @@ protected Q_SLOTS:
|
|||
|
||||
void moduleChanged(bool state);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QTabWidget *tab;
|
||||
|
@ -87,7 +84,7 @@ private:
|
|||
KTitleBarActionsConfig *mTitleBarActions;
|
||||
KWindowActionsConfig *mWindowActions;
|
||||
|
||||
KConfig *mConfig;
|
||||
KWinOptionsSettings *mSettings;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -136,11 +136,12 @@ void KTitleBarActionsConfig::paletteChanged()
|
|||
|
||||
}
|
||||
|
||||
KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, QWidget *parent)
|
||||
KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
|
||||
: KCModule(parent), standAlone(_standAlone)
|
||||
, m_ui(new KWinMouseConfigForm(this))
|
||||
, m_settings(settings)
|
||||
{
|
||||
addConfig(KWinOptionsSettings::self(), this);
|
||||
addConfig(m_settings, this);
|
||||
|
||||
// create the items for the maximize button actions
|
||||
createMaxButtonPixmaps();
|
||||
|
@ -193,11 +194,12 @@ void KTitleBarActionsConfig::save()
|
|||
}
|
||||
}
|
||||
|
||||
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, QWidget *parent)
|
||||
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
|
||||
: KCModule(parent), standAlone(_standAlone)
|
||||
, m_ui(new KWinActionsConfigForm(this))
|
||||
, m_settings(settings)
|
||||
{
|
||||
addConfig(KWinOptionsSettings::self(), this);
|
||||
addConfig(m_settings, this);
|
||||
load();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ class KConfig;
|
|||
#include "ui_actions.h"
|
||||
#include "ui_mouse.h"
|
||||
|
||||
class KWinOptionsSettings;
|
||||
|
||||
class KWinMouseConfigForm : public QWidget, public Ui::KWinMouseConfigForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -53,7 +55,7 @@ class KTitleBarActionsConfig : public KCModule
|
|||
|
||||
public:
|
||||
|
||||
KTitleBarActionsConfig(bool _standAlone, QWidget *parent);
|
||||
KTitleBarActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent);
|
||||
|
||||
void save() override;
|
||||
|
||||
|
@ -65,6 +67,7 @@ private:
|
|||
bool standAlone;
|
||||
|
||||
KWinMouseConfigForm *m_ui;
|
||||
KWinOptionsSettings *m_settings;
|
||||
|
||||
void createMaximizeButtonTooltips(KComboBox* combo);
|
||||
|
||||
|
@ -79,7 +82,7 @@ class KWindowActionsConfig : public KCModule
|
|||
|
||||
public:
|
||||
|
||||
KWindowActionsConfig(bool _standAlone, QWidget *parent);
|
||||
KWindowActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent);
|
||||
|
||||
void save() override;
|
||||
|
||||
|
@ -90,6 +93,7 @@ private:
|
|||
bool standAlone;
|
||||
|
||||
KWinActionsConfigForm *m_ui;
|
||||
KWinOptionsSettings *m_settings;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <QDesktopWidget>
|
||||
#include <QtDBus>
|
||||
#include <QGroupBox>
|
||||
#include <QScreen>
|
||||
|
||||
#include <KConfig>
|
||||
#include <KConfigGroup>
|
||||
|
@ -41,28 +42,15 @@
|
|||
#include <effect_builtins.h>
|
||||
#include <kwin_effects_interface.h>
|
||||
|
||||
// kwin config keywords
|
||||
#define KWIN_FOCUS "FocusPolicy"
|
||||
#define KWIN_AUTORAISE_INTERVAL "AutoRaiseInterval"
|
||||
#define KWIN_AUTORAISE "AutoRaise"
|
||||
#define KWIN_DELAYFOCUS_INTERVAL "DelayFocusInterval"
|
||||
#define KWIN_CLICKRAISE "ClickRaise"
|
||||
#define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel"
|
||||
#define KWIN_INACTIVE_SKIP_TASKBAR "InactiveTabsSkipTaskbar"
|
||||
#define KWIN_SEPARATE_SCREEN_FOCUS "SeparateScreenFocus"
|
||||
#define KWIN_ACTIVE_MOUSE_SCREEN "ActiveMouseScreen"
|
||||
#include "kwinoptions_settings.h"
|
||||
#include <KConfigDialogManager>
|
||||
|
||||
#define CLICK_TO_FOCUS 0
|
||||
#define FOCUS_FOLLOWS_MOUSE 2
|
||||
#define FOCUS_UNDER_MOUSE 4
|
||||
#define FOCUS_STRICTLY_UNDER_MOUSE 5
|
||||
|
||||
|
||||
KFocusConfig::~KFocusConfig()
|
||||
{
|
||||
if (standAlone)
|
||||
delete config;
|
||||
}
|
||||
#define CLICK_TO_FOCUS 0
|
||||
#define CLICK_TO_FOCUS_MOUSE_PRECEDENT 1
|
||||
#define FOCUS_FOLLOWS_MOUSE 2
|
||||
#define FOCUS_FOLLOWS_MOUSE_PRECEDENT 3
|
||||
#define FOCUS_UNDER_MOUSE 4
|
||||
#define FOCUS_STRICTLY_UNDER_MOUSE 5
|
||||
|
||||
KWinFocusConfigForm::KWinFocusConfigForm(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
|
@ -70,25 +58,17 @@ KWinFocusConfigForm::KWinFocusConfigForm(QWidget* parent)
|
|||
setupUi(parent);
|
||||
}
|
||||
|
||||
// removed the LCD display over the slider - this is not good GUI design :) RNolden 051701
|
||||
KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, QWidget * parent)
|
||||
: KCModule(parent), config(_config), standAlone(_standAlone)
|
||||
KFocusConfig::KFocusConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget * parent)
|
||||
: KCModule(parent), standAlone(_standAlone)
|
||||
, m_ui(new KWinFocusConfigForm(this))
|
||||
, m_settings(settings)
|
||||
{
|
||||
connect(m_ui->focusStealing, SIGNAL(activated(int)), SLOT(changed()));
|
||||
connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed()));
|
||||
connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(focusPolicyChanged()));
|
||||
connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelayFocusEnabled()));
|
||||
connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActiveMouseScreen()));
|
||||
connect(m_ui->autoRaiseOn, SIGNAL(clicked()), SLOT(changed()));
|
||||
connect(m_ui->autoRaiseOn, SIGNAL(toggled(bool)), SLOT(autoRaiseOnTog(bool)));
|
||||
connect(m_ui->clickRaiseOn, SIGNAL(clicked()), SLOT(changed()));
|
||||
connect(m_ui->autoRaise, SIGNAL(valueChanged(int)), SLOT(changed()));
|
||||
connect(m_ui->delayFocus, SIGNAL(valueChanged(int)), SLOT(changed()));
|
||||
connect(m_ui->separateScreenFocus, SIGNAL(clicked()), SLOT(changed()));
|
||||
connect(m_ui->activeMouseScreen, SIGNAL(clicked()), SLOT(changed()));
|
||||
addConfig(m_settings, this);
|
||||
|
||||
connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(updateMultiScreen()));
|
||||
connect(m_ui->windowFocusPolicy, qOverload<int>(&QComboBox::currentIndexChanged), this, &KFocusConfig::focusPolicyChanged);
|
||||
|
||||
connect(qApp, &QGuiApplication::screenAdded, this, &KFocusConfig::updateMultiScreen);
|
||||
connect(qApp, &QGuiApplication::screenRemoved, this, &KFocusConfig::updateMultiScreen);
|
||||
updateMultiScreen();
|
||||
|
||||
load();
|
||||
|
@ -97,135 +77,67 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, QWidget * parent)
|
|||
void KFocusConfig::updateMultiScreen()
|
||||
{
|
||||
m_ui->multiscreenBehaviorLabel->setVisible(QApplication::screens().count() > 1);
|
||||
m_ui->activeMouseScreen->setVisible(QApplication::screens().count() > 1);
|
||||
m_ui->separateScreenFocus->setVisible(QApplication::screens().count() > 1);
|
||||
}
|
||||
|
||||
|
||||
int KFocusConfig::getFocus()
|
||||
{
|
||||
int policy = m_ui->windowFocusPolicyCombo->currentIndex();
|
||||
if (policy == 1 || policy == 3)
|
||||
--policy; // fix the NextFocusPrefersMouse condition
|
||||
return policy;
|
||||
}
|
||||
|
||||
void KFocusConfig::setFocus(int foc)
|
||||
{
|
||||
m_ui->windowFocusPolicyCombo->setCurrentIndex(foc);
|
||||
|
||||
// this will disable/hide the auto raise delay widget if focus==click
|
||||
focusPolicyChanged();
|
||||
}
|
||||
|
||||
void KFocusConfig::setAutoRaiseInterval(int tb)
|
||||
{
|
||||
m_ui->autoRaise->setValue(tb);
|
||||
}
|
||||
|
||||
void KFocusConfig::setDelayFocusInterval(int tb)
|
||||
{
|
||||
m_ui->delayFocus->setValue(tb);
|
||||
}
|
||||
|
||||
int KFocusConfig::getAutoRaiseInterval()
|
||||
{
|
||||
return m_ui->autoRaise->value();
|
||||
}
|
||||
|
||||
int KFocusConfig::getDelayFocusInterval()
|
||||
{
|
||||
return m_ui->delayFocus->value();
|
||||
}
|
||||
|
||||
void KFocusConfig::setAutoRaise(bool on)
|
||||
{
|
||||
m_ui->autoRaiseOn->setChecked(on);
|
||||
}
|
||||
|
||||
void KFocusConfig::setClickRaise(bool on)
|
||||
{
|
||||
m_ui->clickRaiseOn->setChecked(on);
|
||||
m_ui->kcfg_ActiveMouseScreen->setVisible(QApplication::screens().count() > 1);
|
||||
m_ui->kcfg_SeparateScreenFocus->setVisible(QApplication::screens().count() > 1);
|
||||
}
|
||||
|
||||
void KFocusConfig::focusPolicyChanged()
|
||||
{
|
||||
switch (m_ui->windowFocusPolicyCombo->currentIndex()) {
|
||||
case 0:
|
||||
int selectedFocusPolicy = 0;
|
||||
bool selectedNextFocusPrefersMouseItem = false;
|
||||
const bool loadedNextFocusPrefersMouseItem = m_settings->nextFocusPrefersMouse();
|
||||
|
||||
int focusPolicy = m_ui->windowFocusPolicy->currentIndex();
|
||||
switch (focusPolicy) {
|
||||
case CLICK_TO_FOCUS:
|
||||
m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<em>Click to focus:</em> A window becomes active when you click into it. This behavior is common on other operating systems and likely what you want."));
|
||||
selectedFocusPolicy = KWinOptionsSettings::EnumFocusPolicy::ClickToFocus;
|
||||
break;
|
||||
case 1:
|
||||
case CLICK_TO_FOCUS_MOUSE_PRECEDENT:
|
||||
m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<em>Click to focus (mouse precedence):</em> Mostly the same as <em>Click to focus</em>. If an active window has to be chosen by the system (eg. because the currently active one was closed) the window under the mouse is the preferred candidate. Unusual, but possible variant of <em>Click to focus</em>."));
|
||||
selectedFocusPolicy = KWinOptionsSettings::EnumFocusPolicy::ClickToFocus;
|
||||
selectedNextFocusPrefersMouseItem = true;
|
||||
break;
|
||||
case 2:
|
||||
case FOCUS_FOLLOWS_MOUSE:
|
||||
m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<em>Focus follows mouse:</em> Moving the mouse onto a window will activate it. Eg. windows randomly appearing under the mouse will not gain the focus. <em>Focus stealing prevention</em> takes place as usual. Think as <em>Click to focus</em> just without having to actually click."));
|
||||
selectedFocusPolicy = KWinOptionsSettings::EnumFocusPolicy::FocusFollowsMouse;
|
||||
break;
|
||||
case 3:
|
||||
case FOCUS_FOLLOWS_MOUSE_PRECEDENT:
|
||||
m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("This is mostly the same as <em>Focus follows mouse</em>. If an active window has to be chosen by the system (eg. because the currently active one was closed) the window under the mouse is the preferred candidate. Choose this, if you want a hover controlled focus."));
|
||||
selectedFocusPolicy = KWinOptionsSettings::EnumFocusPolicy::FocusFollowsMouse;
|
||||
selectedNextFocusPrefersMouseItem = true;
|
||||
break;
|
||||
case 4:
|
||||
case FOCUS_UNDER_MOUSE:
|
||||
m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<em>Focus under mouse:</em> The focus always remains on the window under the mouse.<br/><strong>Warning:</strong> <em>Focus stealing prevention</em> and the <em>tabbox ('Alt+Tab')</em> contradict the activation policy and will not work. You very likely want to use <em>Focus follows mouse (mouse precedence)</em> instead!"));
|
||||
selectedFocusPolicy = KWinOptionsSettings::EnumFocusPolicy::FocusUnderMouse;
|
||||
break;
|
||||
case 5:
|
||||
case FOCUS_STRICTLY_UNDER_MOUSE:
|
||||
m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<em>Focus strictly under mouse:</em> The focus is always on the window under the mouse (in doubt nowhere) very much like the focus behavior in an unmanaged legacy X11 environment.<br/><strong>Warning:</strong> <em>Focus stealing prevention</em> and the <em>tabbox ('Alt+Tab')</em> contradict the activation policy and will not work. You very likely want to use <em>Focus follows mouse (mouse precedence)</em> instead!"));
|
||||
selectedFocusPolicy = KWinOptionsSettings::EnumFocusPolicy::FocusStrictlyUnderMouse;
|
||||
break;
|
||||
}
|
||||
|
||||
int policyIndex = getFocus();
|
||||
const bool changed = m_settings->focusPolicy() != selectedFocusPolicy || loadedNextFocusPrefersMouseItem != selectedNextFocusPrefersMouseItem;
|
||||
unmanagedWidgetChangeState(changed);
|
||||
emit unmanagedWidgetStateChanged(changed);
|
||||
|
||||
const bool isDefault = focusPolicy == CLICK_TO_FOCUS;
|
||||
unmanagedWidgetDefaultState(isDefault);
|
||||
emit unmanagedWidgetDefaulted(isDefault);
|
||||
|
||||
// the auto raise related widgets are: autoRaise
|
||||
m_ui->autoRaiseOn->setEnabled(policyIndex != CLICK_TO_FOCUS);
|
||||
autoRaiseOnTog(policyIndex != CLICK_TO_FOCUS && m_ui->autoRaiseOn->isChecked());
|
||||
m_ui->kcfg_AutoRaise->setEnabled(focusPolicy != CLICK_TO_FOCUS && focusPolicy != CLICK_TO_FOCUS_MOUSE_PRECEDENT);
|
||||
|
||||
m_ui->focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE);
|
||||
m_ui->focusStealingLabel->setEnabled(m_ui->focusStealing->isEnabled());
|
||||
|
||||
setDelayFocusEnabled();
|
||||
|
||||
}
|
||||
|
||||
void KFocusConfig::setDelayFocusEnabled()
|
||||
{
|
||||
int policyIndex = getFocus();
|
||||
m_ui->kcfg_FocusStealingPreventionLevel->setDisabled(focusPolicy == FOCUS_UNDER_MOUSE || focusPolicy == FOCUS_STRICTLY_UNDER_MOUSE);
|
||||
|
||||
// the delayed focus related widgets are: delayFocus
|
||||
m_ui->delayFocusOnLabel->setEnabled(policyIndex != CLICK_TO_FOCUS);
|
||||
delayFocusOnTog(policyIndex != CLICK_TO_FOCUS);
|
||||
}
|
||||
m_ui->delayFocusOnLabel->setEnabled(focusPolicy != CLICK_TO_FOCUS);
|
||||
m_ui->kcfg_DelayFocusInterval->setEnabled(focusPolicy != CLICK_TO_FOCUS);
|
||||
|
||||
void KFocusConfig::autoRaiseOnTog(bool a)
|
||||
{
|
||||
m_ui->autoRaise->setEnabled(a);
|
||||
m_ui->clickRaiseOn->setEnabled(!a);
|
||||
}
|
||||
|
||||
void KFocusConfig::delayFocusOnTog(bool a)
|
||||
{
|
||||
m_ui->delayFocus->setEnabled(a);
|
||||
}
|
||||
|
||||
void KFocusConfig::setFocusStealing(int l)
|
||||
{
|
||||
l = qMax(0, qMin(4, l));
|
||||
m_ui->focusStealing->setCurrentIndex(l);
|
||||
}
|
||||
|
||||
void KFocusConfig::setSeparateScreenFocus(bool s)
|
||||
{
|
||||
m_ui->separateScreenFocus->setChecked(s);
|
||||
}
|
||||
|
||||
void KFocusConfig::setActiveMouseScreen(bool a)
|
||||
{
|
||||
m_ui->activeMouseScreen->setChecked(a);
|
||||
}
|
||||
|
||||
void KFocusConfig::updateActiveMouseScreen()
|
||||
{
|
||||
// on by default for non click to focus policies
|
||||
KConfigGroup cfg(config, "Windows");
|
||||
if (!cfg.hasKey(KWIN_ACTIVE_MOUSE_SCREEN))
|
||||
setActiveMouseScreen(getFocus() != 0);
|
||||
if (m_settings->activeMouseScreen() == m_settings->defaultActiveMouseScreenValue()) {
|
||||
m_ui->kcfg_ActiveMouseScreen->setChecked(focusPolicy != CLICK_TO_FOCUS && focusPolicy != CLICK_TO_FOCUS_MOUSE_PRECEDENT);
|
||||
}
|
||||
}
|
||||
|
||||
void KFocusConfig::showEvent(QShowEvent *ev)
|
||||
|
@ -239,85 +151,56 @@ void KFocusConfig::showEvent(QShowEvent *ev)
|
|||
|
||||
void KFocusConfig::load(void)
|
||||
{
|
||||
QString key;
|
||||
KCModule::load();
|
||||
|
||||
KConfigGroup cg(config, "Windows");
|
||||
const bool loadedNextFocusPrefersMouseItem = m_settings->nextFocusPrefersMouse();
|
||||
|
||||
const bool focusNextToMouse = cg.readEntry("NextFocusPrefersMouse", false);
|
||||
int focusPolicy = m_settings->focusPolicy();
|
||||
|
||||
key = cg.readEntry(KWIN_FOCUS);
|
||||
if (key == "ClickToFocus")
|
||||
setFocus(CLICK_TO_FOCUS + focusNextToMouse);
|
||||
else if (key == "FocusFollowsMouse")
|
||||
setFocus(FOCUS_FOLLOWS_MOUSE + focusNextToMouse);
|
||||
else if (key == "FocusUnderMouse")
|
||||
setFocus(FOCUS_UNDER_MOUSE);
|
||||
else if (key == "FocusStrictlyUnderMouse")
|
||||
setFocus(FOCUS_STRICTLY_UNDER_MOUSE);
|
||||
|
||||
int k = cg.readEntry(KWIN_AUTORAISE_INTERVAL, 750);
|
||||
setAutoRaiseInterval(k);
|
||||
|
||||
k = cg.readEntry(KWIN_DELAYFOCUS_INTERVAL, 300);
|
||||
setDelayFocusInterval(k);
|
||||
|
||||
setAutoRaise(cg.readEntry(KWIN_AUTORAISE, false));
|
||||
setClickRaise(cg.readEntry(KWIN_CLICKRAISE, true));
|
||||
focusPolicyChanged(); // this will disable/hide the auto raise delay widget if focus==click
|
||||
|
||||
setSeparateScreenFocus(cg.readEntry(KWIN_SEPARATE_SCREEN_FOCUS, false));
|
||||
// on by default for non click to focus policies
|
||||
setActiveMouseScreen(cg.readEntry(KWIN_ACTIVE_MOUSE_SCREEN, getFocus() != 0));
|
||||
|
||||
// setFocusStealing( cg.readEntry(KWIN_FOCUS_STEALING, 2 ));
|
||||
// TODO default to low for now
|
||||
setFocusStealing(cg.readEntry(KWIN_FOCUS_STEALING, 1));
|
||||
|
||||
|
||||
emit KCModule::changed(false);
|
||||
switch (focusPolicy) {
|
||||
// the ClickToFocus and FocusFollowsMouse have special values when
|
||||
// NextFocusPrefersMouse is true
|
||||
case KWinOptionsSettings::EnumFocusPolicy::ClickToFocus:
|
||||
m_ui->windowFocusPolicy->setCurrentIndex(CLICK_TO_FOCUS + loadedNextFocusPrefersMouseItem);
|
||||
break;
|
||||
case KWinOptionsSettings::EnumFocusPolicy::FocusFollowsMouse:
|
||||
m_ui->windowFocusPolicy->setCurrentIndex(FOCUS_FOLLOWS_MOUSE + loadedNextFocusPrefersMouseItem);
|
||||
break;
|
||||
default:
|
||||
// +2 to ignore the two special values
|
||||
m_ui->windowFocusPolicy->setCurrentIndex(focusPolicy + 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void KFocusConfig::save(void)
|
||||
{
|
||||
int v;
|
||||
KCModule::save();
|
||||
|
||||
KConfigGroup cg(config, "Windows");
|
||||
|
||||
v = getFocus();
|
||||
if (v == CLICK_TO_FOCUS)
|
||||
cg.writeEntry(KWIN_FOCUS, "ClickToFocus");
|
||||
else if (v == FOCUS_UNDER_MOUSE)
|
||||
cg.writeEntry(KWIN_FOCUS, "FocusUnderMouse");
|
||||
else if (v == FOCUS_STRICTLY_UNDER_MOUSE)
|
||||
cg.writeEntry(KWIN_FOCUS, "FocusStrictlyUnderMouse");
|
||||
else
|
||||
cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse");
|
||||
|
||||
cg.writeEntry("NextFocusPrefersMouse", v != m_ui->windowFocusPolicyCombo->currentIndex());
|
||||
|
||||
v = getAutoRaiseInterval();
|
||||
if (v < 0) v = 0;
|
||||
cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v);
|
||||
|
||||
v = getDelayFocusInterval();
|
||||
if (v < 0) v = 0;
|
||||
cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL, v);
|
||||
|
||||
cg.writeEntry(KWIN_AUTORAISE, m_ui->autoRaiseOn->isChecked());
|
||||
|
||||
cg.writeEntry(KWIN_CLICKRAISE, m_ui->clickRaiseOn->isChecked());
|
||||
|
||||
cg.writeEntry(KWIN_SEPARATE_SCREEN_FOCUS, m_ui->separateScreenFocus->isChecked());
|
||||
cg.writeEntry(KWIN_ACTIVE_MOUSE_SCREEN, m_ui->activeMouseScreen->isChecked());
|
||||
|
||||
cg.writeEntry(KWIN_FOCUS_STEALING, m_ui->focusStealing->currentIndex());
|
||||
|
||||
cg.writeEntry(KWIN_SEPARATE_SCREEN_FOCUS, m_ui->separateScreenFocus->isChecked());
|
||||
cg.writeEntry(KWIN_ACTIVE_MOUSE_SCREEN, m_ui->activeMouseScreen->isChecked());
|
||||
int idxFocusPolicy = m_ui->windowFocusPolicy->currentIndex();
|
||||
switch (idxFocusPolicy) {
|
||||
case CLICK_TO_FOCUS:
|
||||
case CLICK_TO_FOCUS_MOUSE_PRECEDENT:
|
||||
m_settings->setFocusPolicy(KWinOptionsSettings::EnumFocusPolicy::ClickToFocus);
|
||||
break;
|
||||
case FOCUS_FOLLOWS_MOUSE:
|
||||
case FOCUS_FOLLOWS_MOUSE_PRECEDENT:
|
||||
// the ClickToFocus and FocusFollowsMouse have special values when
|
||||
// NextFocusPrefersMouse is true
|
||||
m_settings->setFocusPolicy(KWinOptionsSettings::EnumFocusPolicy::FocusFollowsMouse);
|
||||
break;
|
||||
case FOCUS_UNDER_MOUSE:
|
||||
m_settings->setFocusPolicy(KWinOptionsSettings::EnumFocusPolicy::FocusUnderMouse);
|
||||
break;
|
||||
case FOCUS_STRICTLY_UNDER_MOUSE:
|
||||
m_settings->setFocusPolicy(KWinOptionsSettings::EnumFocusPolicy::FocusStrictlyUnderMouse);
|
||||
break;
|
||||
}
|
||||
m_settings->setNextFocusPrefersMouse(idxFocusPolicy == CLICK_TO_FOCUS_MOUSE_PRECEDENT || idxFocusPolicy == FOCUS_FOLLOWS_MOUSE_PRECEDENT);
|
||||
|
||||
m_settings->save();
|
||||
|
||||
if (standAlone) {
|
||||
config->sync();
|
||||
// Send signal to all kwin instances
|
||||
QDBusMessage message =
|
||||
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
||||
|
@ -328,21 +211,8 @@ void KFocusConfig::save(void)
|
|||
|
||||
void KFocusConfig::defaults()
|
||||
{
|
||||
setAutoRaiseInterval(0);
|
||||
setDelayFocusInterval(0);
|
||||
setFocus(CLICK_TO_FOCUS);
|
||||
setAutoRaise(false);
|
||||
setClickRaise(true);
|
||||
setSeparateScreenFocus(false);
|
||||
|
||||
// setFocusStealing(2);
|
||||
// TODO default to low for now
|
||||
setFocusStealing(1);
|
||||
|
||||
// on by default for non click to focus policies
|
||||
setActiveMouseScreen(getFocus() != 0);
|
||||
setDelayFocusEnabled();
|
||||
emit KCModule::changed(true);
|
||||
KCModule::defaults();
|
||||
m_ui->windowFocusPolicy->setCurrentIndex(CLICK_TO_FOCUS);
|
||||
}
|
||||
|
||||
KWinAdvancedConfigForm::KWinAdvancedConfigForm(QWidget* parent)
|
||||
|
@ -351,15 +221,12 @@ KWinAdvancedConfigForm::KWinAdvancedConfigForm(QWidget* parent)
|
|||
setupUi(parent);
|
||||
}
|
||||
|
||||
KAdvancedConfig::~KAdvancedConfig()
|
||||
{
|
||||
}
|
||||
|
||||
KAdvancedConfig::KAdvancedConfig(bool _standAlone, QWidget *parent)
|
||||
: KCModule(parent), m_config(KWinOptionsSettings::self()), standAlone(_standAlone)
|
||||
KAdvancedConfig::KAdvancedConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
|
||||
: KCModule(parent), standAlone(_standAlone)
|
||||
, m_ui(new KWinAdvancedConfigForm(this))
|
||||
, m_settings(settings)
|
||||
{
|
||||
addConfig(m_config, this);
|
||||
addConfig(m_settings, this);
|
||||
|
||||
m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Smart, "Smart");
|
||||
m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Maximizing, "Maximizing");
|
||||
|
@ -399,12 +266,8 @@ KWinMovingConfigForm::KWinMovingConfigForm(QWidget* parent)
|
|||
setupUi(parent);
|
||||
}
|
||||
|
||||
KMovingConfig::~KMovingConfig()
|
||||
{
|
||||
}
|
||||
|
||||
KMovingConfig::KMovingConfig(bool _standAlone, QWidget *parent)
|
||||
: KCModule(parent), m_config(KWinOptionsSettings::self()), standAlone(_standAlone)
|
||||
KMovingConfig::KMovingConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
|
||||
: KCModule(parent), m_config(settings), standAlone(_standAlone)
|
||||
, m_ui(new KWinMovingConfigForm(this))
|
||||
{
|
||||
addConfig(m_config, this);
|
||||
|
@ -422,7 +285,7 @@ void KMovingConfig::showEvent(QShowEvent *ev)
|
|||
|
||||
void KMovingConfig::save(void)
|
||||
{
|
||||
m_config->save();
|
||||
KCModule::save();
|
||||
|
||||
if (standAlone) {
|
||||
// Send signal to all kwin instances
|
||||
|
|
|
@ -71,56 +71,36 @@ class KFocusConfig : public KCModule
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KFocusConfig(bool _standAlone, KConfig *_config, QWidget *parent);
|
||||
~KFocusConfig() override;
|
||||
KFocusConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent);
|
||||
|
||||
void load() override;
|
||||
void save() override;
|
||||
void defaults() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void unmanagedWidgetDefaulted(bool defaulted);
|
||||
void unmanagedWidgetStateChanged(bool changed);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *ev) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void setDelayFocusEnabled();
|
||||
void focusPolicyChanged();
|
||||
void autoRaiseOnTog(bool);//CT 23Oct1998
|
||||
void delayFocusOnTog(bool);
|
||||
void updateActiveMouseScreen();
|
||||
void updateMultiScreen();
|
||||
void changed() {
|
||||
emit KCModule::changed(true);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
int getFocus(void);
|
||||
int getAutoRaiseInterval(void);
|
||||
int getDelayFocusInterval(void);
|
||||
|
||||
void setFocus(int);
|
||||
void setAutoRaiseInterval(int);
|
||||
void setAutoRaise(bool);
|
||||
void setDelayFocusInterval(int);
|
||||
void setClickRaise(bool);
|
||||
void setSeparateScreenFocus(bool);
|
||||
void setActiveMouseScreen(bool);
|
||||
|
||||
void setFocusStealing(int);
|
||||
|
||||
KConfig *config;
|
||||
bool standAlone;
|
||||
|
||||
KWinFocusConfigForm *m_ui;
|
||||
KWinOptionsSettings *m_settings;
|
||||
};
|
||||
|
||||
class KMovingConfig : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KMovingConfig(bool _standAlone, QWidget *parent);
|
||||
~KMovingConfig() override;
|
||||
KMovingConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent);
|
||||
|
||||
void save() override;
|
||||
|
||||
|
@ -137,8 +117,7 @@ class KAdvancedConfig : public KCModule
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KAdvancedConfig(bool _standAlone, QWidget *parent);
|
||||
~KAdvancedConfig() override;
|
||||
KAdvancedConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent);
|
||||
|
||||
void save() override;
|
||||
|
||||
|
@ -147,9 +126,9 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
KWinOptionsSettings *m_config;
|
||||
bool standAlone;
|
||||
KWinAdvancedConfigForm *m_ui;
|
||||
KWinOptionsSettings *m_settings;
|
||||
};
|
||||
|
||||
#endif // KKWMWINDOWS_H
|
||||
|
|
Loading…
Reference in a new issue