summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-02-11 15:12:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-11 15:12:00 +0100
commitdf62c31807f7b0a8b9bc222b47ccc7016cfaee65 (patch)
treea7df6263cdb4cc96e2d31486437ec19ca0bf01e5 /src/platformsupport
parent17de86f2824c1807c0fa7fa7ae0ed3b7d2acca00 (diff)
parenta1fe728fa5bd6cb9e50cf317a58efcf4eea4de2c (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_static.cpp28
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch.cpp112
-rw-r--r--src/platformsupport/linuxaccessibility/constant_mappings.cpp27
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp10
4 files changed, 111 insertions, 66 deletions
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
index a333d2c0c7..cbcc0ff5b1 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
@@ -102,23 +102,27 @@ QDeviceDiscovery::~QDeviceDiscovery()
QStringList QDeviceDiscovery::scanConnectedDevices()
{
QStringList devices;
-
- // check for input devices
- QDir dir(QString::fromLatin1(QT_EVDEV_DEVICE_PATH));
+ QDir dir;
dir.setFilter(QDir::System);
- foreach (const QString &deviceFile, dir.entryList()) {
- QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
- if (checkDeviceType(absoluteFilePath))
- devices << absoluteFilePath;
+ // check for input devices
+ if (m_types & Device_InputMask) {
+ dir.setPath(QString::fromLatin1(QT_EVDEV_DEVICE_PATH));
+ foreach (const QString &deviceFile, dir.entryList()) {
+ QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
+ if (checkDeviceType(absoluteFilePath))
+ devices << absoluteFilePath;
+ }
}
// check for drm devices
- dir.setPath(QString::fromLatin1(QT_DRM_DEVICE_PATH));
- foreach (const QString &deviceFile, dir.entryList()) {
- QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
- if (checkDeviceType(absoluteFilePath))
- devices << absoluteFilePath;
+ if (m_types & Device_VideoMask) {
+ dir.setPath(QString::fromLatin1(QT_DRM_DEVICE_PATH));
+ foreach (const QString &deviceFile, dir.entryList()) {
+ QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
+ if (checkDeviceType(absoluteFilePath))
+ devices << absoluteFilePath;
+ }
}
#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
index d9468ae1b8..563edf4fd7 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
@@ -157,10 +157,12 @@ void QEvdevTouchScreenData::registerDevice()
#define LONG_BITS (sizeof(long) << 3)
#define NUM_LONGS(bits) (((bits) + LONG_BITS - 1) / LONG_BITS)
+#if defined(QT_NO_MTDEV)
static inline bool testBit(long bit, const long *array)
{
return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1;
}
+#endif
QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QObject *parent)
: QObject(parent), m_notify(0), m_fd(-1), d(0)
@@ -345,40 +347,61 @@ QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
void QEvdevTouchScreenHandler::readData()
{
::input_event buffer[32];
- int n = 0;
- for (; ;) {
+ int events = 0;
+
#if !defined(QT_NO_MTDEV)
- int result = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event));
- if (result > 0)
- result *= sizeof(::input_event);
+ forever {
+ do {
+ events = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event));
+ // keep trying mtdev_get if we get interrupted. note that we do not
+ // (and should not) handle EAGAIN; EAGAIN means that reading would
+ // block and we'll get back here later to try again anyway.
+ } while (events == -1 && errno == EINTR);
+
+ // 0 events is EOF, -1 means error, handle both in the same place
+ if (events <= 0)
+ goto err;
+
+ // process our shiny new events
+ for (int i = 0; i < events; ++i)
+ d->processInputEvent(&buffer[i]);
+
+ // and try to get more
+ }
#else
- int result = QT_READ(m_fd, reinterpret_cast<char*>(buffer) + n, sizeof(buffer) - n);
-#endif
- if (!result) {
- qWarning("evdevtouch: Got EOF from input device");
- return;
- } else if (result < 0) {
- if (errno != EINTR && errno != EAGAIN) {
- qErrnoWarning(errno, "evdevtouch: Could not read from input device");
- if (errno == ENODEV) { // device got disconnected -> stop reading
- delete m_notify;
- m_notify = 0;
- QT_CLOSE(m_fd);
- m_fd = -1;
- }
- return;
- }
- } else {
- n += result;
- if (n % sizeof(::input_event) == 0)
- break;
- }
+ int n = 0;
+ for (; ;) {
+ events = QT_READ(m_fd, reinterpret_cast<char*>(buffer) + n, sizeof(buffer) - n);
+ if (events <= 0)
+ goto err;
+ n += events;
+ if (n % sizeof(::input_event) == 0)
+ break;
}
n /= sizeof(::input_event);
for (int i = 0; i < n; ++i)
d->processInputEvent(&buffer[i]);
+#endif
+ return;
+
+err:
+ if (!events) {
+ qWarning("evdevtouch: Got EOF from input device");
+ return;
+ } else if (events < 0) {
+ if (errno != EINTR && errno != EAGAIN) {
+ qErrnoWarning(errno, "evdevtouch: Could not read from input device");
+ if (errno == ENODEV) { // device got disconnected -> stop reading
+ delete m_notify;
+ m_notify = 0;
+ QT_CLOSE(m_fd);
+ m_fd = -1;
+ }
+ return;
+ }
+ }
}
void QEvdevTouchScreenData::addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates)
@@ -412,19 +435,31 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
if (data->code == ABS_MT_POSITION_X || (m_singleTouch && data->code == ABS_X)) {
m_currentData.x = qBound(hw_range_x_min, data->value, hw_range_x_max);
- if (m_typeB || m_singleTouch)
+ if (m_singleTouch)
+ m_contacts[m_currentSlot].x = m_currentData.x;
+ if (m_typeB) {
m_contacts[m_currentSlot].x = m_currentData.x;
+ if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
+ m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
+ }
} else if (data->code == ABS_MT_POSITION_Y || (m_singleTouch && data->code == ABS_Y)) {
m_currentData.y = qBound(hw_range_y_min, data->value, hw_range_y_max);
- if (m_typeB || m_singleTouch)
+ if (m_singleTouch)
m_contacts[m_currentSlot].y = m_currentData.y;
+ if (m_typeB) {
+ m_contacts[m_currentSlot].y = m_currentData.y;
+ if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
+ m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
+ }
} else if (data->code == ABS_MT_TRACKING_ID) {
m_currentData.trackingId = data->value;
if (m_typeB) {
- if (m_currentData.trackingId == -1)
+ if (m_currentData.trackingId == -1) {
m_contacts[m_currentSlot].state = Qt::TouchPointReleased;
- else
+ } else {
+ m_contacts[m_currentSlot].state = Qt::TouchPointPressed;
m_contacts[m_currentSlot].trackingId = m_currentData.trackingId;
+ }
}
} else if (data->code == ABS_MT_TOUCH_MAJOR) {
m_currentData.maj = data->value;
@@ -468,8 +503,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
it.next();
Contact &contact(it.value());
+ if (!contact.state)
+ continue;
+
int key = m_typeB ? it.key() : contact.trackingId;
- if (m_lastContacts.contains(key)) {
+ if (!m_typeB && m_lastContacts.contains(key)) {
const Contact &prev(m_lastContacts.value(key));
if (contact.state == Qt::TouchPointReleased) {
// Copy over the previous values for released points, just in case.
@@ -483,7 +521,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
}
// Avoid reporting a contact in released state more than once.
- if (contact.state == Qt::TouchPointReleased
+ if (!m_typeB && contact.state == Qt::TouchPointReleased
&& !m_lastContacts.contains(key)) {
it.remove();
continue;
@@ -509,8 +547,14 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
while (it.hasNext()) {
it.next();
Contact &contact(it.value());
- if (contact.state == Qt::TouchPointReleased)
- it.remove();
+ if (contact.state == Qt::TouchPointReleased) {
+ if (m_typeB)
+ contact.state = static_cast<Qt::TouchPointState>(0);
+ else
+ it.remove();
+ } else {
+ contact.state = Qt::TouchPointStationary;
+ }
}
m_lastContacts = m_contacts;
diff --git a/src/platformsupport/linuxaccessibility/constant_mappings.cpp b/src/platformsupport/linuxaccessibility/constant_mappings.cpp
index 3524fca052..f8bfaf4753 100644
--- a/src/platformsupport/linuxaccessibility/constant_mappings.cpp
+++ b/src/platformsupport/linuxaccessibility/constant_mappings.cpp
@@ -61,17 +61,12 @@ quint64 spiStatesFromQState(QAccessible::State state)
{
quint64 spiState = 0;
- setSpiStateBit(&spiState, ATSPI_STATE_EDITABLE);
- setSpiStateBit(&spiState, ATSPI_STATE_ENABLED);
- setSpiStateBit(&spiState, ATSPI_STATE_SHOWING);
- setSpiStateBit(&spiState, ATSPI_STATE_VISIBLE);
- setSpiStateBit(&spiState, ATSPI_STATE_SENSITIVE);
-
- if (state.disabled) {
- unsetSpiStateBit(&spiState, ATSPI_STATE_ENABLED);
- unsetSpiStateBit(&spiState, ATSPI_STATE_SENSITIVE);
+ if (state.editable)
+ setSpiStateBit(&spiState, ATSPI_STATE_EDITABLE);
+ if (!state.disabled) {
+ setSpiStateBit(&spiState, ATSPI_STATE_ENABLED);
+ setSpiStateBit(&spiState, ATSPI_STATE_SENSITIVE);
}
-
if (state.selected)
setSpiStateBit(&spiState, ATSPI_STATE_SELECTED);
if (state.focused)
@@ -95,9 +90,9 @@ quint64 spiStatesFromQState(QAccessible::State state)
setSpiStateBit(&spiState, ATSPI_STATE_BUSY);
if (state.marqueed || state.animated)
setSpiStateBit(&spiState, ATSPI_STATE_ANIMATED);
- if (state.invisible || state.offscreen) {
- unsetSpiStateBit(&spiState, ATSPI_STATE_SHOWING);
- unsetSpiStateBit(&spiState, ATSPI_STATE_VISIBLE);
+ if (!state.invisible && !state.offscreen) {
+ setSpiStateBit(&spiState, ATSPI_STATE_SHOWING);
+ setSpiStateBit(&spiState, ATSPI_STATE_VISIBLE);
}
if (state.sizeable)
setSpiStateBit(&spiState, ATSPI_STATE_RESIZABLE);
@@ -118,10 +113,8 @@ quint64 spiStatesFromQState(QAccessible::State state)
// if (state.HasPopup)
if (state.modal)
setSpiStateBit(&spiState, ATSPI_STATE_MODAL);
-
- // Not implemented in Qt
- // if (state.singleLine)
- // setSpiStateBit(&spiState, ATSPI_STATE_SINGLE_LINE);
+ if (state.multiLine)
+ setSpiStateBit(&spiState, ATSPI_STATE_MULTI_LINE);
return spiState;
}
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 42b3d64a47..c72815ca1b 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -318,19 +318,23 @@ void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalet
const QBrush buttonBrushDark = QBrush(button.darker(v > 128 ? 200 : 50));
const QBrush buttonBrushDark150 = QBrush(button.darker(v > 128 ? 150 : 75));
const QBrush buttonBrushLight150 = QBrush(button.lighter(v > 128 ? 150 : 75));
+ const QBrush buttonBrushLight = QBrush(button.lighter(v > 128 ? 200 : 50));
pal->setBrush(QPalette::Disabled, QPalette::WindowText, buttonBrushDark);
pal->setBrush(QPalette::Disabled, QPalette::ButtonText, buttonBrushDark);
pal->setBrush(QPalette::Disabled, QPalette::Button, buttonBrush);
- pal->setBrush(QPalette::Disabled, QPalette::Light, buttonBrushLight150);
- pal->setBrush(QPalette::Disabled, QPalette::Dark, buttonBrushDark);
- pal->setBrush(QPalette::Disabled, QPalette::Mid, buttonBrushDark150);
pal->setBrush(QPalette::Disabled, QPalette::Text, buttonBrushDark);
pal->setBrush(QPalette::Disabled, QPalette::BrightText, whiteBrush);
pal->setBrush(QPalette::Disabled, QPalette::Base, buttonBrush);
pal->setBrush(QPalette::Disabled, QPalette::Window, buttonBrush);
pal->setBrush(QPalette::Disabled, QPalette::Highlight, buttonBrushDark150);
pal->setBrush(QPalette::Disabled, QPalette::HighlightedText, buttonBrushLight150);
+
+ // set calculated colors for all groups
+ pal->setBrush(QPalette::Light, buttonBrushLight);
+ pal->setBrush(QPalette::Midlight, buttonBrushLight150);
+ pal->setBrush(QPalette::Mid, buttonBrushDark150);
+ pal->setBrush(QPalette::Dark, buttonBrushDark);
}
/*!