summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kcontrol/input/kmousedlg.ui16
-rw-r--r--kcontrol/input/mouse.cpp51
-rw-r--r--kcontrol/input/mouse.h2
3 files changed, 63 insertions, 6 deletions
diff --git a/kcontrol/input/kmousedlg.ui b/kcontrol/input/kmousedlg.ui
index bd559b819..89cc2a652 100644
--- a/kcontrol/input/kmousedlg.ui
+++ b/kcontrol/input/kmousedlg.ui
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>KMouseDlg</class>
<widget class="TQWidget">
<property name="name">
@@ -12,6 +12,9 @@
<height>434</height>
</rect>
</property>
+ <property name="caption">
+ <string>KMouseDlg</string>
+ </property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
@@ -135,6 +138,17 @@
<string>Change the direction of scrolling for the mouse wheel or the 4th and 5th mouse buttons.</string>
</property>
</widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>cbRevHistButtons</cstring>
+ </property>
+ <property name="text">
+ <string>Swap &amp;history navigation buttons</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Swap the two history navigation buttons on the mouse (8th and 9th mouse button).</string>
+ </property>
+ </widget>
<widget class="TQGroupBox">
<property name="name">
<cstring>GroupBox1</cstring>
diff --git a/kcontrol/input/mouse.cpp b/kcontrol/input/mouse.cpp
index 84ec2d263..b0f9debf0 100644
--- a/kcontrol/input/mouse.cpp
+++ b/kcontrol/input/mouse.cpp
@@ -162,7 +162,8 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name)
// Only allow setting reversing scroll polarity if we have scroll buttons
unsigned char map[20];
- if ( XGetPointerMapping(kapp->getDisplay(), map, 20) >= 5 )
+ int buttonCount = XGetPointerMapping(kapp->getDisplay(), map, 20);
+ if ( buttonCount >= 5 )
{
tab1->cbScrollPolarity->setEnabled( true );
tab1->cbScrollPolarity->show();
@@ -175,6 +176,20 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name)
connect(tab1->cbScrollPolarity, TQ_SIGNAL(clicked()), this, TQ_SLOT(changed()));
connect(tab1->cbScrollPolarity, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotScrollPolarityChanged()));
+ // Only allow setting reversing history buttons (8, 9) if we have actually have them
+ if ( buttonCount >= 9 )
+ {
+ tab1->cbRevHistButtons->setEnabled( true );
+ tab1->cbRevHistButtons->show();
+ }
+ else
+ {
+ tab1->cbRevHistButtons->setEnabled( false );
+ tab1->cbRevHistButtons->hide();
+ }
+ connect(tab1->cbRevHistButtons, TQ_SIGNAL(clicked()), this, TQ_SLOT(changed()));
+ connect(tab1->cbRevHistButtons, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotRevHistButtonsChanged()));
+
// Cursor theme tab
themetab = new ThemePage(this);
connect(themetab, TQ_SIGNAL(changed(bool)), TQ_SLOT(changed()));
@@ -436,7 +451,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name)
load();
TDEAboutData* about = new TDEAboutData("kcmmouse", I18N_NOOP("Mouse"), 0, 0,
- TDEAboutData::License_GPL, I18N_NOOP("(c) 1997 - 2005 Mouse developers"));
+ TDEAboutData::License_GPL, I18N_NOOP("(c) 1997 - 2005 Mouse developers"));
about->addAuthor("Patrick Dowler", 0, 0);
about->addAuthor("Dirk A. Mueller", 0, 0);
about->addAuthor("David Faure", 0, 0);
@@ -522,9 +537,12 @@ void MouseConfig::load( bool useDefaults )
tab1->rightHanded->setEnabled(settings->handedEnabled);
tab1->leftHanded->setEnabled(settings->handedEnabled);
- if ( tab1->cbScrollPolarity->isEnabled() )
- tab1->cbScrollPolarity->setEnabled(settings->handedEnabled);
+ if (tab1->cbScrollPolarity->isEnabled())
+ tab1->cbScrollPolarity->setEnabled(settings->handedEnabled);
+ if (tab1->cbRevHistButtons->isEnabled())
+ tab1->cbRevHistButtons->setEnabled(settings->handedEnabled);
tab1->cbScrollPolarity->setChecked( settings->reverseScrollPolarity );
+ tab1->cbRevHistButtons->setChecked( settings->reverseHistoryButtons );
setAccel(settings->accelRate);
setThreshold(settings->thresholdMove);
@@ -597,6 +615,7 @@ void MouseConfig::save()
// settings->changeCursor = tab1->singleClick->isChecked();
settings->changeCursor = tab1->cb_pointershape->isChecked();
settings->reverseScrollPolarity = tab1->cbScrollPolarity->isChecked();
+ settings->reverseHistoryButtons = tab1->cbRevHistButtons->isChecked();
settings->apply();
TDEConfig config( "kcminputrc" );
@@ -746,6 +765,7 @@ void MouseSettings::load(TDEConfig *config)
else if (key == NULL)
handed = h;
reverseScrollPolarity = config->readBoolEntry( "ReverseScrollPolarity", false );
+ reverseHistoryButtons = config->readBoolEntry( "ReverseHistoryButtons", false );
m_handedNeedsApply = false;
// SC/DC/AutoSelect/ChangeCursor
@@ -781,7 +801,7 @@ void MouseSettings::apply(bool force)
XChangePointerControl( kapp->getDisplay(),
true, true, int(tqRound(accelRate*10)), 10, thresholdMove);
- // 256 might seems extreme, but X has already been known to return 32,
+ // 256 might seems extreme, but X has already been known to return 32,
// and we don't want to truncate things. Xlib limits the table to 256 bytes,
// so it's a good uper bound..
unsigned char map[256];
@@ -836,6 +856,21 @@ void MouseSettings::apply(bool force)
map[pos+1] = reverseScrollPolarity ? (unsigned char) 4 : (unsigned char) 5;
}
}
+ // 8,9 => history navigation buttons
+ // Logic is same as above with buttons 4 and 5, we find the buttons
+ // in the mapping, then, if needed, reverse them.
+ if (num_buttons >= 9)
+ {
+ int pos;
+ for( pos = 0; pos < num_buttons; ++pos )
+ if( map[pos] == 8 || map[pos] == 9 )
+ break;
+ if( pos < num_buttons - 1 )
+ {
+ map[pos] = reverseHistoryButtons ? (unsigned char) 9 : (unsigned char) 8;
+ map[pos+1] = reverseHistoryButtons ? (unsigned char) 8 : (unsigned char) 9;
+ }
+ }
}
int retval;
if (remap)
@@ -865,6 +900,7 @@ void MouseSettings::save(TDEConfig *config)
else
config->writeEntry("MouseButtonMapping",TQString("LeftHanded"));
config->writeEntry( "ReverseScrollPolarity", reverseScrollPolarity );
+ config->writeEntry( "ReverseHistoryButtons", reverseHistoryButtons );
config->setGroup("KDE");
config->writeEntry("DoubleClickInterval", doubleClickInterval, true, true);
@@ -891,6 +927,11 @@ void MouseConfig::slotScrollPolarityChanged()
settings->m_handedNeedsApply = true;
}
+void MouseConfig::slotRevHistButtonsChanged()
+{
+ settings->m_handedNeedsApply = true;
+}
+
TQString MouseConfig::handbookSection() const
{
int index = tabwidget->currentPageIndex();
diff --git a/kcontrol/input/mouse.h b/kcontrol/input/mouse.h
index 7db5fbf91..22d0aa84c 100644
--- a/kcontrol/input/mouse.h
+++ b/kcontrol/input/mouse.h
@@ -83,6 +83,7 @@ public:
bool changeCursor;
int wheelScrollLines;
bool reverseScrollPolarity;
+ bool reverseHistoryButtons;
#ifdef HAVE_LIBUSB
TQPtrList <LogitechMouse> logitechMouseList;
@@ -111,6 +112,7 @@ private slots:
/** No descriptions */
void slotHandedChanged(int val);
void slotScrollPolarityChanged();
+ void slotRevHistButtonsChanged();
void checkAccess();
void slotThreshChanged(int value);
void slotDragStartDistChanged(int value);