From 9ba7cc07dbef542bc73f97f1d7458699d25fbb8d Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 6 Mar 2014 11:10:44 +0100 Subject: Tslib plugin: also apply missing release coordinate code to non-raw mode Even if the normal mode is used the release events may have zero coordinates. Change-Id: I2eac8cf50dfcf9e62d8cec2423419a6579266849 Reviewed-by: Laszlo Agocs Reviewed-by: Friedemann Kleint --- src/plugins/generic/tslib/qtslib.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/plugins/generic') diff --git a/src/plugins/generic/tslib/qtslib.cpp b/src/plugins/generic/tslib/qtslib.cpp index 9905d9cc9e..0dcf5bc6ca 100644 --- a/src/plugins/generic/tslib/qtslib.cpp +++ b/src/plugins/generic/tslib/qtslib.cpp @@ -110,12 +110,17 @@ static bool get_sample(struct tsdev *dev, struct ts_sample *sample, bool rawMode void QTsLibMouseHandler::readMouseData() { ts_sample sample; - while (get_sample(m_dev, &sample, m_rawMode)) { + while (get_sample(m_dev, &sample, m_rawMode)) { bool pressed = sample.pressure; int x = sample.x; int y = sample.y; + // work around missing coordinates on mouse release + if (sample.pressure == 0 && sample.x == 0 && sample.y == 0) { + x = m_x; + y = m_y; + } if (!m_rawMode) { //filtering: ignore movements of 2 pixels or less @@ -123,12 +128,6 @@ void QTsLibMouseHandler::readMouseData() int dy = y - m_y; if (dx*dx <= 4 && dy*dy <= 4 && pressed == m_pressed) continue; - } else { - // work around missing coordinates on mouse release in raw mode - if (sample.pressure == 0 && sample.x == 0 && sample.y == 0) { - x = m_x; - y = m_y; - } } QPoint pos(x, y); -- cgit v1.2.3