diff options
Diffstat (limited to 'kcontrol/input')
-rw-r--r-- | kcontrol/input/kmousedlg.ui | 18 | ||||
-rw-r--r-- | kcontrol/input/mouse.cpp | 54 | ||||
-rw-r--r-- | kcontrol/input/mouse.h | 2 |
3 files changed, 57 insertions, 17 deletions
diff --git a/kcontrol/input/kmousedlg.ui b/kcontrol/input/kmousedlg.ui index bd559b819..0bcc7f846 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> @@ -132,7 +135,18 @@ <string>Re&verse scroll direction</string> </property> <property name="whatsThis" stdset="0"> - <string>Change the direction of scrolling for the mouse wheel or the 4th and 5th mouse buttons.</string> + <string>Change the direction of scrolling for the mouse wheel, if present.</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbRevHistButtons</cstring> + </property> + <property name="text"> + <string>Swap &history navigation buttons</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Swap the two history navigation buttons on the mouse, if present.</string> </property> </widget> <widget class="TQGroupBox"> diff --git a/kcontrol/input/mouse.cpp b/kcontrol/input/mouse.cpp index 84ec2d263..523696761 100644 --- a/kcontrol/input/mouse.cpp +++ b/kcontrol/input/mouse.cpp @@ -160,21 +160,19 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) connect( tab1->doubleClick, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotClick() ) ); connect( tab1->cbAutoSelect, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotClick() ) ); - // Only allow setting reversing scroll polarity if we have scroll buttons unsigned char map[20]; - if ( XGetPointerMapping(kapp->getDisplay(), map, 20) >= 5 ) - { - tab1->cbScrollPolarity->setEnabled( true ); - tab1->cbScrollPolarity->show(); - } - else - { - tab1->cbScrollPolarity->setEnabled( false ); - tab1->cbScrollPolarity->hide(); - } + int buttonCount = XGetPointerMapping(kapp->getDisplay(), map, 20); + + // Only allow setting reversing scroll polarity if we have scroll buttons + tab1->cbScrollPolarity->setEnabled(buttonCount >= 5); 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 + tab1->cbRevHistButtons->setEnabled(buttonCount >= 9); + 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 +434,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 +520,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 +598,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 +748,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 +784,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 +839,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 +883,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 +910,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); |