Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using Slackware 13.1 (kernel 2.6) with FVWM as my desktop manager.

I have frequently had issues when coding where my over-sensitive mouse registers a middle-button (mouse-wheel) click while scrolling with the mouse-wheel.

Is there any way to modify the shortcut so that middle-click no longer pastes using the built-in clipboard with X11/Xorg/Xfree86? I would prefer if it were re-mapped to something like +MiddleClick, or something similar.

I have searched through the forums already, and have found some suggestions using XMODMAP, but none have worked so far.

Thank you all in advance for your time and assistance.

share|improve this question

migrated from stackoverflow.com Nov 16 '11 at 23:27

This question came from our site for professional and enthusiast programmers.

    
It could help if you tell what you tried. –  Luc M Nov 16 '11 at 20:33
    
Can you say what was tried by you? And give links to forums. I was only able to find this askubuntu.com/questions/4507/… –  osgx Nov 16 '11 at 22:55

1 Answer 1

You can modify ButtonMapping Option in X config: http://www.linuxquestions.org/questions/linux-newbie-8/disable-xorgs-highlight-to-copy-middle-click-to-paste-clipboard-647810/

Option "ButtonMapping" "1 1 3 4 5"

Update: in the thread: http://askubuntu.com/questions/4507/how-do-i-disable-middle-mouse-button-click-paste

the patch to gtk is linked, which will disable middle button as paste: http://subversion.assembla.com/svn/slipstream/patches/gtk_disable_middle_mouse_button_paste.patch

There is an overview of middle button action in different graphic libs/applications: http://os.livejournal.com/811721.html - so I can assume that middleButton action as XA_PRIMARY Paste is not hardcoded in Xorg/Xserver itself (after searching in sources for hour)

And here is likely the handling of middle button in QT:

qt/src/gui/text/qtextcontrol.cpp

void QTextControlPrivate::mouseReleaseEvent (...
...
} else if (button == Qt::MidButton
           && (interactionFlags & Qt::TextEditable)
           && QApplication::clipboard()->supportsSelection()) {
    setCursorPosition(pos);
    const QMimeData *md = QApplication::clipboard()->mimeData(QClipboard::Selection);
    if (md)
        q->insertFromMimeData(md);

Also here for lineedit: qt/src/gui/widgets/qlineedit.cpp

void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
...
    } else if (!d->readOnly && e->button() == Qt::MidButton) {
        d->deselect();
        insert(QApplication::clipboard()->text(QClipboard::Selection));

and may be here for qt3 compat layer: qt/src/qt3support/text/q3textedit.cpp

void Q3TextEdit::contentsMouseReleaseEvent(QMouseEvent * e)
...
else if (e->button() == Qt::MidButton && !isReadOnly()) {
    // only do middle-click pasting on systems that have selections (ie. X11)
    if (QApplication::clipboard()->supportsSelection()) {

So, you can download QT sources and comment this if branch to disable Midbutton action as paste.

After patching QT & GTK you should only compile them and install instead system's gtk and QT (or place in some dir e.g. /usr/local/lib and put this dir in /etc/ld.so.conf) earlier. Then every dynamically linked application will use patched gtk/QT lib and will not paste anything for middle button press.

If the application linked statically, you should recompile it with patched static library or to recompile it into dynamically linked.

If you need more graphic toolkits to be patched just say name of the toolkit and I will try to find source point of middle button handling as paste.

share|improve this answer
    
Unfortunately, this disables my ability to use the middle-mouse button (ie: clicking the scrollwheel) in things like Firefox to open a new tab with one click. –  user1022889 Nov 16 '11 at 21:52
    
@user1022889: stop using mouse! Setup nice keybindings, boosts your performance a lot! Plus, muscle memory doesn't need to synchronize with ice and position of the cursor on the screen that much, and move your hand to and from the mouse... Highly recommended! –  user3832 Nov 16 '11 at 23:20
1  
Vlad Lazarenko, this question about disabling middle button click-as-paste, and not about how to use keyboard and mouse. I'd just used PC w/o the mouse (no mouse at all) for a week and it was a bad experience. Just got new mouse from ebay and browsing is happy (without buggy Vimperatior) and Google Earth is "easy to draw any number of paths" now. –  osgx Nov 16 '11 at 23:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.