-
-
Save urbie-mk2/ae80fedbeded12084b7227b0ef53aeec to your computer and use it in GitHub Desktop.
diff -ru xf86-input-synaptics-1.8.99.1/src/synaptics.c xf86-input-synaptics-1.8.99.1-mod/src/synaptics.c | |
--- xf86-input-synaptics-1.8.99.1/src/synaptics.c 2015-11-25 07:28:43.000000000 +0100 | |
+++ xf86-input-synaptics-1.8.99.1-mod/src/synaptics.c 2016-06-15 14:54:09.961917509 +0200 | |
@@ -1190,7 +1190,8 @@ | |
{ | |
InputInfoPtr pInfo = dev->public.devicePrivate; | |
SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); | |
- | |
+ int i; | |
+ | |
if (!priv->has_touch) | |
return; | |
@@ -1204,8 +1205,23 @@ | |
priv->has_touch = 0; | |
priv->num_slots = 0; | |
} | |
+ | |
+ // x/y + whatever other MT axes we found | |
+ if (!InitTouchClassDeviceStruct(dev, priv->max_touches, | |
+ XIDependentTouch, | |
+ 2 + priv->num_mt_axes)) { | |
+ xf86IDrvMsg(pInfo, X_ERROR, | |
+ "failed to initialize touch class device\n"); | |
+ priv->has_touch = 0; | |
+ priv->num_slots = 0; | |
+ free(priv->open_slots); | |
+ priv->open_slots = NULL; | |
+ return; | |
+ } | |
+ | |
} | |
+ | |
static int | |
DeviceInit(DeviceIntPtr dev) | |
{ | |
@@ -2979,9 +2995,18 @@ | |
HandleTouches(InputInfoPtr pInfo, struct SynapticsHwState *hw) | |
{ | |
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; | |
+ SynapticsParameters *para = &priv->synpara; | |
int new_active_touches = priv->num_active_touches; | |
+ int min_touches = 2; | |
+ Bool restart_touches = FALSE; | |
int i; | |
+ if (para->click_action[F3_CLICK1] || para->tap_action[F3_TAP]) | |
+ min_touches = 4; | |
+ else if (para->click_action[F2_CLICK1] || para->tap_action[F2_TAP] || | |
+ para->scroll_twofinger_vert || para->scroll_twofinger_horiz) | |
+ min_touches = 3; | |
+ | |
/* Count new number of active touches */ | |
for (i = 0; i < hw->num_mt_mask; i++) { | |
if (hw->slot_state[i] == SLOTSTATE_OPEN) | |
@@ -2990,6 +3015,58 @@ | |
new_active_touches--; | |
} | |
+ if (priv->has_semi_mt) | |
+ goto out; | |
+ | |
+ if (priv->num_active_touches < min_touches && | |
+ new_active_touches < min_touches) { | |
+ /* We stayed below number of touches needed to send events */ | |
+ goto out; | |
+ } | |
+ else if (priv->num_active_touches >= min_touches && | |
+ new_active_touches < min_touches) { | |
+ /* We are transitioning to less than the number of touches needed to | |
+ * send events. End all currently open touches. */ | |
+ for (i = 0; i < priv->num_active_touches; i++) { | |
+ int slot = priv->open_slots[i]; | |
+ | |
+ xf86PostTouchEvent(pInfo->dev, slot, XI_TouchEnd, 0, | |
+ hw->mt_mask[slot]); | |
+ } | |
+ | |
+ /* Don't send any more events */ | |
+ goto out; | |
+ } | |
+ else if (priv->num_active_touches < min_touches && | |
+ new_active_touches >= min_touches) { | |
+ /* We are transitioning to more than the number of touches needed to | |
+ * send events. Begin all already open touches. */ | |
+ restart_touches = TRUE; | |
+ for (i = 0; i < priv->num_active_touches; i++) { | |
+ int slot = priv->open_slots[i]; | |
+ | |
+ xf86PostTouchEvent(pInfo->dev, slot, XI_TouchBegin, 0, | |
+ hw->mt_mask[slot]); | |
+ } | |
+ } | |
+ | |
+ /* Send touch begin events for all new touches */ | |
+ for (i = 0; i < hw->num_mt_mask; i++) | |
+ if (hw->slot_state[i] == SLOTSTATE_OPEN) | |
+ xf86PostTouchEvent(pInfo->dev, i, XI_TouchBegin, 0, hw->mt_mask[i]); | |
+ /* Send touch update/end events for all the rest */ | |
+ for (i = 0; i < priv->num_active_touches; i++) { | |
+ int slot = priv->open_slots[i]; | |
+ | |
+ /* Don't send update event if we just reopened the touch above */ | |
+ if (hw->slot_state[slot] == SLOTSTATE_UPDATE && !restart_touches) | |
+ xf86PostTouchEvent(pInfo->dev, slot, XI_TouchUpdate, 0, | |
+ hw->mt_mask[slot]); | |
+ else if (hw->slot_state[slot] == SLOTSTATE_CLOSE) | |
+ xf86PostTouchEvent(pInfo->dev, slot, XI_TouchEnd, 0, | |
+ hw->mt_mask[slot]); | |
+ } | |
+out: | |
UpdateTouchState(pInfo, hw); | |
} |
Hi and sorry the patch was garbage. I recreated it properly. Here are the commands you need to run:
git clone git://anongit.freedesktop.org/xorg/driver/xf86-input-synaptics
cd xf86-input-synaptics
git checkout xf86-input-synaptics-1.8.99.1
curl -OL https://gist.githubusercontent.com/dbruenig/ae80fedbeded12084b7227b0ef53aeec/raw/67d7bdc420b0236610ff51dd8e8e5a44b733ed0c/xf86-input-synaptics-1.8.99.1.xf86PostTouchEvent.patch
patch -p1 < xf86-input-synaptics-1.8.99.1.xf86PostTouchEvent.patch
./autogen.sh
./configure --prefix=/usr
make
sudo make install
sudo apt install autoconf xutils-dev xorg-dev libtool libevdev-dev
Or if you're having problems applying the patch, you may simply use the older version:
First, some dependencies:
sudo pacman -S autoconf xorg-server-devel xorg-util-macros
git clone git://anongit.freedesktop.org/xorg/driver/xf86-input-synaptics
cd xf86-input-synaptics
git checkout xf86-input-synaptics-1.8.3
./autogen.sh
./configure --prefix=/usr
make
sudo make install
On Arch Linux (probably others too in similar manner) you need to additionally cp /usr/share/X11/xorg.conf.d/50-synaptics.conf /etc/X11/xorg.conf.d/
.
I ran into an error using tsusanka's answer, when running "./autogen.sh" it turns out that it needed a package "xorg-macros". After a bit of digging around, I realized that I could use Menci's comment to install them (xutils-dev is the package, if I am not mistaken). In sum, run:
sudo apt install autoconf xutils-dev xorg-dev libtool libevdev-dev
and then:
git clone git://anongit.freedesktop.org/xorg/driver/xf86-input-synaptics
cd xf86-input-synaptics
git checkout xf86-input-synaptics-1.8.3
./autogen.sh
./configure --prefix=/usr
make
sudo make install
touchegg worked after restarting my computer. Enjoy!
@bndr32 is right you need some additional libraries to make it work, on Arch Linux it's (but you may need some more):
sudo pacman -S autoconf xorg-server-devel xorg-util-macros
I've also modified my previous post
curl -OL https://gist.githubusercontent.com/dbruenig/ae80fedbeded12084b7227b0ef53aeec/raw/67d7bdc420b0236610ff51dd8e8e5a44b733ed0c/xf86-input-synaptics-1.8.99.1.xf86PostTouchEvent.patch
link gives a 404
curl -OL https://gist.githubusercontent.com/dbruenig/ae80fedbeded12084b7227b0ef53aeec/raw/67d7bdc420b0236610ff51dd8e8e5a44b733ed0c/xf86-input-synaptics-1.8.99.1.xf86PostTouchEvent.patch
link gives a 404
write these commands instead;
git clone https://gist.github.com/ae80fedbeded12084b7227b0ef53aeec.git
mv ae80fedbeded12084b7227b0ef53aeec/xf86-input-synaptics-1.8.99.1.xf86PostTouchEvent.patch .
sudo rm -r ae80fedbeded12084b7227b0ef53aeec/
Hi, would you mind giving me some details on how to apply this patch? I can't seem to apply it properly to the synaptics driver source code and I'm truly missing using touchegg :(