配置Trackpoint的中键滚轮功能

出自Linux Wiki

在2010年1月2日 (六) 00:25由Chenxing (讨论 | 贡献)所做的修订版本

本文介绍在多种Linux发行版中设置Trackpoint的方法。[1]

Trackpoint指的是Thinkpad笔记本上的指点杆(又常被称为红点)。

目录

系统设置

各发行版的设置方法稍有不同,下面分别介绍。

为避免出现意外,请先备份你的/etc/X11/xorg.conf
# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak.trackpoint

下面分别介绍不同发行版中的配置方法。

较新的发行版

Ubuntu 8.10、Fedora 10、Archlinux等较新的发行版中,键盘、鼠标不再由X服务器而是HAL管理[2]。但目前Debian、Mandriva等暂不在此列(请参见后面的设置方法)。

首先,创建文件/etc/hal/fdi/policy/mouse-wheel.fdi,内容为:

<?xml version="1.0" encoding="UTF-8"?>
<match key="info.product" string="TPPS/2 IBM TrackPoint">
 <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
 <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
 <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
 <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.ZAxsisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
</match>
Note.gif
注意:
2009年12月底的Archlinux中hal的设备名有变化,请将TPPS/2 IBM TrackPoint改为PS/2 Generic Mouse。如果不能名称,可使用lshal | grep input.product判断。

完成更改后,重新启动计算机(或重启hal服务,并注销、重新登录)。如果一切正常,现在你就可以使用“红点”了。

Note.gif
注意:
仅仅注销后重新登录不能使更改生效,请务必按上述介绍操作。

由于对应的新驱动(xserver-xorg-input-evdev)存在一些bug,完成上述配置后Ubuntu系统可能在一些情况下仍然无法使用滚轮,可以尝试自行编译打过补丁的驱动,步骤如下:

wget http://launchpadlibrarian.net/19254960/preinit.diff
sudo apt-get install build-essential
sudo apt-get build-dep xserver-xorg-input-evdev
apt-get source xserver-xorg-input-evdev
cd xserver-xorg-input-evdev-2.0.99+git20080912
patch -p1 < ../preinit.diff
./autogen --prefix=/usr
make
sudo make install

Debian Lenny/Sid或openSUSE

/etc/X11/xorg.conf中,找到Configured Mouse并将其所在的Section做如下修改:

Section "InputDevice"
   Identifier  "Configured Mouse"
   Driver      "mouse"
   Option      "CorePointer"
   Option      "Device"              "/dev/input/mice"
   Option      "Protocol"            "ExplorerPS/2"
   Option      "Emulate3Buttons"     "true"
   Option      "Emulate3TimeOut"     "50"
   Option      "EmulateWheel"        "on"
   Option      "EmulateWheelTimeOut" "200"
   Option      "EmulateWheelButton"  "2"
   Option      "YAxisMapping"        "4 5"
   Option      "XAxisMapping"        "6 7"
   Option      "ZAxisMapping"        "4 5"
EndSection

其它发行版

其它发行版,如Fedora 9及以前的版本,或其它在/etc/X11/xorg.conf中没有Configured Mouse小节的发行版中,修改的基本思路都是在/etc/X11/xorg.conf中有关鼠标一项如上设置即可,并注意更改ServerLayout部分(如果有的话)的设备名称。下面以Fedora 9为例介绍:

Fedora中,/etc/X11/xorg.conf中没有Configured Mouse一项,需要添加:

# ServerFlags一节对Fedora 9来说是必要的[3]
Section "ServerFlags"
       Option  "AutoAddDevices"        "false"
EndSection
Section "InputDevice"
      Identifier  "Configured Mouse"
      Driver      "mouse"
      Option      "CorePointer"
      Option      "Device"              "/dev/input/mice"
      Option      "Protocol"            "ExplorerPS/2"
      Option      "Emulate3Buttons"     "on"
      Option      "Emulate3TimeOut"     "50"
      Option      "EmulateWheel"        "on"
      Option      "EmulateWheelTimeOut" "200"
      Option      "EmulateWheelButton"  "2"
      Option      "YAxisMapping"        "4 5"
      Option      "XAxisMapping"        "6 7"
      Option      "ZAxisMapping"        "4 5"
EndSection

Section "InputDevice"
     Identifier	"Synaptics Touchpad"
     Driver		"synaptics"
     Option		"SendCoreEvents"	"true"
     Option		"Device"		"/dev/psaux"
     Option		"Protocol"		"auto-dev"
     Option		"HorizScrollDelta"	"0"
     Option		"SHMConfig"			"on"
EndSection
Section "ServerLayout"
中,去掉(如果有的话)
 InputDevice    "Synaptics" "CorePointer"

加入:

InputDevice    "Configured Mouse"
InputDevice	"Synaptics Touchpad"

配置完成,重新启动X就可以看到效果。

Firefox中水平滚动的配置

Firefox中垂直滚动是没有问题的,但是当试图水平滚动时可能执行的是前进、后退操作。如果要修正,请在地址栏中输入

about:config 

回车。更改下列设置:

mousewheel.horizscroll.withcontrolkey.action = 3;
mousewheel.horizscroll.withcontrolkey.numlines = 1; 
mousewheel.horizscroll.withcontrolkey.sysnumlines = true;

mousewheel.horizscroll.withnokey.action = 0;
mousewheel.horizscroll.withnokey.numlines = 1;
mousewheel.horizscroll.withnokey.sysnumlines = true;
 
mousewheel.horizscroll.withshiftkey.action = 1;
mousewheel.horizscroll.withshiftkey.numlines = 1;
mousewheel.horizscroll.withshiftkey.sysnumlines = true;

你也可以直接做如下更改(仅仅避免了由中键导致的前进、后退功能):

mousewheel.horizscroll.withnokey.action = 0;

Opera中滚动的设置

Opera在水平滚动时也可能发生“前进”、“后退”等操作,修正方法为:

菜单中:工具->首选项->高级->快捷键->鼠标设置->Opera Standard->编辑

在弹出的窗口中:

Application->Button6->删除->Button7->删除

确定后,选中Opera Standard(已修改),一路确定即可。

相关文章

Firefox、Opera中使用Thinkpad导航键

参考资料

  1. thinkwiki.org上对Trackpoint配置的介绍
  2. Scrolling with the Thinkpad's TrackPoint in Ubuntu 8.10 Intrepid
  3. Fedora9环境中的配置方法
个人工具
简体繁体转换