From 6c934998a5178f14273fd37fcbc4d72222eb74e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Mon, 28 Nov 2011 20:12:58 +0100 Subject: [PATCH] don't request focus by mouse events in the current event cycle BUG: 279356 BUG: 286116 REVIEW: 103284 --- data/CMakeLists.txt | 4 ++-- data/kwin_remove_delay_focus.sh | 4 ++++ data/kwin_remove_delay_focus.upd | 2 ++ events.cpp | 3 --- kcmkwin/kwinoptions/windows.cpp | 19 +------------------ kcmkwin/kwinoptions/windows.h | 2 -- options.cpp | 2 -- options.h | 5 ----- 8 files changed, 9 insertions(+), 32 deletions(-) create mode 100755 data/kwin_remove_delay_focus.sh create mode 100644 data/kwin_remove_delay_focus.upd diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index fadb274bc6..7af23c9058 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -45,6 +45,6 @@ install( TARGETS kwin_update_tabbox_qml_settings DESTINATION ${LIB_INSTALL_DIR}/ install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules ) install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} ) -install( FILES kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd kwin_window_shortcuts.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) -install( PROGRAMS pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh on-off_to_true-false.sh kwin_window_shortcuts.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( FILES kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd kwin_window_shortcuts.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( PROGRAMS pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh on-off_to_true-false.sh kwin_window_shortcuts.sh kwin_remove_delay_focus.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) diff --git a/data/kwin_remove_delay_focus.sh b/data/kwin_remove_delay_focus.sh new file mode 100755 index 0000000000..6f4d61baab --- /dev/null +++ b/data/kwin_remove_delay_focus.sh @@ -0,0 +1,4 @@ +#!/bin/sh +if ! `kreadconfig --file kwinrc --group Windows --key DelayFocus --default false` && [ `kreadconfig --file kwinrc --group Windows --key DelayFocusInterval --default 0` != 0 ]; then + kwriteconfig --file kwinrc --group Windows --key DelayFocusInterval 0 +fi \ No newline at end of file diff --git a/data/kwin_remove_delay_focus.upd b/data/kwin_remove_delay_focus.upd new file mode 100644 index 0000000000..4d6f677ad0 --- /dev/null +++ b/data/kwin_remove_delay_focus.upd @@ -0,0 +1,2 @@ +Id=Kwin-4.8 +Script=kwin_remove_delay_focus.sh diff --git a/events.cpp b/events.cpp index fd1147d22a..b02945b64d 100644 --- a/events.cpp +++ b/events.cpp @@ -901,10 +901,7 @@ void Client::enterNotifyEvent(XCrossingEvent* e) // change came because of window changes (e.g. closing a window) - #92290 if (options->focusPolicy != Options::FocusFollowsMouse || currentPos != workspace()->focusMousePosition()) { - if (options->delayFocus) workspace()->requestDelayFocus(this); - else - workspace()->requestFocus(this); } return; } diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index 84c3cb5380..ca25f25b7b 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -52,7 +52,6 @@ #define KWIN_AUTORAISE_INTERVAL "AutoRaiseInterval" #define KWIN_AUTORAISE "AutoRaise" #define KWIN_DELAYFOCUS_INTERVAL "DelayFocusInterval" -#define KWIN_DELAYFOCUS "DelayFocus" #define KWIN_CLICKRAISE "ClickRaise" #define KWIN_MOVE_RESIZE_MAXIMIZED "MoveResizeMaximizedWindows" #define KWIN_SHADEHOVER "ShadeHover" @@ -206,8 +205,6 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentD connect(focusCombo, SIGNAL(activated(int)), this, SLOT(setDelayFocusEnabled())); - delayFocusOn = new QCheckBox(fcsBox); - connect(delayFocusOn, SIGNAL(toggled(bool)), this, SLOT(delayFocusOnTog(bool))); delayFocus = new KIntNumInput(500, fcsBox); delayFocus->setRange(0, 3000, 100); delayFocus->setSteps(100, 100); @@ -216,7 +213,6 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentD delayFocusOnLabel = new QLabel(i18n("Delay focus by:"), this); delayFocusOnLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight); delayFocusOnLabel->setBuddy(delayFocus); - gLay->addWidget(delayFocusOn, 3, 0); gLay->addWidget(delayFocusOnLabel, 3, 1); gLay->addWidget(delayFocus, 3, 2); @@ -235,8 +231,6 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentD " it for inactive windows, you need to change the settings" " in the Actions tab.")); - delayFocusOn->setWhatsThis(i18n("When this option is enabled, there will be a delay after which the" - " window the mouse pointer is over will become active (receive focus).")); delayFocus->setWhatsThis(i18n("This is the delay after which the window the mouse pointer is over" " will automatically receive focus.")); @@ -266,7 +260,6 @@ KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, const KComponentD // Any changes goes to slotChanged() connect(focusCombo, SIGNAL(activated(int)), SLOT(changed())); connect(autoRaiseOn, SIGNAL(clicked()), SLOT(changed())); - connect(delayFocusOn, SIGNAL(clicked()), SLOT(changed())); connect(clickRaiseOn, SIGNAL(clicked()), SLOT(changed())); connect(autoRaise, SIGNAL(valueChanged(int)), SLOT(changed())); connect(delayFocus, SIGNAL(valueChanged(int)), SLOT(changed())); @@ -315,11 +308,6 @@ void KFocusConfig::setAutoRaise(bool on) autoRaiseOn->setChecked(on); } -void KFocusConfig::setDelayFocus(bool on) -{ - delayFocusOn->setChecked(on); -} - void KFocusConfig::setClickRaise(bool on) { clickRaiseOn->setChecked(on); @@ -343,9 +331,8 @@ void KFocusConfig::setDelayFocusEnabled() int policyIndex = focusCombo->currentIndex(); // the delayed focus related widgets are: delayFocus - delayFocusOn->setEnabled(policyIndex != CLICK_TO_FOCUS); delayFocusOnLabel->setEnabled(policyIndex != CLICK_TO_FOCUS); - delayFocusOnTog(policyIndex != CLICK_TO_FOCUS && delayFocusOn->isChecked()); + delayFocusOnTog(policyIndex != CLICK_TO_FOCUS); } void KFocusConfig::autoRaiseOnTog(bool a) @@ -419,7 +406,6 @@ void KFocusConfig::load(void) setDelayFocusInterval(k); setAutoRaise(cg.readEntry(KWIN_AUTORAISE, false)); - setDelayFocus(cg.readEntry(KWIN_DELAYFOCUS, false)); setClickRaise(cg.readEntry(KWIN_CLICKRAISE, true)); focusPolicyChanged(); // this will disable/hide the auto raise delay widget if focus==click setDelayFocusEnabled(); @@ -461,8 +447,6 @@ void KFocusConfig::save(void) cg.writeEntry(KWIN_AUTORAISE, autoRaiseOn->isChecked()); - cg.writeEntry(KWIN_DELAYFOCUS, delayFocusOn->isChecked()); - cg.writeEntry(KWIN_CLICKRAISE, clickRaiseOn->isChecked()); cg.writeEntry(KWIN_SEPARATE_SCREEN_FOCUS, separateScreenFocus->isChecked()); @@ -487,7 +471,6 @@ void KFocusConfig::defaults() setDelayFocusInterval(0); setFocus(CLICK_TO_FOCUS); setAutoRaise(false); - setDelayFocus(false); setClickRaise(true); setSeparateScreenFocus(false); diff --git a/kcmkwin/kwinoptions/windows.h b/kcmkwin/kwinoptions/windows.h index f7a8658f54..ca0465240f 100644 --- a/kcmkwin/kwinoptions/windows.h +++ b/kcmkwin/kwinoptions/windows.h @@ -95,7 +95,6 @@ private: void setAutoRaiseInterval(int); void setAutoRaise(bool); void setDelayFocusInterval(int); - void setDelayFocus(bool); void setClickRaise(bool); void setSeparateScreenFocus(bool); void setActiveMouseScreen(bool); @@ -109,7 +108,6 @@ private: QLabel *autoRaiseOnLabel; QCheckBox *autoRaiseOn; QLabel *delayFocusOnLabel; - QCheckBox *delayFocusOn; QCheckBox *clickRaiseOn; KIntNumInput *autoRaise; KIntNumInput *delayFocus; diff --git a/options.cpp b/options.cpp index 19c3ee524c..a66a60855d 100644 --- a/options.cpp +++ b/options.cpp @@ -151,12 +151,10 @@ unsigned long Options::updateSettings() if (focusPolicy == ClickToFocus) { autoRaise = false; autoRaiseInterval = 0; - delayFocus = false; delayFocusInterval = 0; } else { autoRaise = config.readEntry("AutoRaise", false); autoRaiseInterval = config.readEntry("AutoRaiseInterval", 0); - delayFocus = config.readEntry("DelayFocus", false); delayFocusInterval = config.readEntry("DelayFocusInterval", 0); } diff --git a/options.h b/options.h index 4dab3ac843..90c204b82c 100644 --- a/options.h +++ b/options.h @@ -97,11 +97,6 @@ public: */ int autoRaiseInterval; - /** - whether delay focus is enabled or not. - */ - bool delayFocus; - /** delayed focus interval */