Added setting to control whether scrolling on a background window focuses it.

Patch by Alex Danila. Approved by lmurray. 
BUG: 164261

svn path=/trunk/KDE/kdebase/workspace/; revision=964140
icc-effect-5.14.5
A. Lynn Spehr 2009-05-06 06:38:54 +00:00
parent ec88dc9828
commit 2893eac8fe
4 changed files with 51 additions and 3 deletions

View File

@ -446,6 +446,12 @@ const char* const tbl_Win[] = {
"Activate",
"Activate and raise",
"" };
const char* const tbl_WinWheel[] = {
"Scroll",
"Activate and scroll",
"Activate, raise and scroll",
"" };
const char* const tbl_AllKey[] = {
"Meta",
@ -616,10 +622,10 @@ void KTitleBarActionsConfig::defaults()
KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3, strAllW;
QString strWin1, strWin2, strWin3, strWinWheel, strAllKey, strAll1, strAll2, strAll3, strAllW;
QGroupBox *box;
QString strMouseButton1, strMouseButton2, strMouseButton3;
QString txtButton1, txtButton2, txtButton3;
QString strMouseButton1, strMouseButton2, strMouseButton3, strMouseWheel;
QString txtButton1, txtButton2, txtButton3, txtWheel;
QStringList items;
bool leftHandedMouse = ( KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded);
@ -650,6 +656,8 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
strMouseButton3 = i18n("Right button:");
txtButton3 = i18n("In this row you can customize right click behavior when clicking into"
" the titlebar or the frame." );
strMouseWheel = i18n("Wheel");
if ( leftHandedMouse )
{
@ -665,6 +673,9 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
strWin3 = i18n("In this row you can customize right click behavior when clicking into"
" an inactive inner window ('inner' means: not titlebar, not frame).");
strWinWheel = i18n("In this row you can customize behavior when scrolling into"
" an inactive inner window ('inner' means: not titlebar, not frame).");
// Be nice to lefties
if ( leftHandedMouse ) qSwap(strWin1, strWin3);
@ -710,6 +721,25 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
label->setBuddy(combo);
gridLayout->addWidget(label, 2, 0);
gridLayout->addWidget(combo, 2, 1);
items.clear();
items << i18n("Scroll")
<< i18n("Activate & Scroll")
<< i18n("Activate, Raise & Scroll");
combo = new QComboBox(box);
combo->addItems(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coWinWheel = combo;
combo->setWhatsThis( strWinWheel );
combo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
label = new QLabel(strMouseWheel, this);
label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
label->setBuddy(combo);
gridLayout->addWidget(label, 3, 0);
gridLayout->addWidget(combo, 3, 1);
/** Inner window, titlebar and frame **************/
@ -850,6 +880,8 @@ void KWindowActionsConfig::setComboText( QComboBox* combo, const char*txt )
{
if( combo == coWin1 || combo == coWin2 || combo == coWin3 )
combo->setCurrentIndex( tbl_txt_lookup( tbl_Win, txt ));
else if (combo == coWinWheel)
combo->setCurrentIndex( tbl_txt_lookup( tbl_WinWheel, txt ));
else if( combo == coAllKey )
combo->setCurrentIndex( tbl_txt_lookup( tbl_AllKey, txt ));
else if( combo == coAll1 || combo == coAll2 || combo == coAll3 )
@ -865,6 +897,11 @@ const char* KWindowActionsConfig::functionWin( int i )
return tbl_num_lookup( tbl_Win, i );
}
const char* KWindowActionsConfig::functionWinWheel (int i)
{
return tbl_num_lookup( tbl_WinWheel, i);
}
const char* KWindowActionsConfig::functionAllKey( int i )
{
return tbl_num_lookup( tbl_AllKey, i );
@ -886,6 +923,7 @@ void KWindowActionsConfig::load()
setComboText(coWin1,cg.readEntry("CommandWindow1","Activate, raise and pass click").toAscii());
setComboText(coWin2,cg.readEntry("CommandWindow2","Activate and pass click").toAscii());
setComboText(coWin3,cg.readEntry("CommandWindow3","Activate and pass click").toAscii());
setComboText(coWinWheel, cg.readEntry("CommandWindowWheel", "Scroll").toAscii());
setComboText(coAllKey,cg.readEntry("CommandAllKey","Alt").toAscii());
setComboText(coAll1,cg.readEntry("CommandAll1","Move").toAscii());
setComboText(coAll2,cg.readEntry("CommandAll2","Toggle raise and lower").toAscii());
@ -899,6 +937,7 @@ void KWindowActionsConfig::save()
cg.writeEntry("CommandWindow1", functionWin(coWin1->currentIndex()));
cg.writeEntry("CommandWindow2", functionWin(coWin2->currentIndex()));
cg.writeEntry("CommandWindow3", functionWin(coWin3->currentIndex()));
cg.writeEntry("CommandWindowWheel", functionWinWheel(coWinWheel->currentIndex()));
cg.writeEntry("CommandAllKey", functionAllKey(coAllKey->currentIndex()));
cg.writeEntry("CommandAll1", functionAll(coAll1->currentIndex()));
cg.writeEntry("CommandAll2", functionAll(coAll2->currentIndex()));
@ -920,6 +959,7 @@ void KWindowActionsConfig::defaults()
setComboText(coWin1,"Activate, raise and pass click");
setComboText(coWin2,"Activate and pass click");
setComboText(coWin3,"Activate and pass click");
setComboText(coWinWheel, "Scroll");
setComboText(coAllKey,"Alt");
setComboText (coAll1,"Move");
setComboText(coAll2,"Toggle raise and lower");

View File

@ -113,6 +113,7 @@ private:
QComboBox* coWin1;
QComboBox* coWin2;
QComboBox* coWin3;
QComboBox* coWinWheel;
QComboBox* coAllKey;
QComboBox* coAll1;
@ -124,6 +125,7 @@ private:
bool standAlone;
const char* functionWin(int);
const char* functionWinWheel(int);
const char* functionAllKey(int);
const char* functionAll(int);
const char* functionAllW(int);

View File

@ -178,6 +178,7 @@ unsigned long Options::updateSettings()
CmdWindow1 = mouseCommand(config.readEntry("CommandWindow1","Activate, raise and pass click"), false );
CmdWindow2 = mouseCommand(config.readEntry("CommandWindow2","Activate and pass click"), false );
CmdWindow3 = mouseCommand(config.readEntry("CommandWindow3","Activate and pass click"), false );
CmdWindowWheel = mouseCommand(config.readEntry("CommandWindowWheel", "Scroll"), false);
CmdAllModKey = (config.readEntry("CommandAllKey","Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt;
CmdAll1 = mouseCommand(config.readEntry("CommandAll1","Move"), false );
CmdAll2 = mouseCommand(config.readEntry("CommandAll2","Toggle raise and lower"), false );
@ -308,6 +309,9 @@ Options::MouseCommand Options::mouseCommand(const QString &name, bool restricted
if (lowerName == "activate") return MouseActivate;
if (lowerName == "activate, raise and pass click") return MouseActivateRaiseAndPassClick;
if (lowerName == "activate and pass click") return MouseActivateAndPassClick;
if (lowerName == "scroll") return MouseNothing;
if (lowerName == "activate and scroll") return MouseActivateAndPassClick;
if (lowerName == "activate, raise and scroll") return MouseActivateRaiseAndPassClick;
if (lowerName == "activate, raise and move")
return restricted ? MouseActivateRaiseAndMove : MouseActivateRaiseAndUnrestrictedMove;
if (lowerName == "move") return restricted ? MouseMove : MouseUnrestrictedMove;

View File

@ -253,6 +253,7 @@ class Options : public KDecorationOptions
MouseCommand commandWindow1() { return CmdWindow1; }
MouseCommand commandWindow2() { return CmdWindow2; }
MouseCommand commandWindow3() { return CmdWindow3; }
MouseCommand commandWindowWheel() { return CmdWindowWheel; }
MouseCommand commandAll1() { return CmdAll1; }
MouseCommand commandAll2() { return CmdAll2; }
MouseCommand commandAll3() { return CmdAll3; }
@ -333,6 +334,7 @@ class Options : public KDecorationOptions
MouseCommand CmdWindow1;
MouseCommand CmdWindow2;
MouseCommand CmdWindow3;
MouseCommand CmdWindowWheel;
MouseCommand CmdAll1;
MouseCommand CmdAll2;
MouseCommand CmdAll3;