Skip to content

Commit 4dfac39

Browse files
committed
core: generic: Remove touch rejection cone
It doesn't really work properly at the moment and it is questionably how much it would really help.
1 parent c0f1a19 commit 4dfac39

File tree

5 files changed

+0
-217
lines changed

5 files changed

+0
-217
lines changed

etc/iptsd.conf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
##
1515
# Disable = false
1616

17-
##
18-
## Mark contacts around the stylus as palms.
19-
##
20-
# CheckCone = true
21-
2217
##
2318
## Ignore all touch inputs if a palm was registered on the display.
2419
##
@@ -142,17 +137,6 @@
142137
##
143138
# TipDistance = 0
144139

145-
[Cone]
146-
##
147-
## The wideness of the cone in degrees.
148-
##
149-
# Angle = 30
150-
151-
##
152-
## How many centimeters a contact must be away from the stylus to not get blocked.
153-
##
154-
# Distance = 5
155-
156140
[DFT]
157141
# PositionMinAmp = 50
158142
# PositionMinMag = 2000

src/core/generic/application.hpp

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#ifndef IPTSD_CORE_GENERIC_APPLICATION_HPP
44
#define IPTSD_CORE_GENERIC_APPLICATION_HPP
55

6-
#include "cone.hpp"
76
#include "config.hpp"
87
#include "device.hpp"
98
#include "dft.hpp"
@@ -88,14 +87,6 @@ class Application {
8887
*/
8988
DftStylus m_dft;
9089

91-
/*
92-
* The touch rejection cone has its origin at the current coordinates of the
93-
* stylus. It is rotated in the direction of palm inputs, so that when
94-
* writing with the stylus, the hand holding it has less chance of accidentally
95-
* triggering any inputs.
96-
*/
97-
Cone m_cone;
98-
9990
public:
10091
Application(const Config &config,
10192
const DeviceInfo &info,
@@ -105,7 +96,6 @@ class Application {
10596
, m_metadata {metadata}
10697
, m_finder {config.contacts()}
10798
, m_dft {config, metadata}
108-
, m_cone {config.cone_angle, config.cone_distance}
10999
{
110100
if (m_config.width == 0 || m_config.height == 0)
111101
throw std::runtime_error("Invalid config: The screen size is 0!");
@@ -231,18 +221,13 @@ class Application {
231221
contact.orientation = 1.0 - contact.orientation;
232222
}
233223

234-
// Update touch rejection cone
235-
this->update_touch_cone();
236-
237224
// Hand off the found contacts to the handler code.
238225
this->on_contacts(m_contacts);
239226
}
240227

241228
/*!
242229
* Handles incoming IPTS stylus data.
243230
*
244-
* Position data from the stylus updates the position of the touch rejection cone.
245-
*
246231
* @param[in] data The data to process.
247232
*/
248233
void process_stylus(const ipts::StylusData &data)
@@ -254,13 +239,6 @@ class Application {
254239
corrected.x += off.x();
255240
corrected.y += off.y();
256241

257-
// Scale to physical coordinates
258-
const f64 x = corrected.x * m_config.width;
259-
const f64 y = corrected.y * m_config.height;
260-
261-
// Update rejection cone
262-
m_cone.update_position(x, y);
263-
264242
// Hand off the stylus data to the handler code.
265243
this->on_stylus(corrected);
266244
}
@@ -279,47 +257,6 @@ class Application {
279257
this->process_stylus(m_dft.get_stylus());
280258
}
281259

282-
/*!
283-
* Updates the palm rejection cone with the positions of all palms on the display.
284-
*
285-
* Then marks all contacts inside of the cone as palms.
286-
*/
287-
void update_touch_cone()
288-
{
289-
// The cone has never seen a position update, so its inactive
290-
if (!m_cone.alive())
291-
return;
292-
293-
if (!m_cone.active())
294-
return;
295-
296-
if (!m_config.touch_check_cone)
297-
return;
298-
299-
for (const contacts::Contact<f64> &contact : m_contacts) {
300-
if (contact.valid.value_or(true))
301-
continue;
302-
303-
// Scale to physical coordinates
304-
const f64 x = contact.mean.x() * m_config.width;
305-
const f64 y = contact.mean.y() * m_config.height;
306-
307-
m_cone.update_direction(x, y);
308-
}
309-
310-
// Mark all contacts inside of the cone as palms
311-
for (contacts::Contact<f64> &contact : m_contacts) {
312-
if (!contact.valid.value_or(true))
313-
continue;
314-
315-
// Scale to physical coordinates
316-
const f64 x = contact.mean.x() * m_config.width;
317-
const f64 y = contact.mean.y() * m_config.height;
318-
319-
contact.valid = m_cone.check(x, y);
320-
}
321-
}
322-
323260
/*!
324261
* Calculates the tilt-based offset of the stylus position.
325262
*

src/core/generic/cone.hpp

Lines changed: 0 additions & 129 deletions
This file was deleted.

src/core/generic/config.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Config {
2424

2525
// [Touch]
2626
bool touch_disable = false;
27-
bool touch_check_cone = true;
2827
bool touch_disable_on_palm = false;
2928
bool touch_disable_on_stylus = false;
3029
f64 touch_overshoot = 0.5;
@@ -49,10 +48,6 @@ class Config {
4948
bool stylus_disable = false;
5049
f64 stylus_tip_distance = 0;
5150

52-
// [Cone]
53-
f64 cone_angle = 30;
54-
f64 cone_distance = 5;
55-
5651
// [DFT]
5752
usize dft_position_min_amp = 50;
5853
usize dft_position_min_mag = 2000;

src/core/linux/config-loader.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ class ConfigLoader {
143143
this->get(ini, "Config", "Height", m_config.height);
144144

145145
this->get(ini, "Touch", "Disable", m_config.touch_disable);
146-
this->get(ini, "Touch", "CheckCone", m_config.touch_check_cone);
147146
this->get(ini, "Touch", "DisableOnPalm", m_config.touch_disable_on_palm);
148147
this->get(ini, "Touch", "DisableOnStylus", m_config.touch_disable_on_stylus);
149148
this->get(ini, "Touch", "Overshoot", m_config.touch_overshoot);
@@ -166,9 +165,6 @@ class ConfigLoader {
166165
this->get(ini, "Stylus", "Disable", m_config.stylus_disable);
167166
this->get(ini, "Stylus", "TipDistance", m_config.stylus_tip_distance);
168167

169-
this->get(ini, "Cone", "Angle", m_config.cone_angle);
170-
this->get(ini, "Cone", "Distance", m_config.cone_distance);
171-
172168
this->get(ini, "DFT", "PositionMinAmp", m_config.dft_position_min_amp);
173169
this->get(ini, "DFT", "PositionMinMag", m_config.dft_position_min_mag);
174170
this->get(ini, "DFT", "PositionExp", m_config.dft_position_exp);

0 commit comments

Comments
 (0)