mgu*_*nes 22 multi-touch unity magic-trackpad gestures touchegg
我在带有 Magic Trackpad 的 Ubuntu 11.04 中使用自定义Touchégg多点触控手势设置。由于默认手势(例如 3 指点击并拖动以移动窗口,4 指点击以显示破折号等)显然是在 Unity 中硬编码的,因此我无法为它们分配任何自定义 Touchégg 操作,以及一些默认操作手势(我不打算使用太多,如果有的话)偶尔会与我类似的自定义分配的手势混淆并被意外触发。
有没有一种实用的方法(除了调整 uTouch 源之外)来禁用一些默认手势?如果没有,指向代码部分(也许在圣杯中?)的指针,其中定义了默认手势,并帮助调整也将不胜感激。
小智 16
Ubuntu 12.10 domster 答案的更新。
Unity 源代码明显改变了,所以这里是如何在 Unity 6.8.0 中实现相同的。下载Unity源代码的步骤和之前一样(我会复制粘贴domster的代码段):
sudo apt-get build-dep unity
cd /tmp #It can be done somewhere else, feel free to change the base location.
mkdir unity
cd unity
apt-get source unity
Run Code Online (Sandbox Code Playgroud)
此时,要编辑的文件只有/tmp/unity/unity-6.8.0/plugins/unityshell/src/unityshell.cpp
.
找到方法UnityScreen::InitGesturesSupport()
(Unity 6.8.0 的第 3368 行)。
然后,注释所有以gesture_sub_launcher 开头的行,使其看起来像:
void UnityScreen::InitGesturesSupport()
{
std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);
wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));
/*
gestures_sub_launcher_.reset(new nux::GesturesSubscription);
gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);
gestures_sub_launcher_->SetNumTouches(4);
gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());
gestures_sub_launcher_->Activate();
gestures_sub_dash_.reset(new nux::GesturesSubscription);
gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);
gestures_sub_dash_->SetNumTouches(4);
gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());
gestures_sub_dash_->Activate();
gestures_sub_windows_.reset(new nux::GesturesSubscription);
gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE
| nux::DRAG_GESTURE
| nux::PINCH_GESTURE);
gestures_sub_windows_->SetNumTouches(3);
gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());
gestures_sub_windows_->Activate();
*/
}
Run Code Online (Sandbox Code Playgroud)
再次按照 domster 的指示重新构建 Unity:
cd /tmp/unity/unity-6.8.0
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb
Run Code Online (Sandbox Code Playgroud)
等等!注销并重新登录。
dom*_*ter 11
事实证明,修补程序unity
包以完全禁用其对多点触控和手势的处理并不难。以下是修补的分步说明unity-4.24.0
。
在命令行中,输入:
sudo apt-get build-dep unity
cd /tmp #It can be done somewhere else, feel free to change the base location.
mkdir unity
cd unity
apt-get source unity
Run Code Online (Sandbox Code Playgroud)
此时,注释掉文件中的以下两行
/tmp/unity/unity-4.24.0/plugins/unityshell/src/unityshell.cpp
:
GeisAdapter::Default()->Run();
gestureEngine = new GestureEngine(screen);
Run Code Online (Sandbox Code Playgroud)
以及文件中的以下 4 行/tmp/unity/unity-4.24.0/plugins/unityshell/src/Launcher.cpp
:
GeisAdapter& adapter = *(GeisAdapter::Default());
adapter.drag_start.connect(sigc::mem_fun(this, &Launcher::OnDragStart));
adapter.drag_update.connect(sigc::mem_fun(this, &Launcher::OnDragUpdate));
adapter.drag_finish.connect(sigc::mem_fun(this, &Launcher::OnDragFinish));
Run Code Online (Sandbox Code Playgroud)
源代码在 中C++
,所以注释一行是通过在行首添加来完成的//
。例如,线
GeisAdapter::Default()->Run();
Run Code Online (Sandbox Code Playgroud)
变成
//GeisAdapter::Default()->Run(); .
Run Code Online (Sandbox Code Playgroud)
回到命令行,输入:
cd unity-4.24.0
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb
Run Code Online (Sandbox Code Playgroud)
等等!
现在,如果您注销并重新登录,手势应该正常工作。默认情况下,三次点击在我的系统上作为中间点击工作,不需要 touchegg。但是 touchegg 和 ginn 现在都可以很好地为您的应用程序定义自定义手势。
第二次尝试
\n\ndinegri建议“不要禁用三个手势,必须安装 ccsm,然后在此处禁用“Unit MT Grab Handles”也称为“Loves Handles ”。
\n\n但它还给我们留下了四个手指的手势。
\n\n第一次尝试
\n\nutouch 的配置文件是/etc/ginn/wishes.xml
. 因此,您可以编辑此文件并删除(或注释)您不想要的操作。然后 Touch\xc3\xa9gg 将完成其工作而不会发生冲突。
PS:我无法在这里重现您的问题来测试解决方案。我对此感到抱歉。
\n