Added checkbox to invert mouse wheel direction in window's titlebar and frame actions.

This resolves issue TDE/tde#64.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/220/head
Michele Calgaro 3 years ago
parent 8665255c0c
commit 11a496c359
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -18,7 +18,7 @@
*/
#include <tqlabel.h>
#include <tqcombobox.h>
#include <tqcheckbox.h>
#include <tqwhatsthis.h>
#include <tqlayout.h>
#include <tqvgroupbox.h>
@ -191,10 +191,15 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, TDEConfig *_co
comboW->setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed));
connect(comboW, TQT_SIGNAL(activated(int)), TQT_SLOT(changed()));
hlayoutW->addWidget(comboW);
coTiAct4 = comboW;
coTiW = comboW;
TQWhatsThis::add(comboW, txtButton4);
label->setBuddy(comboW);
cbTiRevW = new TQCheckBox(i18n("Reverse wheel direction"), this);
connect(cbTiRevW, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
TQWhatsThis::add( cbTiRevW, i18n("Use this to reverse the action of the mouse wheel.") );
hlayoutW->addWidget(cbTiRevW);
/** Titlebar and frame **************/
box = new TQVGroupBox( i18n("Titlebar && Frame"), this, "Titlebar and Frame");
@ -491,7 +496,7 @@ void KTitleBarActionsConfig::setComboText( TQComboBox* combo, const char*txt )
combo->setCurrentItem( tbl_txt_lookup( tbl_TiAc, txt ));
else if( combo == coTiInAct1 || combo == coTiInAct2 || combo == coTiInAct3 )
combo->setCurrentItem( tbl_txt_lookup( tbl_TiInAc, txt ));
else if( combo == coTiAct4 )
else if( combo == coTiW )
combo->setCurrentItem( tbl_txt_lookup( tbl_TiWAc, txt ));
else if( combo == coMax[0] || combo == coMax[1] || combo == coMax[2] )
{
@ -538,10 +543,11 @@ void KTitleBarActionsConfig::load()
setComboText(coTiAct1,config->readEntry("CommandActiveTitlebar1","Raise").ascii());
setComboText(coTiAct2,config->readEntry("CommandActiveTitlebar2","Lower").ascii());
setComboText(coTiAct3,config->readEntry("CommandActiveTitlebar3","Operations menu").ascii());
setComboText(coTiAct4,config->readEntry("CommandTitlebarWheel","Nothing").ascii());
setComboText(coTiInAct1,config->readEntry("CommandInactiveTitlebar1","Activate and raise").ascii());
setComboText(coTiInAct2,config->readEntry("CommandInactiveTitlebar2","Activate and lower").ascii());
setComboText(coTiInAct3,config->readEntry("CommandInactiveTitlebar3","Operations menu").ascii());
setComboText(coTiW,config->readEntry("CommandTitlebarWheel","Nothing").ascii());
cbTiRevW->setChecked(config->readBoolEntry("CommandTitlebarReverseWheel", false));
}
void KTitleBarActionsConfig::save()
@ -556,9 +562,10 @@ void KTitleBarActionsConfig::save()
config->writeEntry("CommandActiveTitlebar2", functionTiAc(coTiAct2->currentItem()));
config->writeEntry("CommandActiveTitlebar3", functionTiAc(coTiAct3->currentItem()));
config->writeEntry("CommandInactiveTitlebar1", functionTiInAc(coTiInAct1->currentItem()));
config->writeEntry("CommandTitlebarWheel", functionTiWAc(coTiAct4->currentItem()));
config->writeEntry("CommandInactiveTitlebar2", functionTiInAc(coTiInAct2->currentItem()));
config->writeEntry("CommandInactiveTitlebar3", functionTiInAc(coTiInAct3->currentItem()));
config->writeEntry("CommandTitlebarWheel", functionTiWAc(coTiW->currentItem()));
config->writeEntry("CommandTitlebarReverseWheel", cbTiRevW->isChecked());
if (standAlone)
{
@ -575,10 +582,11 @@ void KTitleBarActionsConfig::defaults()
setComboText(coTiAct1,"Raise");
setComboText(coTiAct2,"Lower");
setComboText(coTiAct3,"Operations menu");
setComboText(coTiAct4,"Nothing");
setComboText(coTiInAct1,"Activate and raise");
setComboText(coTiInAct2,"Activate and lower");
setComboText(coTiInAct3,"Operations menu");
setComboText(coTiW,"Nothing");
cbTiRevW->setChecked(false);
for (int t = 0; t < 3; ++t)
setComboText(coMax[t], tbl_Max[t]);
}
@ -676,7 +684,7 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, TDEConfig *_config
TQWhatsThis::add( box, i18n("Here you can customize TDE's behavior when clicking somewhere into"
" a window while pressing a modifier key."));
grid = new TQGrid(5, Qt::Vertical, box);
grid = new TQGrid(6, Qt::Vertical, box);
// Labels
label = new TQLabel(i18n("Modifier key:"), grid);
@ -716,6 +724,8 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, TDEConfig *_config
" in a window while pressing the modifier key.");
TQWhatsThis::add( label, strAllW);
label = new TQLabel("", grid); // Dummy label to keep grid in order
// Combo's
combo = new TQComboBox(grid);
combo->insertItem(i18n("Meta"));
@ -764,6 +774,10 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, TDEConfig *_config
coAllW = combo;
TQWhatsThis::add( combo, strAllW );
cbAllRevW = new TQCheckBox(i18n("Reverse wheel direction"), grid);
connect(cbAllRevW, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
TQWhatsThis::add( cbAllRevW, i18n("Use this to reverse the action of the mouse wheel.") );
layout->addStretch();
load();
@ -820,6 +834,7 @@ void KWindowActionsConfig::load()
setComboText(coAll2,config->readEntry("CommandAll2","Toggle raise and lower").ascii());
setComboText(coAll3,config->readEntry("CommandAll3","Resize").ascii());
setComboText(coAllW,config->readEntry("CommandAllWheel","Nothing").ascii());
cbAllRevW->setChecked(config->readBoolEntry("CommandAllReverseWheel", false));
}
void KWindowActionsConfig::save()
@ -833,6 +848,7 @@ void KWindowActionsConfig::save()
config->writeEntry("CommandAll2", functionAll(coAll2->currentItem()));
config->writeEntry("CommandAll3", functionAll(coAll3->currentItem()));
config->writeEntry("CommandAllWheel", functionAllW(coAllW->currentItem()));
config->writeEntry("CommandAllReverseWheel", cbAllRevW->isChecked());
if (standAlone)
{
@ -853,4 +869,5 @@ void KWindowActionsConfig::defaults()
setComboText(coAll2,"Toggle raise and lower");
setComboText(coAll3,"Resize");
setComboText(coAllW,"Nothing");
cbAllRevW->setChecked(false);
}

