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

@ -22,6 +22,7 @@
#ifndef __KKWMMOUSECONFIG_H__ #ifndef __KKWMMOUSECONFIG_H__
#define __KKWMMOUSECONFIG_H__ #define __KKWMMOUSECONFIG_H__
class TQCheckBox;
class TDEConfig; class TDEConfig;
#include <tqwidget.h> #include <tqwidget.h>
@ -66,14 +67,14 @@ public slots:
private: private:
TQComboBox* coTiDbl; TQComboBox* coTiDbl;
TQComboBox* coTiAct1; TQComboBox* coTiAct1;
TQComboBox* coTiAct2; TQComboBox* coTiAct2;
TQComboBox* coTiAct3; TQComboBox* coTiAct3;
TQComboBox* coTiAct4;
TQComboBox* coTiInAct1; TQComboBox* coTiInAct1;
TQComboBox* coTiInAct2; TQComboBox* coTiInAct2;
TQComboBox* coTiInAct3; TQComboBox* coTiInAct3;
TQComboBox* coTiW;
TQCheckBox* cbTiRevW;
ToolTipComboBox * coMax[3]; ToolTipComboBox * coMax[3];
@ -120,6 +121,7 @@ private:
TQComboBox* coAll2; TQComboBox* coAll2;
TQComboBox* coAll3; TQComboBox* coAll3;
TQComboBox* coAllW; TQComboBox* coAllW;
TQCheckBox* cbAllRevW;
TDEConfig *config; TDEConfig *config;
bool standAlone; bool standAlone;

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

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

Loading…
Cancel
Save