summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-08-18 18:27:33 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-08-19 11:01:51 +0900
commitb1934dda614fa4178a4a3213c2c9a649852d6cb5 (patch)
tree0e406e4bb3b0eb8df35d7604a5fda36035f0cc20
parent7cb82d805bb77cdeb009e1a2ef59ab3fdf2476af (diff)
downloadtdebase-b1934dda614fa4178a4a3213c2c9a649852d6cb5.tar.gz
tdebase-b1934dda614fa4178a4a3213c2c9a649852d6cb5.zip
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> (cherry picked from commit 11a496c359b8d2d87433f5cb2b06545a08d001d5)
-rw-r--r--twin/kcmtwin/twinoptions/mouse.cpp61
-rw-r--r--twin/kcmtwin/twinoptions/mouse.h14
-rw-r--r--twin/options.cpp22
-rw-r--r--twin/options.h32
4 files changed, 78 insertions, 51 deletions
diff --git a/twin/kcmtwin/twinoptions/mouse.cpp b/twin/kcmtwin/twinoptions/mouse.cpp
index 8778d915e..51a3b8a9f 100644
--- a/twin/kcmtwin/twinoptions/mouse.cpp
+++ b/twin/kcmtwin/twinoptions/mouse.cpp
@@ -18,7 +18,7 @@
*/
#include <tqlabel.h>
-#include <tqcombobox.h>
+#include <tqcheckbox.h>
#include <tqwhatsthis.h>
#include <tqlayout.h>
#include <tqvgroupbox.h>
@@ -178,23 +178,28 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, TDEConfig *_co
hlayoutW->addWidget(label);
txtButton4 = i18n("Handle mouse wheel events");
TQWhatsThis::add( label, txtButton4);
-
- // Titlebar and frame mouse Wheel
+
+ // Titlebar and frame mouse Wheel
TQComboBox* comboW = new TQComboBox(this);
comboW->insertItem(i18n("Raise/Lower"));
comboW->insertItem(i18n("Shade/Unshade"));
comboW->insertItem(i18n("Maximize/Restore"));
- comboW->insertItem(i18n("Keep Above/Below"));
- comboW->insertItem(i18n("Move to Previous/Next Desktop"));
- comboW->insertItem(i18n("Change Opacity"));
- comboW->insertItem(i18n("Nothing"));
+ comboW->insertItem(i18n("Keep Above/Below"));
+ comboW->insertItem(i18n("Move to Previous/Next Desktop"));
+ comboW->insertItem(i18n("Change Opacity"));
+ comboW->insertItem(i18n("Nothing"));
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,8 +496,8 @@ 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 )
- combo->setCurrentItem( tbl_txt_lookup( tbl_TiWAc, txt ));
+ else if( combo == coTiW )
+ combo->setCurrentItem( tbl_txt_lookup( tbl_TiWAc, txt ));
else if( combo == coMax[0] || combo == coMax[1] || combo == coMax[2] )
{
combo->setCurrentItem( tbl_txt_lookup( tbl_Max, txt ));
@@ -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,10 +562,11 @@ 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)
{
config->sync();
@@ -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"));
@@ -756,14 +766,18 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, TDEConfig *_config
combo->insertItem(i18n("Raise/Lower"));
combo->insertItem(i18n("Shade/Unshade"));
combo->insertItem(i18n("Maximize/Restore"));
- combo->insertItem(i18n("Keep Above/Below"));
- combo->insertItem(i18n("Move to Previous/Next Desktop"));
- combo->insertItem(i18n("Change Opacity"));
- combo->insertItem(i18n("Nothing"));
+ combo->insertItem(i18n("Keep Above/Below"));
+ combo->insertItem(i18n("Move to Previous/Next Desktop"));
+ combo->insertItem(i18n("Change Opacity"));
+ combo->insertItem(i18n("Nothing"));
connect(combo, TQT_SIGNAL(activated(int)), TQT_SLOT(changed()));
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();
@@ -784,7 +798,7 @@ void KWindowActionsConfig::setComboText( TQComboBox* combo, const char*txt )
else if( combo == coAll1 || combo == coAll2 || combo == coAll3 )
combo->setCurrentItem( tbl_txt_lookup( tbl_All, txt ));
else if( combo == coAllW )
- combo->setCurrentItem( tbl_txt_lookup( tbl_AllW, txt ));
+ combo->setCurrentItem( tbl_txt_lookup( tbl_AllW, txt ));
else
abort();
}
@@ -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,7 +848,8 @@ 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)
{
config->sync();
@@ -853,4 +869,5 @@ void KWindowActionsConfig::defaults()
setComboText(coAll2,"Toggle raise and lower");
setComboText(coAll3,"Resize");
setComboText(coAllW,"Nothing");
+ cbAllRevW->setChecked(false);
}
diff --git a/twin/kcmtwin/twinoptions/mouse.h b/twin/kcmtwin/twinoptions/mouse.h
index 772bc5ac9..5dd3b8402 100644
--- a/twin/kcmtwin/twinoptions/mouse.h
+++ b/twin/kcmtwin/twinoptions/mouse.h
@@ -22,6 +22,7 @@
#ifndef __KKWMMOUSECONFIG_H__
#define __KKWMMOUSECONFIG_H__
+class TQCheckBox;
class TDEConfig;
#include <tqwidget.h>
@@ -33,7 +34,7 @@ class TDEConfig;
class ToolTipComboBox: public TQComboBox
{
Q_OBJECT
-
+
public:
ToolTipComboBox(TQWidget * owner, char const * const * toolTips_)
: TQComboBox(owner)
@@ -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];
@@ -82,7 +83,7 @@ private:
const char* functionTiDbl(int);
const char* functionTiAc(int);
- const char* functionTiWAc(int);
+ const char* functionTiWAc(int);
const char* functionTiInAc(int);
const char* functionMax(int);
@@ -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;
diff --git a/twin/options.cpp b/twin/options.cpp
index 0bb127e11..ce35f6d06 100644
--- a/twin/options.cpp
+++ b/twin/options.cpp
@@ -71,12 +71,12 @@ unsigned long Options::updateSettings()
altTabStyle = KDE; // what a default :-)
if ( val == "CDE" )
altTabStyle = CDE;
-
+
separateScreenFocus = config->readBoolEntry( "SeparateScreenFocus", false );
activeMouseScreen = config->readBoolEntry( "ActiveMouseScreen", focusPolicy != ClickToFocus );
rollOverDesktops = config->readBoolEntry("RollOverDesktops", TRUE);
-
+
// focusStealingPreventionLevel = config->readNumEntry( "FocusStealingPreventionLevel", 2 );
// TODO use low level for now
focusStealingPreventionLevel = config->readNumEntry( "FocusStealingPreventionLevel", 1 );
@@ -101,14 +101,14 @@ unsigned long Options::updateSettings()
animateMinimize = config->readBoolEntry("AnimateMinimize", TRUE );
animateMinimizeSpeed = config->readNumEntry("AnimateMinimizeSpeed", 5 );
- if( focusPolicy == ClickToFocus )
+ if( focusPolicy == ClickToFocus )
{
autoRaise = false;
autoRaiseInterval = 0;
delayFocus = false;
delayFocusInterval = 0;
}
- else
+ else
{
autoRaise = config->readBoolEntry("AutoRaise", FALSE );
autoRaiseInterval = config->readNumEntry("AutoRaiseInterval", 0 );
@@ -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" );
@@ -193,7 +195,7 @@ unsigned long Options::updateSettings()
resetKompmgr = config->readBoolEntry("ResetKompmgr", false);
if (resetKompmgr)
config->writeEntry("ResetKompmgr",FALSE);
-
+
// window drop shadows
config->setGroup("Style");
shadow_colour = config->readColorEntry("ShadowColour", &TQt::black);
@@ -213,7 +215,7 @@ unsigned long Options::updateSettings()
shadow_x_offset = config->readNumEntry("ShadowXOffset", 0);
shadow_y_offset = config->readNumEntry("ShadowYOffset", 10);
-
+
// Read button tooltip animation effect from kdeglobals
// Since we want to allow users to enable window decoration tooltips
// and not tdestyle tooltips and vise-versa, we don't read the
@@ -227,7 +229,7 @@ unsigned long Options::updateSettings()
desktop_topmenu = kdesktopcfg.readBoolEntry( "ShowMenubar", false );
if( desktop_topmenu )
topmenus = true;
-
+
TQToolTip::setGloballyEnabled( d->show_tooltips );
return changed;
@@ -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:
diff --git a/twin/options.h b/twin/options.h
index 2c5341f81..113e6b9e6 100644
--- a/twin/options.h
+++ b/twin/options.h
@@ -25,7 +25,7 @@ namespace KWinInternal
class Client;
-class Options : public KDecorationOptions
+class Options : public KDecorationOptions
{
public:
@@ -124,7 +124,7 @@ class Options : public KDecorationOptions
*/
enum AltTabStyle { KDE, CDE };
AltTabStyle altTabStyle;
-
+
// whether to see Xinerama screens separately for focus (in Alt+Tab, when activating next client)
bool separateScreenFocus;
// whether active Xinerama screen is the one with mouse (or with the active window)
@@ -138,7 +138,7 @@ class Options : public KDecorationOptions
bool xineramaMovementEnabled;
bool xineramaMaximizeEnabled;
bool xineramaFullscreenEnabled;
-
+
// number, or -1 = active screen (Workspace::activeScreen())
int xineramaPlacementScreen;
@@ -149,13 +149,13 @@ class Options : public KDecorationOptions
MoveResizeMode resizeMode;
MoveResizeMode moveMode;
-
+
static MoveResizeMode stringToMoveResizeMode( const TQString& s );
static const char* moveResizeModeToString( MoveResizeMode mode );
Placement::Policy placement;
- bool focusPolicyIsReasonable()
+ bool focusPolicyIsReasonable()
{
return focusPolicy == ClickToFocus || focusPolicy == FocusFollowsMouse;
}
@@ -190,7 +190,7 @@ class Options : public KDecorationOptions
* Animation speed (0 .. 10 )
*/
int animateMinimizeSpeed;
-
+
bool showDesktopIsMinimizeAll;
/**
@@ -205,12 +205,12 @@ class Options : public KDecorationOptions
* List of window classes to ignore PPosition size hint
*/
TQStringList ignorePositionClasses;
-
+
bool checkIgnoreFocusStealing( const Client* c );
WindowOperation operationTitlebarDblClick() { return OpTitlebarDblClick; }
- enum MouseCommand
+ enum MouseCommand
{
MouseRaise, MouseLower, MouseOperationsMenu, MouseToggleRaiseAndLower,
MouseActivateAndRaise, MouseActivateAndLower, MouseActivate,
@@ -225,7 +225,7 @@ class Options : public KDecorationOptions
MouseOpacityMore, MouseOpacityLess,
MouseNothing
};
-
+
enum MouseWheelCommand
{
MouseWheelRaiseLower, MouseWheelShadeUnshade, MouseWheelMaximizeRestore,
@@ -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; }
@@ -319,13 +319,13 @@ class Options : public KDecorationOptions
* @returns the activation delay for electric borders in milliseconds.
*/
int electricBorderDelay();
-
+
bool topMenuEnabled() const { return topmenus; }
bool desktopTopMenu() const { return desktop_topmenu; }
-
+
// timeout before non-responding application will be killed after attempt to close
int killPingTimeout;
-
+
// Whether to hide utility windows for inactive applications.
bool hideUtilityWindowsForInactive;
@@ -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;