summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/generic/generic.pro2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp81
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp2
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.cpp6
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm11
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.h2
7 files changed, 49 insertions, 59 deletions
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
index f71a901341..02b3e96bfa 100644
--- a/src/plugins/bearer/generic/generic.pro
+++ b/src/plugins/bearer/generic/generic.pro
@@ -12,6 +12,8 @@ SOURCES += qgenericengine.cpp \
OTHER_FILES += generic.json
+win32:!winrt:LIBS += -lIphlpapi
+
PLUGIN_TYPE = bearer
PLUGIN_CLASS_NAME = QGenericEnginePlugin
load(qt_plugin)
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 059617b367..cd3b202001 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -54,7 +54,13 @@
#include <QtCore/private/qcoreapplication_p.h>
#if defined(Q_OS_WIN32)
+// PMIB_TCPTABLE2 is only available since Vista
+#if _WIN32_WINNT < 0x0600
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0600
+#endif // _WIN32_WINNT < 0x0600
#include "../platformdefs_win.h"
+#include <iphlpapi.h>
#endif
#ifdef Q_OS_WINRT
@@ -71,9 +77,10 @@ using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Collections;
using namespace ABI::Windows::Networking;
using namespace ABI::Windows::Networking::Connectivity;
+#endif // Q_OS_WINRT
+
// needed as interface is used as parameter name in qGetInterfaceType
#undef interface
-#endif // Q_OS_WINRT
#ifdef Q_OS_LINUX
#include <sys/socket.h>
@@ -89,62 +96,38 @@ QT_BEGIN_NAMESPACE
static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface)
{
#if defined(Q_OS_WIN32)
- DWORD bytesWritten;
- NDIS_MEDIUM medium;
- NDIS_PHYSICAL_MEDIUM physicalMedium;
-
- unsigned long oid;
- HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0,
- FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
- if (handle == INVALID_HANDLE_VALUE)
+ // QNetworkInterface::name returns a more friendly name on Windows. That name is not
+ // accepted as an identifier for CreateFile so we have to obtain the Luid.
+ std::wstring buf = interface.toStdWString();
+ if (buf.size() == 0)
return QNetworkConfiguration::BearerUnknown;
- bytesWritten = 0;
-
- oid = OID_GEN_MEDIA_SUPPORTED;
- bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
- &medium, sizeof(medium), &bytesWritten, 0);
- if (!result) {
- CloseHandle(handle);
+ NET_LUID luid;
+ NETIO_STATUS status = ConvertInterfaceNameToLuidW(buf.c_str(), &luid);
+ if (status != NO_ERROR)
return QNetworkConfiguration::BearerUnknown;
- }
-
- bytesWritten = 0;
- oid = OID_GEN_PHYSICAL_MEDIUM;
- result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
- &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0);
-
- if (!result) {
- CloseHandle(handle);
-
- if (medium == NdisMedium802_3)
- return QNetworkConfiguration::BearerEthernet;
- else
- return QNetworkConfiguration::BearerUnknown;
- }
-
- CloseHandle(handle);
-
- if (medium == NdisMedium802_3) {
- switch (physicalMedium) {
- case NdisPhysicalMediumWirelessLan:
- return QNetworkConfiguration::BearerWLAN;
- case NdisPhysicalMediumBluetooth:
- return QNetworkConfiguration::BearerBluetooth;
- case NdisPhysicalMediumWiMax:
- return QNetworkConfiguration::BearerWiMAX;
- default:
+ switch (luid.Info.IfType) {
+ case IF_TYPE_ETHERNET_CSMACD:
+ case IF_TYPE_ISO88025_TOKENRING:
+ case IF_TYPE_PPP:
+ case IF_TYPE_SOFTWARE_LOOPBACK:
+ return QNetworkConfiguration::BearerEthernet;
+ case IF_TYPE_IEEE80211:
+ return QNetworkConfiguration::BearerWLAN;
+ case IF_TYPE_ATM:
+ case IF_TYPE_IEEE1394:
+ case IF_TYPE_OTHER:
+ case IF_TYPE_TUNNEL:
+ return QNetworkConfiguration::BearerUnknown;
+ default:
#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Physical Medium" << physicalMedium;
+ qDebug() << "Interface Type" << luid.Info.IfType;
#endif
- return QNetworkConfiguration::BearerEthernet;
- }
+ return QNetworkConfiguration::BearerUnknown;
}
+ return QNetworkConfiguration::BearerUnknown;
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << medium << physicalMedium;
-#endif
#elif defined(Q_OS_LINUX)
int sock = socket(AF_INET, SOCK_DGRAM, 0);
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index 26b88d6d78..eb646644ec 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -488,7 +488,7 @@ void QTuioHandler::process2DObjSet(const QOscMessage &message)
return;
}
- qCDebug(lcTuioSet) << "Processing SET for token " << classId << id << " @ " << x << y << "∡" << angle <<
+ qCDebug(lcTuioSet) << "Processing SET for token " << classId << id << " @ " << x << y << " angle: " << angle <<
"vel" << vx << vy << angularVelocity << "acc" << acceleration << angularAcceleration;
QTuioToken &tok = *it;
tok.setClassId(classId);
diff --git a/src/plugins/platforms/android/qandroideventdispatcher.cpp b/src/plugins/platforms/android/qandroideventdispatcher.cpp
index 104e905b8f..e12551283f 100644
--- a/src/plugins/platforms/android/qandroideventdispatcher.cpp
+++ b/src/plugins/platforms/android/qandroideventdispatcher.cpp
@@ -108,10 +108,9 @@ QAndroidEventDispatcherStopper *QAndroidEventDispatcherStopper::instance()
void QAndroidEventDispatcherStopper::startAll()
{
QMutexLocker lock(&m_mutex);
- if (started)
+ if (!m_started.testAndSetOrdered(0, 1))
return;
- started = true;
for (QAndroidEventDispatcher *d : qAsConst(m_dispatchers))
d->start();
}
@@ -119,10 +118,9 @@ void QAndroidEventDispatcherStopper::startAll()
void QAndroidEventDispatcherStopper::stopAll()
{
QMutexLocker lock(&m_mutex);
- if (!started)
+ if (!m_started.testAndSetOrdered(1, 0))
return;
- started = false;
for (QAndroidEventDispatcher *d : qAsConst(m_dispatchers))
d->stop();
}
diff --git a/src/plugins/platforms/android/qandroideventdispatcher.h b/src/plugins/platforms/android/qandroideventdispatcher.h
index 057a1660c9..e6f903bced 100644
--- a/src/plugins/platforms/android/qandroideventdispatcher.h
+++ b/src/plugins/platforms/android/qandroideventdispatcher.h
@@ -68,7 +68,7 @@ class QAndroidEventDispatcherStopper
{
public:
static QAndroidEventDispatcherStopper *instance();
- static bool stopped() {return !instance()->started; }
+ static bool stopped() {return !instance()->m_started.load(); }
void startAll();
void stopAll();
void addEventDispatcher(QAndroidEventDispatcher *dispatcher);
@@ -77,7 +77,7 @@ public:
private:
QMutex m_mutex;
- bool started = true;
+ QAtomicInt m_started = 1;
QVector<QAndroidEventDispatcher *> m_dispatchers;
};
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index e743dd56bf..6001a845e8 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -235,9 +235,16 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
if (!iface || !iface->isValid())
return nil;
+ // macOS expects that the hierarchy is:
+ // App -> Window -> Children
+ // We don't actually have the window reflected properly in QAccessibility.
+ // Check if the parent is the application and then instead return the native window.
+
if (QAccessibleInterface *parent = iface->parent()) {
- QAccessible::Id parentId = QAccessible::uniqueId(parent);
- return [QMacAccessibilityElement elementWithId: parentId];
+ if (parent->role() != QAccessible::Application) {
+ QAccessible::Id parentId = QAccessible::uniqueId(parent);
+ return [QMacAccessibilityElement elementWithId: parentId];
+ }
}
if (QWindow *window = iface->window()) {
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.h b/src/plugins/platformthemes/gtk3/qgtk3menu.h
index ad108f1218..21e6178ec4 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3menu.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.h
@@ -55,7 +55,7 @@ public:
GtkWidget *create();
GtkWidget *handle() const;
- quintptr tag() const;
+ quintptr tag() const override;
void setTag(quintptr tag) override;
QString text() const;