@ -22,6 +22,7 @@
#ifndef __KKWMMOUSECONFIG_H__
#define __KKWMMOUSECONFIG_H__
class TQCheckBox;
class TDEConfig;
#include <tqwidget.h>
@ -62,18 +63,18 @@ public:
void defaults();
public slots:
void changed() { emit TDECModule::changed(true); }
void changed() { emit TDECModule::changed(true); }
private:
TQComboBox* coTiDbl;
TQComboBox* coTiAct1;
TQComboBox* coTiAct2;
TQComboBox* coTiAct3;
TQComboBox* coTiAct4;
TQComboBox* coTiInAct1;
TQComboBox* coTiInAct2;
TQComboBox* coTiInAct3;
TQComboBox* coTiW;
TQCheckBox* cbTiRevW;
ToolTipComboBox * coMax[3];
@ -108,7 +109,7 @@ public:
void defaults();
public slots:
void changed() { emit TDECModule::changed(true); }
void changed() { emit TDECModule::changed(true); }
private:
TQComboBox* coWin1;
@ -120,6 +121,7 @@ private:
TQComboBox* coAll2;
TQComboBox* coAll3;
TQComboBox* coAllW;
TQCheckBox* cbAllRevW;
TDEConfig *config;
bool standAlone;

@ -159,6 +159,7 @@ unsigned long Options::updateSettings()
CmdInactiveTitlebar2 = mouseCommand(config->readEntry("CommandInactiveTitlebar2","Activate and lower"), true );
CmdInactiveTitlebar3 = mouseCommand(config->readEntry("CommandInactiveTitlebar3","Operations menu"), true );
CmdTitlebarWheel = mouseWheelCommand(config->readEntry("CommandTitlebarWheel","Nothing"));
CmdTitlebarRevWheel = config->readBoolEntry("CommandTitlebarReverseWheel", false);
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 );
@ -167,6 +168,7 @@ unsigned long Options::updateSettings()
CmdAll2 = mouseCommand(config->readEntry("CommandAll2","Toggle raise and lower"), false );
CmdAll3 = mouseCommand(config->readEntry("CommandAll3","Resize"), false );
CmdAllWheel = mouseWheelCommand(config->readEntry("CommandAllWheel","Nothing"));
CmdAllRevWheel = config->readBoolEntry("CommandAllReverseWheel", false);
//translucency settings
config->setGroup( "Notification Messages" );
@ -386,8 +388,12 @@ bool Options::checkIgnoreFocusStealing( const Client* c )
return ignoreFocusStealingClasses.contains(TQString::fromLatin1(c->resourceClass()));
}
Options::MouseCommand Options::wheelToMouseCommand( MouseWheelCommand com, int delta )
Options::MouseCommand Options::wheelToMouseCommand( MouseWheelCommand com, int delta, bool revDir )
{
if (revDir)
{
delta = -delta;
}
switch( com )
{
case MouseWheelRaiseLower:

@ -236,11 +236,11 @@ class Options : public KDecorationOptions
MouseCommand operationTitlebarMouseWheel( int delta )
{
return wheelToMouseCommand( CmdTitlebarWheel, delta );
return wheelToMouseCommand( CmdTitlebarWheel, delta, CmdTitlebarRevWheel );
}
MouseCommand operationWindowMouseWheel( int delta )
{
return wheelToMouseCommand( CmdAllWheel, delta );
return wheelToMouseCommand( CmdAllWheel, delta, CmdAllRevWheel );
}
MouseCommand commandActiveTitlebar1() { return CmdActiveTitlebar1; }
@ -362,6 +362,7 @@ class Options : public KDecorationOptions
MouseCommand CmdInactiveTitlebar2;
MouseCommand CmdInactiveTitlebar3;
MouseWheelCommand CmdTitlebarWheel;
bool CmdTitlebarRevWheel;
MouseCommand CmdWindow1;
MouseCommand CmdWindow2;
MouseCommand CmdWindow3;
@ -369,6 +370,7 @@ class Options : public KDecorationOptions
MouseCommand CmdAll2;
MouseCommand CmdAll3;
MouseWheelCommand CmdAllWheel;
bool CmdAllRevWheel;
uint CmdAllModKey;
int electric_borders;
@ -395,7 +397,7 @@ class Options : public KDecorationOptions
// List of window classes for which not to use focus stealing prevention
TQStringList ignoreFocusStealingClasses;
MouseCommand wheelToMouseCommand( MouseWheelCommand com, int delta );
MouseCommand wheelToMouseCommand( MouseWheelCommand com, int delta, bool revDir );
};
extern Options* options;

Loading…
Cancel
Save