|
10 | 10 | #include <contacts/contact.hpp>
|
11 | 11 | #include <core/generic/config.hpp>
|
12 | 12 | #include <core/generic/device.hpp>
|
| 13 | +#include <ipts/samples/button.hpp> |
13 | 14 |
|
14 | 15 | #include <gsl/gsl>
|
15 | 16 |
|
@@ -86,13 +87,15 @@ class TouchDevice {
|
86 | 87 | m_uinput->set_keybit(BTN_TOUCH);
|
87 | 88 |
|
88 | 89 | if (info.is_touchpad()) {
|
| 90 | + m_uinput->set_keybit(BTN_LEFT); |
89 | 91 | m_uinput->set_keybit(BTN_TOOL_FINGER);
|
90 | 92 | m_uinput->set_keybit(BTN_TOOL_DOUBLETAP);
|
91 | 93 | m_uinput->set_keybit(BTN_TOOL_TRIPLETAP);
|
92 | 94 | m_uinput->set_keybit(BTN_TOOL_QUADTAP);
|
93 | 95 | m_uinput->set_keybit(BTN_TOOL_QUINTTAP);
|
94 | 96 |
|
95 | 97 | m_uinput->set_propbit(INPUT_PROP_POINTER);
|
| 98 | + m_uinput->set_propbit(INPUT_PROP_BUTTONPAD); |
96 | 99 |
|
97 | 100 | m_overshoot = config.touchpad_overshoot;
|
98 | 101 | m_disable_on_palm = config.touchpad_disable_on_palm;
|
@@ -145,6 +148,21 @@ class TouchDevice {
|
145 | 148 | this->sync();
|
146 | 149 | }
|
147 | 150 |
|
| 151 | + /*! |
| 152 | + * Passes a sample of the touchpad button to the linux kernel. |
| 153 | + * |
| 154 | + * @param[in] button The state of the touchpad button (pressed / released). |
| 155 | + */ |
| 156 | + void update(const ipts::samples::Button &button) |
| 157 | + { |
| 158 | + // If the touch device is disabled ignore all inputs. |
| 159 | + if (!m_enabled) |
| 160 | + return; |
| 161 | + |
| 162 | + m_uinput->emit(EV_KEY, BTN_LEFT, button.active ? 1 : 0); |
| 163 | + this->sync(); |
| 164 | + } |
| 165 | + |
148 | 166 | /*!
|
149 | 167 | * Disables the touch device and lifts all contacts.
|
150 | 168 | */
|
@@ -400,6 +418,7 @@ class TouchDevice {
|
400 | 418 | m_uinput->emit(EV_KEY, BTN_TOUCH, 0);
|
401 | 419 |
|
402 | 420 | if (m_info.is_touchpad()) {
|
| 421 | + m_uinput->emit(EV_KEY, BTN_LEFT, 0); |
403 | 422 | m_uinput->emit(EV_KEY, BTN_TOOL_FINGER, 0);
|
404 | 423 | m_uinput->emit(EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
405 | 424 | m_uinput->emit(EV_KEY, BTN_TOOL_TRIPLETAP, 0);
|
|
0 commit comments