diff --git a/kcmkwin/kwinoptions/focus.ui b/kcmkwin/kwinoptions/focus.ui
index 4744dd8677..d1983fb499 100644
--- a/kcmkwin/kwinoptions/focus.ui
+++ b/kcmkwin/kwinoptions/focus.ui
@@ -6,12 +6,12 @@
0
0
- 574
- 313
+ 656
+ 527
-
- -
+
+
-
Qt::Horizontal
@@ -24,82 +24,272 @@
- -
-
-
-
-
-
- &Policy:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- focusCombo
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- The focus policy is used to determine the active window, i.e. the window you can work in. <ul>
-<li><em>Click to focus:</em> A window becomes active when you click into it. This is the behavior you might know from other operating systems.</li> <li><em>Focus follows mouse:</em> Moving the mouse pointer actively on to a normal window activates it. New windows will receive the focus, without you having to point the mouse at them explicitly. Very practical if you are using the mouse a lot.</li>
-<li><em>Focus under mouse:</em> The window that happens to be under the mouse pointer is active. If the mouse points nowhere, the last window that was under the mouse has focus. New windows will not automatically receive the focus.</li>
-<li><em>Focus strictly under mouse:</em> Only the window under the mouse pointer is active. If the mouse points nowhere, nothing has focus.</li>
-</ul>
-Note that 'Focus under mouse' and 'Focus strictly under mouse' prevent certain features such as the Alt+Tab walk through windows dialog in the KDE mode from working properly.
-
-
-
-
- Click to Focus
+
-
+
+
+ Activating windows
+
+
+ true
+
+
+
-
+
+
+ Qt::Horizontal
-
- -
-
- Focus Follows Mouse
+
+
+ -
+
+
+ Qt::Horizontal
-
- -
-
- Focus Under Mouse
+
+
+ 40
+ 20
+
-
- -
-
- Focus Strictly Under Mouse
+
+
+ -
+
+
+ 2
-
-
-
- -
-
-
- Focus &stealing prevention level:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- focusStealing
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- <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 Focus Under Mouse or Focus Strictly Under Mouse focus policies.)
+
+
+
-
+
+
+ <b>Click To Focus</b><br>
+A window becomes active when you click into it.<br><br>
+This behaviour is common on other operating systems and<br>
+likely what you want.
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ false
+
+
+
+
+
+
+
+ -
+
+
+ <b>Click To Focus - Mouse Precendence</b><br>
+This is mostly the same as <i>Click To Focus</i><br><br>
+If an active window has to be chosen by the system<br>
+(eg. because the currently active one was closed) <br>
+the window under the mouse is the preferred candidate.<br><br>
+Unusual, but possible variant of <i>Click To Focus</i>.
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ false
+
+
+
+
+
+
+
+ -
+
+
+ <b>Focus Follows Mouse</b><br>
+Moving the mouse onto a window will activate it.<br><br>
+Eg. windows randomly appearing under the mouse will not gain the focus.<br>
+Focus stealing prevention takes place as usual.<br><br>
+Think as <i>Click To Focus</i> just without having to actually click.
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ false
+
+
+
+
+
+
+
+ -
+
+
+ <b>Focus Follows Mouse - Mouse Precendence</b><br>
+This is mostly the same as <i>Focus Follows Mouse</i><br><br>
+If an active window has to be chosen by the system<br>
+(eg. because the currently active one was closed) <br>
+the window under the mouse is the preferred candidate.<br><br>
+Choose this, if you want a hover controlled focus.
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ false
+
+
+
+
+
+
+
+ -
+
+
+ <b>Focus Under Mouse</b><br>
+The focus always remains on the window under the mouse.<br><br>
+
+Notice:<br>
+<b>Focus stealing prevention</b> and the <b>tabbox ("Alt+Tab")</b><br>
+contradict the policy and <b>will not work</b>.<br><br>
+You very likely want to use<br>
+<i>Focus Follows Mouse - Mouse Precendence</i> instead!
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ false
+
+
+
+
+
+
+
+ -
+
+
+ <b>Focus Strictly Under Mouse</b><br>
+The focus is always on the window under the mouse - in doubt nowhere -<br>
+very much like the focus behaviour in an unmanaged legacy X11 environment.<br><br>
+
+Notice:<br>
+<b>Focus stealing prevention</b> and the <b>tabbox ("Alt+Tab")</b><br>
+contradict the policy and <b>will not work</b>.<br><br>
+You very likely want to use<br>
+<i>Focus Follows Mouse - Mouse Precendence</i> instead!
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ false
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ &Delay focus by
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ delayFocus
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ This is the delay after which the window the mouse pointer is over will automatically receive focus.
+
+
+ 100
+
+
+ 0
+
+
+ 3000
+
+
+ 100
+
+
+ ms
+
+
+
+
+
+ -
+
+
-
+
+
+ Focus &stealing prevention
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ focusStealing
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ <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 Focus Under Mouse or Focus Strictly Under Mouse focus policies.)
<ul>
<li><em>None:</em> Prevention is turned off and new windows always become activated.</li>
<li><em>Low:</em> 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>
@@ -108,166 +298,124 @@ Note that 'Focus under mouse' and 'Focus strictly under mouse' prevent certain f
<li><em>Extreme:</em> All windows must be explicitly activated by the user.</li>
</ul></p>
<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>
-
-
-
-
- None
+
+
-
+
+ None
+
+
+ -
+
+ Low
+
+
+ -
+
+ Medium
+
+
+ -
+
+ High
+
+
+ -
+
+ Extreme
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ 0
-
- -
-
- Low
-
-
- -
-
- Medium
-
-
- -
-
- High
-
-
- -
-
- Extreme
-
-
-
-
- -
-
-
- 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.
-
-
- &Raise, with the following delay:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- This is the delay after which the window that the mouse pointer is over will automatically come to the front.
-
-
- 100
-
-
- 0
-
-
- 3000
-
-
- 100
-
-
- ms
-
-
-
- -
-
-
- &Delay focus by:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- delayFocus
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- This is the delay after which the window the mouse pointer is over will automatically receive focus.
-
-
- 100
-
-
- 0
-
-
- 3000
-
-
- 100
-
-
- ms
-
-
-
- -
-
-
- &When the active window disappears, pass focus to window under mouse
-
-
-
- -
-
-
- 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.
-
-
- C&lick raises active window
-
-
-
- -
-
-
- When this option is enabled, focus operations are limited only to the active Xinerama screen
-
-
- S&eparate screen focus
-
-
-
- -
-
-
- 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.
-
-
- Active screen follows &mouse
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ true
+
+
+
+ Policy
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Click
+
+
+
+ -
+
+
+ 5
+
+
+ 1
+
+
+ Qt::Horizontal
+
+
+ QSlider::NoTicks
+
+
+ 0
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Hover
+
+
+
+
+
+
+
- -
+
-
Qt::Horizontal
@@ -280,6 +428,124 @@ Note that 'Focus under mouse' and 'Focus strictly under mouse' prevent certain f
+ -
+
+
+ Raising windows
+
+
+ true
+
+
+
-
+
+
+ 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.
+
+
+ &Raise on hover, delayed by
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ This is the delay after which the window that the mouse pointer is over will automatically come to the front.
+
+
+ 100
+
+
+ 0
+
+
+ 3000
+
+
+ 100
+
+
+ ms
+
+
+
+ -
+
+
+ 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.
+
+
+ C&lick raises active window
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 192
+
+
+
+
+ -
+
+
+ Multiscreen behaviour
+
+
+ true
+
+
+
-
+
+
+ When this option is enabled, focus operations are limited only to the active Xinerama screen
+
+
+ S&eparate screen focus
+
+
+
+ -
+
+
+ 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.
+
+
+ Active screen follows &mouse
+
+
+
+
+
+
@@ -295,16 +561,30 @@ Note that 'Focus under mouse' and 'Focus strictly under mouse' prevent certain f
- focusCombo
focusStealing
autoRaiseOn
autoRaise
delayFocus
- focusNextToMouse
- clickRaiseOn
separateScreenFocus
activeMouseScreen
-
+
+
+ windowFocusPolicy
+ valueChanged(int)
+ stackedWidget
+ setCurrentIndex(int)
+
+
+ 244
+ 38
+
+
+ 444
+ 84
+
+
+
+
diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp
index 3deabc89a1..2f1324f737 100644
--- a/kcmkwin/kwinoptions/windows.cpp
+++ b/kcmkwin/kwinoptions/windows.cpp
@@ -75,6 +75,11 @@
#define MAX_CNTR_SNAP 100
#define MAX_EDGE_RES 1000
+#define CLICK_TO_FOCUS 0
+#define FOCUS_FOLLOWS_MOUSE 2
+#define FOCUS_UNDER_MOUSE 4
+#define FOCUS_STRICTLY_UNDER_MOUSE 5
+
KFocusConfig::~KFocusConfig()
{
@@ -94,10 +99,10 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentD
, m_ui(new KWinFocusConfigForm(this))
{
connect(m_ui->focusStealing, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->focusCombo, SIGNAL(activated(int)), SLOT(changed()));
- connect(m_ui->focusCombo, SIGNAL(activated(int)), this, SLOT(focusPolicyChanged()));
- connect(m_ui->focusCombo, SIGNAL(activated(int)), this, SLOT(setDelayFocusEnabled()));
- connect(m_ui->focusCombo, SIGNAL(activated(int)), this, SLOT(updateActiveMouseScreen()));
+ connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), SLOT(changed()));
+ connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(focusPolicyChanged()));
+ connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(setDelayFocusEnabled()));
+ connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(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()));
@@ -105,20 +110,30 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentD
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()));
- connect(m_ui->focusNextToMouse, SIGNAL(clicked()), SLOT(changed()));
+
+ connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(updateMultiScreen()));
+ updateMultiScreen();
load();
}
+void KFocusConfig::updateMultiScreen()
+{
+ m_ui->multiscreenBox->setVisible(QApplication::desktop()->screenCount() > 1);
+}
+
int KFocusConfig::getFocus()
{
- return m_ui->focusCombo->currentIndex();
+ int policy = m_ui->windowFocusPolicy->value();
+ if (policy == 1 || policy == 3)
+ --policy; // fix the NextFocusPrefersMouse condition
+ return policy;
}
void KFocusConfig::setFocus(int foc)
{
- m_ui->focusCombo->setCurrentIndex(foc);
+ m_ui->windowFocusPolicy->setValue(foc);
// this will disable/hide the auto raise delay widget if focus==click
focusPolicyChanged();
@@ -156,21 +171,22 @@ void KFocusConfig::setClickRaise(bool on)
void KFocusConfig::focusPolicyChanged()
{
- int policyIndex = m_ui->focusCombo->currentIndex();
+ int policyIndex = getFocus();
// 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->focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE);
+ m_ui->focusStealingLabel->setEnabled(m_ui->focusStealing->isEnabled());
- m_ui->focusNextToMouse->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE);
+ setDelayFocusEnabled();
}
void KFocusConfig::setDelayFocusEnabled()
{
- int policyIndex = m_ui->focusCombo->currentIndex();
+ int policyIndex = getFocus();
// the delayed focus related widgets are: delayFocus
m_ui->delayFocusOnLabel->setEnabled(policyIndex != CLICK_TO_FOCUS);
@@ -209,7 +225,7 @@ void KFocusConfig::updateActiveMouseScreen()
// on by default for non click to focus policies
KConfigGroup cfg(config, "Windows");
if (!cfg.hasKey(KWIN_ACTIVE_MOUSE_SCREEN))
- setActiveMouseScreen(m_ui->focusCombo->currentIndex() != 0);
+ setActiveMouseScreen(getFocus() != 0);
}
void KFocusConfig::showEvent(QShowEvent *ev)
@@ -227,11 +243,13 @@ void KFocusConfig::load(void)
KConfigGroup cg(config, "Windows");
+ const bool focusNextToMouse = cg.readEntry("NextFocusPrefersMouse", false);
+
key = cg.readEntry(KWIN_FOCUS);
if (key == "ClickToFocus")
- setFocus(CLICK_TO_FOCUS);
+ setFocus(CLICK_TO_FOCUS + focusNextToMouse);
else if (key == "FocusFollowsMouse")
- setFocus(FOCUS_FOLLOWS_MOUSE);
+ setFocus(FOCUS_FOLLOWS_MOUSE + focusNextToMouse);
else if (key == "FocusUnderMouse")
setFocus(FOCUS_UNDER_MOUSE);
else if (key == "FocusStrictlyUnderMouse")
@@ -246,17 +264,15 @@ void KFocusConfig::load(void)
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
- setDelayFocusEnabled();
setSeparateScreenFocus(cg.readEntry(KWIN_SEPARATE_SCREEN_FOCUS, false));
// on by default for non click to focus policies
- setActiveMouseScreen(cg.readEntry(KWIN_ACTIVE_MOUSE_SCREEN, m_ui->focusCombo->currentIndex() != 0));
+ 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));
- m_ui->focusNextToMouse->setChecked(cg.readEntry("NextFocusPrefersMouse", false));
emit KCModule::changed(false);
}
@@ -277,6 +293,8 @@ void KFocusConfig::save(void)
else
cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse");
+ cg.writeEntry("NextFocusPrefersMouse", v != m_ui->windowFocusPolicy->value());
+
v = getAutoRaiseInterval();
if (v < 0) v = 0;
cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v);
@@ -297,7 +315,6 @@ void KFocusConfig::save(void)
cg.writeEntry(KWIN_SEPARATE_SCREEN_FOCUS, m_ui->separateScreenFocus->isChecked());
cg.writeEntry(KWIN_ACTIVE_MOUSE_SCREEN, m_ui->activeMouseScreen->isChecked());
- cg.writeEntry("NextFocusPrefersMouse", m_ui->focusNextToMouse->isChecked());
if (standAlone) {
config->sync();
@@ -323,9 +340,8 @@ void KFocusConfig::defaults()
setFocusStealing(1);
// on by default for non click to focus policies
- setActiveMouseScreen(m_ui->focusCombo->currentIndex() != 0);
+ setActiveMouseScreen(getFocus() != 0);
setDelayFocusEnabled();
- m_ui->focusNextToMouse->setChecked(false);
emit KCModule::changed(true);
}
diff --git a/kcmkwin/kwinoptions/windows.h b/kcmkwin/kwinoptions/windows.h
index 068196c688..06a30bb921 100644
--- a/kcmkwin/kwinoptions/windows.h
+++ b/kcmkwin/kwinoptions/windows.h
@@ -43,17 +43,6 @@ class KButtonGroup;
class KColorButton;
class KIntNumInput;
-#define CLICK_TO_FOCUS 0
-#define FOCUS_FOLLOW_MOUSE 1
-
-#define TITLEBAR_PLAIN 0
-#define TITLEBAR_SHADED 1
-
-#define CLICK_TO_FOCUS 0
-#define FOCUS_FOLLOWS_MOUSE 1
-#define FOCUS_UNDER_MOUSE 2
-#define FOCUS_STRICTLY_UNDER_MOUSE 3
-
class KWinFocusConfigForm : public QWidget, public Ui::KWinFocusConfigForm
{
@@ -99,6 +88,7 @@ private slots:
void autoRaiseOnTog(bool);//CT 23Oct1998
void delayFocusOnTog(bool);
void updateActiveMouseScreen();
+ void updateMultiScreen();
void changed() {
emit KCModule::changed(true);
}