diff options
Diffstat (limited to 'kcontrol/input/mouse.cpp')
-rw-r--r-- | kcontrol/input/mouse.cpp | 149 |
1 files changed, 87 insertions, 62 deletions
diff --git a/kcontrol/input/mouse.cpp b/kcontrol/input/mouse.cpp index 0d07e782e..576e2c376 100644 --- a/kcontrol/input/mouse.cpp +++ b/kcontrol/input/mouse.cpp @@ -61,7 +61,7 @@ #include <tdelocale.h> #include <kdialog.h> #include <tdeconfig.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <kdebug.h> #include <tdeaboutdata.h> @@ -102,8 +102,8 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) tabwidget->addTab(tab1, i18n("&General")); - connect(tab1->handedBox, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(changed())); - connect(tab1->handedBox, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(slotHandedChanged(int))); + connect(tab1->handedBox, TQ_SIGNAL(clicked(int)), this, TQ_SLOT(changed())); + connect(tab1->handedBox, TQ_SIGNAL(clicked(int)), this, TQ_SLOT(slotHandedChanged(int))); wtstr = i18n("If you are left-handed, you may prefer to swap the" " functions of the left and right buttons on your pointing device" @@ -113,7 +113,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) " a three-button mouse, the middle button is unaffected."); TQWhatsThis::add( tab1->handedBox, wtstr ); - connect(tab1->doubleClick, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); + connect(tab1->doubleClick, TQ_SIGNAL(clicked()), TQ_SLOT(changed())); wtstr = i18n("The default behavior in TDE is to select and activate" " icons with a single click of the left button on your pointing" @@ -127,7 +127,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) TQWhatsThis::add( tab1->singleClick, wtstr ); - connect(tab1->cbAutoSelect, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); + connect(tab1->cbAutoSelect, TQ_SIGNAL(clicked()), this, TQ_SLOT(changed())); wtstr = i18n("If you check this option, pausing the mouse pointer" " over an icon on the screen will automatically select that icon." @@ -149,35 +149,33 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) wtstr = i18n("Show feedback when clicking an icon"); TQWhatsThis::add( tab1->cbVisualActivate, wtstr ); - connect(tab1->slAutoSelect, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(tab1->cbVisualActivate, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); + connect(tab1->slAutoSelect, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(tab1->cbVisualActivate, TQ_SIGNAL(clicked()), this, TQ_SLOT(changed())); - connect(tab1->cb_pointershape, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); + connect(tab1->cb_pointershape, TQ_SIGNAL(clicked()), this, TQ_SLOT(changed())); - connect(tab1->singleClick, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - connect(tab1->singleClick, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotClick())); + connect(tab1->singleClick, TQ_SIGNAL(clicked()), this, TQ_SLOT(changed())); + connect(tab1->singleClick, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotClick())); - connect( tab1->doubleClick, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotClick() ) ); - connect( tab1->cbAutoSelect, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotClick() ) ); + 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(); - } - connect(tab1->cbScrollPolarity, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - connect(tab1->cbScrollPolarity, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotScrollPolarityChanged())); + int buttonCount = XGetPointerMapping(tdeApp->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, TQT_SIGNAL(changed(bool)), TQT_SLOT(changed())); + connect(themetab, TQ_SIGNAL(changed(bool)), TQ_SLOT(changed())); tabwidget->addTab(themetab, i18n("&Cursor Theme")); // Advanced tab @@ -191,7 +189,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) accel->setLabel(i18n("Pointer acceleration:")); accel->setSuffix("x"); lay->addWidget(accel); - connect(accel, TQT_SIGNAL(valueChanged(double)), this, TQT_SLOT(changed())); + connect(accel, TQ_SIGNAL(valueChanged(double)), this, TQ_SLOT(changed())); wtstr = i18n("This option allows you to change the relationship" " between the distance that the mouse pointer moves on the" @@ -210,8 +208,8 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) thresh->setRange(0,20,1); thresh->setSteps(1,1); lay->addWidget(thresh); - connect(thresh, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(thresh, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotThreshChanged(int))); + connect(thresh, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(thresh, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotThreshChanged(int))); slotThreshChanged(thresh->value()); wtstr = i18n("The threshold is the smallest distance that the" @@ -231,7 +229,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) doubleClickInterval->setSuffix(i18n(" msec")); doubleClickInterval->setSteps(100, 100); lay->addWidget(doubleClickInterval); - connect(doubleClickInterval, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); + connect(doubleClickInterval, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); wtstr = i18n("The double click interval is the maximal time" " (in milliseconds) between two mouse clicks which" @@ -245,16 +243,17 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) doubleClickLabel = new TQLabel(i18n("Double-click on the image below to test your double-click interval:"), tab2); lay->addWidget(doubleClickLabel); - wtstr = i18n("The image will change when your double-click" + wtstr = i18n("<p>The image will change when your double-click" " test time is less than or equal to the interval you" - " configured. When changing the interval, be sure to select" - " the Apply button before testing. For example, the image" - " will not change when you configure a double-click interval" - " of 700 milliseconds and the time between two successive" - " clicks on the image is 800 milliseconds, but the image will" - " change when the time between clicks is 600 milliseconds." + " configured. For example, if you configure a double-click interval" + " of 700 milliseconds the image will not change when the time between" + " two successive clicks on the image is 800 milliseconds, but the image" + " will change when the time between clicks is 600 milliseconds." " The goal is to select a comfortable interval that you find" - " is not too fast or slow."); + " is not too fast or slow.</p>" + "" + " <p>When changing the interval it is not necessary to push" + " the <i>Apply</i> button before testing.</p>"); TQWhatsThis::add( doubleClickLabel, wtstr ); doubleClickStatus = false; // First image will be displayed doubleClickButton = new TQPushButton( tab2 ); @@ -267,9 +266,9 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) lay->addWidget(doubleClickButton); // Use the same What's This help for the pushbutton. TQWhatsThis::add( doubleClickButton, wtstr ); - connect(doubleClickButton, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotDoubleClickButtonPressed())); + connect(doubleClickButton, TQ_SIGNAL(pressed()), this, TQ_SLOT(slotDoubleClickButtonPressed())); doubleClickTimer=new TQTimer(); - connect(doubleClickTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotDoubleClickTimerDone()) ); + connect(doubleClickTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotDoubleClickTimerDone()) ); lay->addSpacing(10); @@ -279,7 +278,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) dragStartTime->setSuffix(i18n(" msec")); dragStartTime->setSteps(100, 100); lay->addWidget(dragStartTime); - connect(dragStartTime, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); + connect(dragStartTime, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); wtstr = i18n("If you click with the mouse (e.g. in a multi-line" " editor) and begin to move the mouse within the" @@ -291,8 +290,8 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) dragStartDist->setRange(1, 20, 1); dragStartDist->setSteps(1,1); lay->addWidget(dragStartDist); - connect(dragStartDist, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(dragStartDist, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotDragStartDistChanged(int))); + connect(dragStartDist, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(dragStartDist, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotDragStartDistChanged(int))); slotDragStartDistChanged(dragStartDist->value()); wtstr = i18n("If you click with the mouse and begin to move the" @@ -305,8 +304,8 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) wheelScrollLines->setRange(1, 12, 1); wheelScrollLines->setSteps(1,1); lay->addWidget(wheelScrollLines); - connect(wheelScrollLines, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(wheelScrollLines, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotWheelScrollLinesChanged(int))); + connect(wheelScrollLines, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(wheelScrollLines, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(slotWheelScrollLinesChanged(int))); slotWheelScrollLinesChanged(wheelScrollLines->value()); wtstr = i18n("If you use the wheel of a mouse, this value determines the number of lines to scroll for each wheel movement. Note that if this number exceeds the number of visible lines, it will be ignored and the wheel movement will be handled as a page up/down movement."); @@ -365,13 +364,13 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) mk_curve->setRange(-1000, 1000, 100); hbox->addWidget(mk_curve); - connect(mouseKeys, TQT_SIGNAL(clicked()), this, TQT_SLOT(checkAccess())); - connect(mouseKeys, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); - connect(mk_delay, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(mk_interval, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(mk_time_to_max, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(mk_max_speed, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); - connect(mk_curve, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); + connect(mouseKeys, TQ_SIGNAL(clicked()), this, TQ_SLOT(checkAccess())); + connect(mouseKeys, TQ_SIGNAL(clicked()), this, TQ_SLOT(changed())); + connect(mk_delay, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(mk_interval, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(mk_time_to_max, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(mk_max_speed, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); + connect(mk_curve, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(changed())); vbox->addStretch(); } @@ -435,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); @@ -521,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); @@ -596,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" ); @@ -621,7 +624,7 @@ void MouseConfig::save() themetab->save(); // restart kaccess - kapp->startServiceByDesktopName("kaccess"); + tdeApp->startServiceByDesktopName("kaccess"); TDECModule::changed(false); @@ -683,14 +686,14 @@ void MouseSettings::load(TDEConfig *config) { int accel_num, accel_den, threshold; double accel; - XGetPointerControl( kapp->getDisplay(), + XGetPointerControl( tdeApp->getDisplay(), &accel_num, &accel_den, &threshold ); accel = float(accel_num) / float(accel_den); // get settings from X server int h = RIGHT_HANDED; unsigned char map[20]; - num_buttons = XGetPointerMapping(kapp->getDisplay(), map, 20); + num_buttons = XGetPointerMapping(tdeApp->getDisplay(), map, 20); handedEnabled = true; @@ -745,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 @@ -777,14 +781,14 @@ void MouseConfig::slotWheelScrollLinesChanged(int value) void MouseSettings::apply(bool force) { - XChangePointerControl( kapp->getDisplay(), + XChangePointerControl( tdeApp->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]; - num_buttons = XGetPointerMapping(kapp->getDisplay(), map, 256); + num_buttons = XGetPointerMapping(tdeApp->getDisplay(), map, 256); int remap=(num_buttons>=1); if (handedEnabled && (m_handedNeedsApply || force)) { @@ -835,10 +839,25 @@ 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) - while ((retval=XSetPointerMapping(kapp->getDisplay(), map, + while ((retval=XSetPointerMapping(tdeApp->getDisplay(), map, num_buttons)) == MappingBusy) /* keep trying until the pointer is free */ { }; @@ -864,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); @@ -890,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(); |