How can I disable arbitrary default multitouch gestures in Unity?
An update to domster answer for Ubuntu 12.10.
Unity source code has obviously changed, so here is how to achieve the same in Unity 6.8.0. The steps to download Unity source code are the same as before (I will copy & paste domster's snippet):
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
At this point, the file to be edited is only /tmp/unity/unity-6.8.0/plugins/unityshell/src/unityshell.cpp
.
Find the method UnityScreen::InitGesturesSupport()
(line 3368 for Unity 6.8.0).
Then, comment all the lines starting with gesture_sub_launcher to make it look like:
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();
*/
}
Re-build Unity following domster's instructions again:
cd /tmp/unity/unity-6.8.0
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb
Et voila again! Logout and log back in.
It turns out that it is not that hard to patch the unity
package for totally disabling its handling of multi-touches and gestures. Here are step by step instructions for patching unity-4.24.0
.
In a command line, enter:
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
At this point, comment out the following 2 lines in the file
/tmp/unity/unity-4.24.0/plugins/unityshell/src/unityshell.cpp
:
GeisAdapter::Default()->Run();
gestureEngine = new GestureEngine(screen);
and the following 4 lines in the file /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));
The source code is in C++
, so commenting a line is done by adding //
at the beginning of the line. For instance, the line
GeisAdapter::Default()->Run();
becomes
//GeisAdapter::Default()->Run(); .
Back to the command line, enter:
cd unity-4.24.0
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb
Et voila!
Now if you logout and log back in, gestures should function normally. Triple tap works on my system as a middle click by default, without a need for touchegg. But both touchegg and ginn now work well to define custom gestures for your applications.