Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwinoptions/windows.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | |||||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | // removed the LCD display over the slider - this is not good GUI design :) RNolden 051701 | 96 | // removed the LCD display over the slider - this is not good GUI design :) RNolden 051701 | ||
97 | KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, QWidget * parent) | 97 | KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, QWidget * parent) | ||
98 | : KCModule(parent), config(_config), standAlone(_standAlone) | 98 | : KCModule(parent), config(_config), standAlone(_standAlone) | ||
99 | , m_ui(new KWinFocusConfigForm(this)) | 99 | , m_ui(new KWinFocusConfigForm(this)) | ||
100 | { | 100 | { | ||
101 | connect(m_ui->focusStealing, SIGNAL(activated(int)), SLOT(changed())); | 101 | connect(m_ui->focusStealing, SIGNAL(activated(int)), SLOT(changed())); | ||
102 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), SLOT(changed())); | 102 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed())); | ||
103 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(focusPolicyChanged())); | 103 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(focusPolicyChanged())); | ||
104 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(setDelayFocusEnabled())); | 104 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelayFocusEnabled())); | ||
105 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(updateActiveMouseScreen())); | 105 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActiveMouseScreen())); | ||
106 | connect(m_ui->autoRaiseOn, SIGNAL(clicked()), SLOT(changed())); | 106 | connect(m_ui->autoRaiseOn, SIGNAL(clicked()), SLOT(changed())); | ||
107 | connect(m_ui->autoRaiseOn, SIGNAL(toggled(bool)), SLOT(autoRaiseOnTog(bool))); | 107 | connect(m_ui->autoRaiseOn, SIGNAL(toggled(bool)), SLOT(autoRaiseOnTog(bool))); | ||
108 | connect(m_ui->clickRaiseOn, SIGNAL(clicked()), SLOT(changed())); | 108 | connect(m_ui->clickRaiseOn, SIGNAL(clicked()), SLOT(changed())); | ||
109 | connect(m_ui->autoRaise, SIGNAL(valueChanged(int)), SLOT(changed())); | 109 | connect(m_ui->autoRaise, SIGNAL(valueChanged(int)), SLOT(changed())); | ||
110 | connect(m_ui->delayFocus, SIGNAL(valueChanged(int)), SLOT(changed())); | 110 | connect(m_ui->delayFocus, SIGNAL(valueChanged(int)), SLOT(changed())); | ||
111 | connect(m_ui->separateScreenFocus, SIGNAL(clicked()), SLOT(changed())); | 111 | connect(m_ui->separateScreenFocus, SIGNAL(clicked()), SLOT(changed())); | ||
112 | connect(m_ui->activeMouseScreen, SIGNAL(clicked()), SLOT(changed())); | 112 | connect(m_ui->activeMouseScreen, SIGNAL(clicked()), SLOT(changed())); | ||
113 | 113 | | |||
114 | connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(updateMultiScreen())); | 114 | connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(updateMultiScreen())); | ||
115 | updateMultiScreen(); | 115 | updateMultiScreen(); | ||
116 | 116 | | |||
117 | load(); | 117 | load(); | ||
118 | } | 118 | } | ||
119 | 119 | | |||
120 | void KFocusConfig::updateMultiScreen() | 120 | void KFocusConfig::updateMultiScreen() | ||
121 | { | 121 | { | ||
122 | m_ui->multiscreenBox->setVisible(QApplication::screens().count() > 1); | 122 | m_ui->multiscreenBehaviorLabel->setVisible(QApplication::screens().count() > 1); | ||
123 | m_ui->activeMouseScreen->setVisible(QApplication::screens().count() > 1); | ||||
124 | m_ui->separateScreenFocus->setVisible(QApplication::screens().count() > 1); | ||||
123 | } | 125 | } | ||
124 | 126 | | |||
125 | 127 | | |||
126 | int KFocusConfig::getFocus() | 128 | int KFocusConfig::getFocus() | ||
127 | { | 129 | { | ||
128 | int policy = m_ui->windowFocusPolicy->value(); | 130 | int policy = m_ui->windowFocusPolicyCombo->currentIndex(); | ||
129 | if (policy == 1 || policy == 3) | 131 | if (policy == 1 || policy == 3) | ||
130 | --policy; // fix the NextFocusPrefersMouse condition | 132 | --policy; // fix the NextFocusPrefersMouse condition | ||
131 | return policy; | 133 | return policy; | ||
132 | } | 134 | } | ||
133 | 135 | | |||
134 | void KFocusConfig::setFocus(int foc) | 136 | void KFocusConfig::setFocus(int foc) | ||
135 | { | 137 | { | ||
136 | m_ui->windowFocusPolicy->setValue(foc); | 138 | m_ui->windowFocusPolicyCombo->setCurrentIndex(foc); | ||
137 | 139 | | |||
138 | // this will disable/hide the auto raise delay widget if focus==click | 140 | // this will disable/hide the auto raise delay widget if focus==click | ||
139 | focusPolicyChanged(); | 141 | focusPolicyChanged(); | ||
140 | } | 142 | } | ||
141 | 143 | | |||
142 | void KFocusConfig::setAutoRaiseInterval(int tb) | 144 | void KFocusConfig::setAutoRaiseInterval(int tb) | ||
143 | { | 145 | { | ||
144 | m_ui->autoRaise->setValue(tb); | 146 | m_ui->autoRaise->setValue(tb); | ||
Show All 21 Lines | |||||
166 | 168 | | |||
167 | void KFocusConfig::setClickRaise(bool on) | 169 | void KFocusConfig::setClickRaise(bool on) | ||
168 | { | 170 | { | ||
169 | m_ui->clickRaiseOn->setChecked(on); | 171 | m_ui->clickRaiseOn->setChecked(on); | ||
170 | } | 172 | } | ||
171 | 173 | | |||
172 | void KFocusConfig::focusPolicyChanged() | 174 | void KFocusConfig::focusPolicyChanged() | ||
173 | { | 175 | { | ||
176 | switch (m_ui->windowFocusPolicyCombo->currentIndex()) | ||||
zzag: Style: a switch statement should look like
```lang=cpp
switch (foo) {
case Foo:
break… | |||||
177 | { | ||||
178 | case 0: | ||||
179 | m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<html><head/><body><p><span style=\" font-style:italic;\">Click to focus:</span> A window becomes active when you click into it. This behavior is common on other operating systems and likely what you want.</p></body></html>")); | ||||
180 | break; | ||||
181 | case 1: | ||||
182 | m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<html><head/><body><p><span style=\" font-style:italic;\">Click to focus (mouse precedence):</span> Mostly the same as <span style=\" font-style:italic;\">Click to focus</span>. 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 <span style=\" font-style:italic;\">Click to focus</span>.</p></body></html>")); | ||||
183 | break; | ||||
184 | case 2: | ||||
185 | m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<html><head/><body><p><span style=\" font-style:italic;\">Focus follows mouse:</span> Moving the mouse onto a window will activate it. Eg. windows randomly appearing under the mouse will not gain the focus. <span style=\" font-style:italic;\">Focus stealing prevention</span> takes place as usual. Think as <span style=\" font-style:italic;\">Click to focus</span> just without having to actually click.</p></body></html>")); | ||||
186 | break; | ||||
187 | case 3: | ||||
188 | m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<html><head/><body><p>This is mostly the same as <span style=\" font-style:italic;\">Focus follows mouse</span>. 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.</p></body></html>")); | ||||
189 | break; | ||||
190 | case 4: | ||||
191 | m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<html><head/><body><p><span style=\" font-style:italic;\">Focus under mouse:</span> The focus always remains on the window under the mouse.<br/><span style=\" font-weight:600;\">Warning: </span><span style=\" font-style:italic;\">Focus stealing prevention</span> and the <span style=\" font-style:italic;\">tabbox ('Alt+Tab') </span>contradict the activation policy and will not work. You very likely want to use <span style=\" font-style:italic;\">Focus follows mouse (mouse precedence)</span> instead!</p></body></html>")); | ||||
192 | break; | ||||
193 | case 5: | ||||
194 | m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("<html><head/><body><p><span style=\" font-style:italic;\">Focus strictly under mouse:</span> 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/><span style=\" font-weight:600;\">Warning: </span><span style=\" font-style:italic;\">Focus stealing prevention</span> and the <span style=\" font-style:italic;\">tabbox ('Alt+Tab') </span>contradict the activation policy and will not work. You very likely want to use <span style=\" font-style:italic;\">Focus follows mouse (mouse precedence)</span> instead!</p></body></html>")); | ||||
195 | break; | ||||
196 | } | ||||
197 | | ||||
174 | int policyIndex = getFocus(); | 198 | int policyIndex = getFocus(); | ||
175 | 199 | | |||
176 | // the auto raise related widgets are: autoRaise | 200 | // the auto raise related widgets are: autoRaise | ||
177 | m_ui->autoRaiseOn->setEnabled(policyIndex != CLICK_TO_FOCUS); | 201 | m_ui->autoRaiseOn->setEnabled(policyIndex != CLICK_TO_FOCUS); | ||
178 | autoRaiseOnTog(policyIndex != CLICK_TO_FOCUS && m_ui->autoRaiseOn->isChecked()); | 202 | autoRaiseOnTog(policyIndex != CLICK_TO_FOCUS && m_ui->autoRaiseOn->isChecked()); | ||
179 | 203 | | |||
180 | m_ui->focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE); | 204 | m_ui->focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE); | ||
181 | m_ui->focusStealingLabel->setEnabled(m_ui->focusStealing->isEnabled()); | 205 | m_ui->focusStealingLabel->setEnabled(m_ui->focusStealing->isEnabled()); | ||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Line(s) | 311 | if (v == CLICK_TO_FOCUS) | |||
288 | cg.writeEntry(KWIN_FOCUS, "ClickToFocus"); | 312 | cg.writeEntry(KWIN_FOCUS, "ClickToFocus"); | ||
289 | else if (v == FOCUS_UNDER_MOUSE) | 313 | else if (v == FOCUS_UNDER_MOUSE) | ||
290 | cg.writeEntry(KWIN_FOCUS, "FocusUnderMouse"); | 314 | cg.writeEntry(KWIN_FOCUS, "FocusUnderMouse"); | ||
291 | else if (v == FOCUS_STRICTLY_UNDER_MOUSE) | 315 | else if (v == FOCUS_STRICTLY_UNDER_MOUSE) | ||
292 | cg.writeEntry(KWIN_FOCUS, "FocusStrictlyUnderMouse"); | 316 | cg.writeEntry(KWIN_FOCUS, "FocusStrictlyUnderMouse"); | ||
293 | else | 317 | else | ||
294 | cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse"); | 318 | cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse"); | ||
295 | 319 | | |||
296 | cg.writeEntry("NextFocusPrefersMouse", v != m_ui->windowFocusPolicy->value()); | 320 | cg.writeEntry("NextFocusPrefersMouse", v != m_ui->windowFocusPolicyCombo->currentIndex()); | ||
297 | 321 | | |||
298 | v = getAutoRaiseInterval(); | 322 | v = getAutoRaiseInterval(); | ||
299 | if (v < 0) v = 0; | 323 | if (v < 0) v = 0; | ||
300 | cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v); | 324 | cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v); | ||
301 | 325 | | |||
302 | v = getDelayFocusInterval(); | 326 | v = getDelayFocusInterval(); | ||
303 | if (v < 0) v = 0; | 327 | if (v < 0) v = 0; | ||
304 | cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL, v); | 328 | cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL, v); | ||
Show All 14 Lines | |||||
319 | if (standAlone) { | 343 | if (standAlone) { | ||
320 | config->sync(); | 344 | config->sync(); | ||
321 | // Send signal to all kwin instances | 345 | // Send signal to all kwin instances | ||
322 | QDBusMessage message = | 346 | QDBusMessage message = | ||
323 | QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); | 347 | QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); | ||
324 | QDBusConnection::sessionBus().send(message); | 348 | QDBusConnection::sessionBus().send(message); | ||
325 | } | 349 | } | ||
326 | emit KCModule::changed(false); | 350 | emit KCModule::changed(false); | ||
327 | } | 351 | } | ||
328 | 352 | | |||
zzag: Why is it here? | |||||
329 | void KFocusConfig::defaults() | 353 | void KFocusConfig::defaults() | ||
330 | { | 354 | { | ||
331 | setAutoRaiseInterval(0); | 355 | setAutoRaiseInterval(0); | ||
332 | setDelayFocusInterval(0); | 356 | setDelayFocusInterval(0); | ||
333 | setFocus(CLICK_TO_FOCUS); | 357 | setFocus(CLICK_TO_FOCUS); | ||
334 | setAutoRaise(false); | 358 | setAutoRaise(false); | ||
335 | setClickRaise(true); | 359 | setClickRaise(true); | ||
336 | setSeparateScreenFocus(false); | 360 | setSeparateScreenFocus(false); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 387 | { | |||
380 | m_ui->inactiveTabsSkipTaskbar->setVisible(false); // TODO: We want translations in case this is fixed... | 404 | m_ui->inactiveTabsSkipTaskbar->setVisible(false); // TODO: We want translations in case this is fixed... | ||
381 | load(); | 405 | load(); | ||
382 | 406 | | |||
383 | } | 407 | } | ||
384 | 408 | | |||
385 | void KAdvancedConfig::setShadeHover(bool on) | 409 | void KAdvancedConfig::setShadeHover(bool on) | ||
386 | { | 410 | { | ||
387 | m_ui->shadeHoverOn->setChecked(on); | 411 | m_ui->shadeHoverOn->setChecked(on); | ||
388 | m_ui->shadeHoverLabel->setEnabled(on); | | |||
389 | m_ui->shadeHover->setEnabled(on); | 412 | m_ui->shadeHover->setEnabled(on); | ||
390 | } | 413 | } | ||
391 | 414 | | |||
392 | void KAdvancedConfig::setShadeHoverInterval(int k) | 415 | void KAdvancedConfig::setShadeHoverInterval(int k) | ||
393 | { | 416 | { | ||
394 | m_ui->shadeHover->setValue(k); | 417 | m_ui->shadeHover->setValue(k); | ||
395 | } | 418 | } | ||
396 | 419 | | |||
397 | int KAdvancedConfig::getShadeHoverInterval() | 420 | int KAdvancedConfig::getShadeHoverInterval() | ||
398 | { | 421 | { | ||
399 | 422 | | |||
400 | return m_ui->shadeHover->value(); | 423 | return m_ui->shadeHover->value(); | ||
401 | } | 424 | } | ||
402 | 425 | | |||
403 | void KAdvancedConfig::shadeHoverChanged(bool a) | 426 | void KAdvancedConfig::shadeHoverChanged(bool a) | ||
404 | { | 427 | { | ||
405 | m_ui->shadeHoverLabel->setEnabled(a); | | |||
406 | m_ui->shadeHover->setEnabled(a); | 428 | m_ui->shadeHover->setEnabled(a); | ||
407 | } | 429 | } | ||
408 | 430 | | |||
409 | void KAdvancedConfig::showEvent(QShowEvent *ev) | 431 | void KAdvancedConfig::showEvent(QShowEvent *ev) | ||
410 | { | 432 | { | ||
411 | if (!standAlone) { | 433 | if (!standAlone) { | ||
412 | QWidget::showEvent(ev); | 434 | QWidget::showEvent(ev); | ||
413 | return; | 435 | return; | ||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |
Style: a switch statement should look like
i.e. cases are not indented and opening brace is kept on the same line as switch keyword.