summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/android/.prev_CMakeLists.txt6
-rw-r--r--src/plugins/platforms/android/CMakeLists.txt6
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.cpp85
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.h15
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp6
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp7
-rw-r--r--src/plugins/platforms/android/androidjnimain.h4
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp6
-rw-r--r--src/plugins/platforms/android/extract-dummy.cpp6
-rw-r--r--src/plugins/platforms/android/extract.cpp10
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.h2
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp8
-rw-r--r--src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp4
-rw-r--r--src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp21
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.h14
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenu.h1
-rw-r--r--src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp29
-rw-r--r--src/plugins/platforms/android/qandroidplatformoffscreensurface.h15
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp4
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbscreen.cpp1
-rw-r--r--src/plugins/platforms/cocoa/.prev_CMakeLists.txt10
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h18
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm303
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm30
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm21
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm12
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm58
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm11
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm18
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.mm44
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm57
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.h2
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm6
-rw-r--r--src/plugins/platforms/cocoa/qnsview_drawing.mm62
-rw-r--r--src/plugins/platforms/cocoa/qnsview_keys.mm39
-rw-r--r--src/plugins/platforms/direct2d/CMakeLists.txt283
-rw-r--r--src/plugins/platforms/directfb/.prev_CMakeLists.txt6
-rw-r--r--src/plugins/platforms/directfb/CMakeLists.txt6
-rw-r--r--src/plugins/platforms/directfb/main.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfb_egl.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.cpp8
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.h4
-rw-r--r--src/plugins/platforms/eglfs/.prev_CMakeLists.txt14
-rw-r--r--src/plugins/platforms/eglfs/CMakeLists.txt31
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration_p.h4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen_p.h2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp16
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt32
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt7
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt28
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt9
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp14
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h1
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt27
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt29
-rw-r--r--src/plugins/platforms/integrity/qintegrityhidmanager.h2
-rw-r--r--src/plugins/platforms/ios/.prev_CMakeLists.txt4
-rw-r--r--src/plugins/platforms/ios/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt8
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm2
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm6
-rw-r--r--src/plugins/platforms/ios/qiosclipboard.mm4
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.h6
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm5
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm2
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.h10
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm4
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm12
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm12
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm2
-rw-r--r--src/plugins/platforms/ios/quiview.mm2
-rw-r--r--src/plugins/platforms/linuxfb/.prev_CMakeLists.txt4
-rw-r--r--src/plugins/platforms/linuxfb/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h2
-rw-r--r--src/plugins/platforms/minimal/.prev_CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimal/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimalegl/.prev_CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimalegl/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/offscreen/.prev_CMakeLists.txt4
-rw-r--r--src/plugins/platforms/offscreen/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/offscreen/main.cpp3
-rw-r--r--src/plugins/platforms/offscreen/offscreen.pro1
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp11
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.h13
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.cpp129
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.h6
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp6
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration_x11.h2
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenwindow.cpp16
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenwindow.h3
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractnavigator.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxbuffer.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxbuffer.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxclipboard.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxglcontext.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp22
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp73
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.h1
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp6
-rw-r--r--src/plugins/platforms/vnc/.prev_CMakeLists.txt2
-rw-r--r--src/plugins/platforms/vnc/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp7
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp6
-rw-r--r--src/plugins/platforms/wasm/qwasmeventdispatcher.cpp4
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.cpp23
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.h1
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp14
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp65
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.h3
-rw-r--r--src/plugins/platforms/wasm/qwasmtheme.cpp2
-rw-r--r--src/plugins/platforms/wasm/wasm_shell.html9
-rw-r--r--src/plugins/platforms/windows/.prev_CMakeLists.txt26
-rw-r--r--src/plugins/platforms/windows/CMakeLists.txt32
-rw-r--r--src/plugins/platforms/windows/main.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsapplication.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsapplication.h6
-rw-r--r--src/plugins/platforms/windows/qwindowscombase.h7
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp24
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp27
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.h10
-rw-r--r--src/plugins/platforms/windows/qwindowsdropdataobject.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h5
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.cpp9
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.h2
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp58
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowsole.h30
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.cpp82
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.h9
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp36
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp289
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.h47
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h9
-rw-r--r--src/plugins/platforms/xcb/.prev_CMakeLists.txt25
-rw-r--r--src/plugins/platforms/xcb/CMakeLists.txt28
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h2
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp6
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp16
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp10
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qt_x11_p.h2
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qtessellator.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp13
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_basic.cpp14
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_basic.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_screens.cpp17
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp124
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp27
-rw-r--r--src/plugins/platforms/xcb/qxcbeventdispatcher.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbeventdispatcher.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp50
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h9
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp41
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h3
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro2
205 files changed, 1954 insertions, 1431 deletions
diff --git a/src/plugins/platforms/CMakeLists.txt b/src/plugins/platforms/CMakeLists.txt
index 47b8099332..bb246565b9 100644
--- a/src/plugins/platforms/CMakeLists.txt
+++ b/src/plugins/platforms/CMakeLists.txt
@@ -22,7 +22,7 @@ if(WIN32)
add_subdirectory(windows)
endif()
if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite)
- # add_subdirectory(direct2d) # special case TODO
+ add_subdirectory(direct2d)
endif()
if(QNX)
# add_subdirectory(qnx) # special case TODO
diff --git a/src/plugins/platforms/android/.prev_CMakeLists.txt b/src/plugins/platforms/android/.prev_CMakeLists.txt
index 5b2dada653..7345de1f81 100644
--- a/src/plugins/platforms/android/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/android/.prev_CMakeLists.txt
@@ -60,17 +60,17 @@ qt_internal_add_plugin(QAndroidIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
SOURCES
extract.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
SOURCES
extract-dummy.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qandroidplatformvulkaninstance.cpp qandroidplatformvulkaninstance.h
qandroidplatformvulkanwindow.cpp qandroidplatformvulkanwindow.h
diff --git a/src/plugins/platforms/android/CMakeLists.txt b/src/plugins/platforms/android/CMakeLists.txt
index 7fcd42a9bb..2e323325b0 100644
--- a/src/plugins/platforms/android/CMakeLists.txt
+++ b/src/plugins/platforms/android/CMakeLists.txt
@@ -63,17 +63,17 @@ qt_internal_add_plugin(QAndroidIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
SOURCES
extract.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
SOURCES
extract-dummy.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qandroidplatformvulkaninstance.cpp qandroidplatformvulkaninstance.h
qandroidplatformvulkanwindow.cpp qandroidplatformvulkanwindow.h
diff --git a/src/plugins/platforms/android/androidcontentfileengine.cpp b/src/plugins/platforms/android/androidcontentfileengine.cpp
index 3e3bdc2592..bdbf2186ba 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.cpp
+++ b/src/plugins/platforms/android/androidcontentfileengine.cpp
@@ -65,7 +65,7 @@ bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
openModeStr += QLatin1Char('a');
}
- const auto fd = QJNIObjectPrivate::callStaticMethod<jint>("org/qtproject/qt5/android/QtNative",
+ const auto fd = QJNIObjectPrivate::callStaticMethod<jint>("org/qtproject/qt/android/QtNative",
"openFdForContentUrl",
"(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)I",
QtAndroidPrivate::context(),
@@ -82,7 +82,7 @@ bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
qint64 AndroidContentFileEngine::size() const
{
const jlong size = QJNIObjectPrivate::callStaticMethod<jlong>(
- "org/qtproject/qt5/android/QtNative", "getSize",
+ "org/qtproject/qt/android/QtNative", "getSize",
"(Landroid/content/Context;Ljava/lang/String;)J", QtAndroidPrivate::context(),
QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
return (qint64)size;
@@ -92,13 +92,21 @@ AndroidContentFileEngine::FileFlags AndroidContentFileEngine::fileFlags(FileFlag
{
FileFlags commonFlags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag);
FileFlags flags;
- const bool exists = QJNIObjectPrivate::callStaticMethod<jboolean>(
- "org/qtproject/qt5/android/QtNative", "checkFileExists",
+ const bool isDir = QJNIObjectPrivate::callStaticMethod<jboolean>(
+ "org/qtproject/qt/android/QtNative", "checkIfDir",
"(Landroid/content/Context;Ljava/lang/String;)Z", QtAndroidPrivate::context(),
QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
- if (!exists)
+ // If it is a directory then we know it exists so there is no reason to explicitly check
+ const bool exists = isDir ? true : QJNIObjectPrivate::callStaticMethod<jboolean>(
+ "org/qtproject/qt/android/QtNative", "checkFileExists",
+ "(Landroid/content/Context;Ljava/lang/String;)Z", QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
+ if (!exists && !isDir)
return flags;
- flags = FileType | commonFlags;
+ if (isDir)
+ flags = DirectoryType | commonFlags;
+ else
+ flags = FileType | commonFlags;
return type & flags;
}
@@ -122,6 +130,16 @@ QString AndroidContentFileEngine::fileName(FileName f) const
}
}
+QAbstractFileEngine::Iterator *AndroidContentFileEngine::beginEntryList(QDir::Filters filters, const QStringList &filterNames)
+{
+ return new AndroidContentFileEngineIterator(filters, filterNames);
+}
+
+QAbstractFileEngine::Iterator *AndroidContentFileEngine::endEntryList()
+{
+ return nullptr;
+}
+
AndroidContentFileEngineHandler::AndroidContentFileEngineHandler() = default;
AndroidContentFileEngineHandler::~AndroidContentFileEngineHandler() = default;
@@ -133,3 +151,58 @@ QAbstractFileEngine* AndroidContentFileEngineHandler::create(const QString &file
return new AndroidContentFileEngine(fileName);
}
+
+AndroidContentFileEngineIterator::AndroidContentFileEngineIterator(QDir::Filters filters,
+ const QStringList &filterNames)
+ : QAbstractFileEngineIterator(filters, filterNames)
+{
+}
+
+AndroidContentFileEngineIterator::~AndroidContentFileEngineIterator()
+{
+}
+
+QString AndroidContentFileEngineIterator::next()
+{
+ if (!hasNext())
+ return QString();
+ ++m_index;
+ return currentFilePath();
+}
+
+bool AndroidContentFileEngineIterator::hasNext() const
+{
+ if (m_index == -1) {
+ if (path().isEmpty())
+ return false;
+ const bool isDir = QJNIObjectPrivate::callStaticMethod<jboolean>(
+ "org/qtproject/qt/android/QtNative", "checkIfDir",
+ "(Landroid/content/Context;Ljava/lang/String;)Z",
+ QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(path()).object());
+ if (isDir) {
+ QJNIObjectPrivate objArray = QJNIObjectPrivate::callStaticObjectMethod("org/qtproject/qt/android/QtNative",
+ "listContentsFromTreeUri",
+ "(Landroid/content/Context;Ljava/lang/String;)[Ljava/lang/String;",
+ QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(path()).object());
+ if (objArray.isValid()) {
+ QJNIEnvironmentPrivate env;
+ const jsize length = env->GetArrayLength(static_cast<jarray>(objArray.object()));
+ for (int i = 0; i != length; ++i) {
+ m_entries << QJNIObjectPrivate(env->GetObjectArrayElement(
+ static_cast<jobjectArray>(objArray.object()), i)).toString();
+ }
+ }
+ }
+ m_index = 0;
+ }
+ return m_index < m_entries.size();
+}
+
+QString AndroidContentFileEngineIterator::currentFileName() const
+{
+ if (m_index <= 0 || m_index > m_entries.size())
+ return QString();
+ return m_entries.at(m_index - 1);
+}
diff --git a/src/plugins/platforms/android/androidcontentfileengine.h b/src/plugins/platforms/android/androidcontentfileengine.h
index 09e5d77553..31eaf9b0ab 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.h
+++ b/src/plugins/platforms/android/androidcontentfileengine.h
@@ -50,6 +50,8 @@ public:
qint64 size() const override;
FileFlags fileFlags(FileFlags type = FileInfoAll) const override;
QString fileName(FileName file = DefaultName) const override;
+ QAbstractFileEngine::Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override;
+ QAbstractFileEngine::Iterator *endEntryList() override;
private:
QString m_file;
@@ -63,4 +65,17 @@ public:
QAbstractFileEngine *create(const QString &fileName) const override;
};
+class AndroidContentFileEngineIterator : public QAbstractFileEngineIterator
+{
+public:
+ AndroidContentFileEngineIterator(QDir::Filters filters, const QStringList &filterNames);
+ ~AndroidContentFileEngineIterator();
+ QString next() override;
+ bool hasNext() const override;
+ QString currentFileName() const override;
+private:
+ mutable QStringList m_entries;
+ mutable int m_index = -1;
+};
+
#endif // ANDROIDCONTENTFILEENGINE_H
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index a27c200362..8d9a968b4f 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -98,7 +98,7 @@ namespace QtAndroidAccessibility
QAccessibleInterface *interfaceFromId(jint objectId)
{
- QAccessibleInterface *iface = 0;
+ QAccessibleInterface *iface = nullptr;
if (objectId == -1) {
QWindow *win = qApp->focusWindow();
if (win)
@@ -164,7 +164,7 @@ namespace QtAndroidAccessibility
QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window());
QAccessibleInterface *child = root->childAt(pos.x(), pos.y());
- QAccessibleInterface *lastChild = 0;
+ QAccessibleInterface *lastChild = nullptr;
while (child && (child != lastChild)) {
lastChild = child;
child = child->childAt(pos.x(), pos.y());
@@ -318,7 +318,7 @@ if (!clazz) { \
bool registerNatives(JNIEnv *env)
{
jclass clazz;
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/accessibility/QtNativeAccessibility");
+ FIND_AND_CHECK_CLASS("org/qtproject/qt/android/accessibility/QtNativeAccessibility");
jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 3f41ead818..9e2cb228b3 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -92,8 +92,6 @@ static jmethodID m_createBitmapMethodID = nullptr;
static jobject m_ARGB_8888_BitmapConfigValue = nullptr;
static jobject m_RGB_565_BitmapConfigValue = nullptr;
-static bool m_statusBarShowing = true;
-
static jclass m_bitmapDrawableClass = nullptr;
static jmethodID m_bitmapDrawableConstructorMethodID = nullptr;
@@ -456,7 +454,8 @@ static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring pa
QByteArray string = nativeString;
env->ReleaseStringUTFChars(paramsString, nativeString);
- m_applicationParams=string.split('\t');
+ for (auto str : string.split('\t'))
+ m_applicationParams.append(str.split(' '));
// Go home
QDir::setCurrent(QDir::homePath());
@@ -807,7 +806,7 @@ if (!VAR) { \
static int registerNatives(JNIEnv *env)
{
jclass clazz;
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNative");
+ FIND_AND_CHECK_CLASS("org/qtproject/qt/android/QtNative");
m_applicationClass = static_cast<jclass>(env->NewGlobalRef(clazz));
if (env->RegisterNatives(m_applicationClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index 63be5910f9..6902f89341 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -96,9 +96,9 @@ namespace QtAndroid
};
void setSystemUiVisibility(SystemUiVisibility uiVisibility);
- jobject createBitmap(QImage img, JNIEnv *env = 0);
+ jobject createBitmap(QImage img, JNIEnv *env = nullptr);
jobject createBitmap(int width, int height, QImage::Format format, JNIEnv *env);
- jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = 0);
+ jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = nullptr);
const char *classErrorMsgFmt();
const char *methodErrorMsgFmt();
diff --git a/src/plugins/platforms/android/androidjnimenu.cpp b/src/plugins/platforms/android/androidjnimenu.cpp
index de2fdaa0e2..fe5de1f882 100644
--- a/src/plugins/platforms/android/androidjnimenu.cpp
+++ b/src/plugins/platforms/android/androidjnimenu.cpp
@@ -59,12 +59,12 @@ using namespace QtAndroid;
namespace QtAndroidMenu
{
static QList<QAndroidPlatformMenu *> pendingContextMenus;
- static QAndroidPlatformMenu *visibleMenu = 0;
+ static QAndroidPlatformMenu *visibleMenu = nullptr;
static QRecursiveMutex visibleMenuMutex;
static QSet<QAndroidPlatformMenuBar *> menuBars;
- static QAndroidPlatformMenuBar *visibleMenuBar = 0;
- static QWindow *activeTopLevelWindow = 0;
+ static QAndroidPlatformMenuBar *visibleMenuBar = nullptr;
+ static QWindow *activeTopLevelWindow = nullptr;
static QRecursiveMutex menuBarMutex;
static jmethodID openContextMenuMethodID = 0;
diff --git a/src/plugins/platforms/android/extract-dummy.cpp b/src/plugins/platforms/android/extract-dummy.cpp
index fdce8ec64c..bfc0dafd04 100644
--- a/src/plugins/platforms/android/extract-dummy.cpp
+++ b/src/plugins/platforms/android/extract-dummy.cpp
@@ -40,12 +40,14 @@
#include <jni.h>
#include <extract.h>
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *, jobject, long)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *, jobject, long)
{
return 0;
}
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo20(JNIEnv *, jobject, jbyteArray)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractChunkInfo20(JNIEnv *, jobject, jbyteArray)
{
return 0;
}
diff --git a/src/plugins/platforms/android/extract.cpp b/src/plugins/platforms/android/extract.cpp
index acffa353f1..c68dae31e9 100644
--- a/src/plugins/platforms/android/extract.cpp
+++ b/src/plugins/platforms/android/extract.cpp
@@ -91,7 +91,8 @@ Res_png_9patch* Res_png_9patch::deserialize(const void* inData)
return (Res_png_9patch*) inData;
}
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv * env, jobject, long addr)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *env, jobject, long addr)
{
Res_png_9patch20* chunk = reinterpret_cast<Res_png_9patch20*>(addr);
Res_png_9patch20::deserialize(chunk);
@@ -123,7 +124,9 @@ extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractSty
return result;
}
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo20(JNIEnv * env, jobject obj, jbyteArray chunkObj)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractChunkInfo20(JNIEnv *env, jobject obj,
+ jbyteArray chunkObj)
{
size_t chunkSize = env->GetArrayLength(chunkObj);
void* storage = alloca(chunkSize);
@@ -131,7 +134,8 @@ extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractSty
reinterpret_cast<jbyte*>(storage));
if (!env->ExceptionCheck())
- return Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(env, obj, long(storage));
+ return Java_org_qtproject_qt_android_ExtractStyle_extractNativeChunkInfo20(env, obj,
+ long(storage));
else
env->ExceptionClear();
return 0;
diff --git a/src/plugins/platforms/android/qandroideventdispatcher.h b/src/plugins/platforms/android/qandroideventdispatcher.h
index 85d4cee6cb..8a29ed7e7e 100644
--- a/src/plugins/platforms/android/qandroideventdispatcher.h
+++ b/src/plugins/platforms/android/qandroideventdispatcher.h
@@ -48,7 +48,7 @@ class QAndroidEventDispatcher : public QUnixEventDispatcherQPA
{
Q_OBJECT
public:
- explicit QAndroidEventDispatcher(QObject *parent = 0);
+ explicit QAndroidEventDispatcher(QObject *parent = nullptr);
~QAndroidEventDispatcher();
void start();
void stop();
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 84745f3f28..fc71b391c0 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -91,9 +91,9 @@ private:
} // namespace anonymous
-static QAndroidInputContext *m_androidInputContext = 0;
-static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt5/android/QtNativeInputConnection";
-static char const *const QtExtractedTextClassName = "org/qtproject/qt5/android/QtExtractedText";
+static QAndroidInputContext *m_androidInputContext = nullptr;
+static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt/android/QtNativeInputConnection";
+static char const *const QtExtractedTextClassName = "org/qtproject/qt/android/QtExtractedText";
static jclass m_extractedTextClass = 0;
static jmethodID m_classConstructorMethodID = 0;
static jfieldID m_partialEndOffsetFieldID = 0;
@@ -392,7 +392,7 @@ static JNINativeMethod methods[] = {
{"deleteSurroundingText", "(II)Z", (void *)deleteSurroundingText},
{"finishComposingText", "()Z", (void *)finishComposingText},
{"getCursorCapsMode", "(I)I", (void *)getCursorCapsMode},
- {"getExtractedText", "(III)Lorg/qtproject/qt5/android/QtExtractedText;", (void *)getExtractedText},
+ {"getExtractedText", "(III)Lorg/qtproject/qt/android/QtExtractedText;", (void *)getExtractedText},
{"getSelectedText", "(I)Ljava/lang/String;", (void *)getSelectedText},
{"getTextAfterCursor", "(II)Ljava/lang/String;", (void *)getTextAfterCursor},
{"getTextBeforeCursor", "(II)Ljava/lang/String;", (void *)getTextBeforeCursor},
diff --git a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
index 0297734bc8..9ce63dceec 100644
--- a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
+++ b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
namespace QtAndroidDialogHelpers {
static jclass g_messageDialogHelperClass = 0;
-static const char QtMessageHandlerHelperClassName[] = "org/qtproject/qt5/android/QtMessageDialogHelper";
+static const char QtMessageHandlerHelperClassName[] = "org/qtproject/qt/android/QtMessageDialogHelper";
QAndroidPlatformMessageDialogHelper::QAndroidPlatformMessageDialogHelper()
:m_buttonId(-1)
@@ -190,7 +190,7 @@ bool registerNatives(JNIEnv *env)
return false;
}
g_messageDialogHelperClass = static_cast<jclass>(env->NewGlobalRef(clazz));
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNativeDialogHelper");
+ FIND_AND_CHECK_CLASS("org/qtproject/qt/android/QtNativeDialogHelper");
jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
diff --git a/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp b/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp
index 1b48769385..acfa4542a1 100644
--- a/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp
+++ b/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp
@@ -176,7 +176,7 @@ void QAndroidPlatformFileDialogHelper::setMimeTypes()
JniIntentClass, "EXTRA_MIME_TYPES", "Ljava/lang/String;");
QJNIObjectPrivate mimeTypesArray = QJNIObjectPrivate::callStaticObjectMethod(
- "org/qtproject/qt5/android/QtNative",
+ "org/qtproject/qt/android/QtNative",
"getStringArray",
"(Ljava/lang/String;)[Ljava/lang/String;",
QJNIObjectPrivate::fromString(mimeTypes.join(",")).object());
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 372b32746d..8048bd6cff 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -44,6 +44,7 @@
#include <QGuiApplication>
#include <QOpenGLContext>
#include <QOffscreenSurface>
+#include <QtGui/private/qoffscreensurface_p.h>
#include <QThread>
#include <QtGui/private/qeglpbuffer_p.h>
@@ -68,6 +69,8 @@
#include "qandroidsystemlocale.h"
#include "qandroidplatformoffscreensurface.h"
+#include <jni.h>
+
#if QT_CONFIG(vulkan)
#include "qandroidplatformvulkanwindow.h"
#include "qandroidplatformvulkaninstance.h"
@@ -322,16 +325,20 @@ QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenS
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
- if (surface->nativeHandle()) {
- // Adopt existing offscreen Surface
- // The expectation is that nativeHandle is an ANativeWindow* representing
- // an android.view.Surface
- return new QAndroidPlatformOffscreenSurface(m_eglDisplay, format, surface);
- }
-
return new QEGLPbuffer(m_eglDisplay, format, surface);
}
+QOffscreenSurface *QAndroidPlatformIntegration::createOffscreenSurface(ANativeWindow *nativeSurface) const
+{
+ if (!QtAndroid::activity() || !nativeSurface)
+ return nullptr;
+
+ auto *surface = new QOffscreenSurface;
+ auto *surfacePrivate = QOffscreenSurfacePrivate::get(surface);
+ surfacePrivate->platformOffscreenSurface = new QAndroidPlatformOffscreenSurface(nativeSurface, m_eglDisplay, surface);
+ return surface;
+}
+
QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
{
if (!QtAndroid::activity())
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h
index 30ab42ab34..d579bc29ae 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/qandroidplatformintegration.h
@@ -40,19 +40,17 @@
#ifndef QANDROIDPLATFORMINTERATION_H
#define QANDROIDPLATFORMINTERATION_H
-#include <QtGui/qtguiglobal.h>
+#include "qandroidinputcontext.h"
+#include "qandroidplatformscreen.h"
+#include <QtGui/qtguiglobal.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformmenu.h>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformopenglcontext.h>
+#include <qpa/qplatformoffscreensurface.h>
#include <EGL/egl.h>
-#include <jni.h>
-#include "qandroidinputcontext.h"
-
-#include "qandroidplatformscreen.h"
-
#include <memory>
QT_BEGIN_NAMESPACE
@@ -74,7 +72,8 @@ protected:
};
class QAndroidPlatformIntegration : public QPlatformIntegration
- , QPlatformInterface::Private::QEGLIntegration
+ , QNativeInterface::Private::QEGLIntegration
+ , QNativeInterface::Private::QAndroidOffScreenIntegration
{
friend class QAndroidPlatformScreen;
@@ -94,6 +93,7 @@ public:
QAbstractEventDispatcher *createEventDispatcher() const override;
QAndroidPlatformScreen *screen() { return m_primaryScreen; }
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
+ QOffscreenSurface *createOffscreenSurface(ANativeWindow *nativeSurface) const override;
void setAvailableGeometry(const QRect &availableGeometry);
void setPhysicalSize(int width, int height);
diff --git a/src/plugins/platforms/android/qandroidplatformmenu.h b/src/plugins/platforms/android/qandroidplatformmenu.h
index b8334ff970..e745360122 100644
--- a/src/plugins/platforms/android/qandroidplatformmenu.h
+++ b/src/plugins/platforms/android/qandroidplatformmenu.h
@@ -40,6 +40,7 @@
#ifndef QANDROIDPLATFORMMENU_H
#define QANDROIDPLATFORMMENU_H
+#include <qhash.h>
#include <qpa/qplatformmenu.h>
#include <qlist.h>
#include <qmutex.h>
diff --git a/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp b/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp
index f9589cea1a..9255ef4446 100644
--- a/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp
+++ b/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,28 +39,23 @@
#include "qandroidplatformoffscreensurface.h"
-#include <QtGui/QOffscreenSurface>
#include <QtGui/private/qeglconvenience_p.h>
-#include <android/native_window.h>
-
QT_BEGIN_NAMESPACE
-QAndroidPlatformOffscreenSurface::QAndroidPlatformOffscreenSurface(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface)
- : QPlatformOffscreenSurface(offscreenSurface)
- , m_format(format)
- , m_display(display)
- , m_surface(EGL_NO_SURFACE)
+QAndroidPlatformOffscreenSurface::QAndroidPlatformOffscreenSurface(
+ ANativeWindow *nativeSurface, EGLDisplay display, QOffscreenSurface *offscreenSurface)
+ : QPlatformOffscreenSurface(offscreenSurface), m_display(display), m_surface(EGL_NO_SURFACE)
{
- // Get native handle
- ANativeWindow *surfaceTexture = (ANativeWindow*)offscreenSurface->nativeHandle();
+ // FIXME: Read surface format properties from native surface using ANativeWindow_getFormat
+ m_format.setAlphaBufferSize(8);
+ m_format.setRedBufferSize(8);
+ m_format.setGreenBufferSize(8);
+ m_format.setBlueBufferSize(8);
- EGLConfig config = q_configFromGLFormat(m_display, m_format, false);
- if (config) {
- const EGLint attributes[] = {
- EGL_NONE
- };
- m_surface = eglCreateWindowSurface(m_display, config, surfaceTexture, attributes);
+ if (EGLConfig config = q_configFromGLFormat(m_display, m_format, false)) {
+ const EGLint attributes[] = { EGL_NONE };
+ m_surface = eglCreateWindowSurface(m_display, config, nativeSurface, attributes);
}
}
diff --git a/src/plugins/platforms/android/qandroidplatformoffscreensurface.h b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h
index 033bc6a03f..e57ab2afad 100644
--- a/src/plugins/platforms/android/qandroidplatformoffscreensurface.h
+++ b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -41,21 +41,26 @@
#define QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H
#include <qpa/qplatformoffscreensurface.h>
-#include <QtGui/private/qeglplatformcontext_p.h>
+#include <QtGui/qoffscreensurface_platform.h>
+
+#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
class QOffscreenSurface;
-class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface
+class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface,
+ public QNativeInterface::QAndroidOffscreenSurface
{
public:
- QAndroidPlatformOffscreenSurface(EGLDisplay display, const QSurfaceFormat &format,
- QOffscreenSurface *offscreenSurface);
+ QAndroidPlatformOffscreenSurface(ANativeWindow *nativeSurface, EGLDisplay display, QOffscreenSurface *offscreenSurface);
~QAndroidPlatformOffscreenSurface();
QSurfaceFormat format() const override { return m_format; }
bool isValid() const override { return m_surface != EGL_NO_SURFACE; }
EGLSurface surface() const { return m_surface; }
+
+ ANativeWindow *nativeSurface() const override { return (ANativeWindow *)surface(); };
+
private:
QSurfaceFormat m_format;
EGLDisplay m_display;
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
index 330330a638..c51fbaf1d3 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
@@ -76,9 +76,8 @@ EGLSurface QAndroidPlatformOpenGLContext::eglSurfaceForPlatformSurface(QPlatform
if (surface->surface()->surfaceClass() == QSurface::Window) {
return static_cast<QAndroidPlatformOpenGLWindow *>(surface)->eglSurface(eglConfig());
} else {
- auto platformOffscreenSurface = static_cast<QPlatformOffscreenSurface*>(surface);
- if (platformOffscreenSurface->offscreenSurface()->nativeHandle())
- return static_cast<QAndroidPlatformOffscreenSurface *>(surface)->surface();
+ if (auto *platformOffscreenSurface = dynamic_cast<QAndroidPlatformOffscreenSurface *>(surface))
+ return platformOffscreenSurface->surface();
else
return static_cast<QEGLPbuffer *>(surface)->pbuffer();
}
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index d3a8a53241..30a967cc26 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -304,7 +304,7 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
attributeIterator = item.find(QLatin1String("defaultBackgroundColor"));
if (attributeIterator != item.constEnd())
- palette.setColor(QPalette::Background, QRgb(int(attributeIterator.value().toDouble())));
+ palette.setColor(QPalette::Window, QRgb(int(attributeIterator.value().toDouble())));
attributeIterator = item.find(QLatin1String("TextAppearance_textColor"));
if (attributeIterator != item.constEnd())
@@ -464,7 +464,7 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
&& m_androidStyleData) {
return QStringList(QLatin1String("android"));
}
- return QStringList(QLatin1String("fusion"));
+ return QStringList(QLatin1String("Fusion"));
case DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::AndroidLayout);
case MouseDoubleClickDistance:
diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
index d752b539a0..10d45dd0e9 100644
--- a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
+++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
@@ -41,6 +41,7 @@
#include "qbsdfbscreen.h"
#include <QtFbSupport/private/qfbcursor_p.h>
#include <QtFbSupport/private/qfbwindow_p.h>
+#include <QtCore/QFile>
#include <QtCore/QRegularExpression>
#include <QtGui/QPainter>
diff --git a/src/plugins/platforms/cocoa/.prev_CMakeLists.txt b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
index ee40e32033..d42cf811d5 100644
--- a/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
@@ -67,7 +67,7 @@ set(qcocoaresources_resource_files
"images/waitcursor.png"
)
-qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
+qt_internal_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
PREFIX
"/qt-project.org/mac/cursors"
FILES
@@ -81,23 +81,23 @@ qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
## Scopes:
#####################################################################
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qcocoaglcontext.h qcocoaglcontext.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qcocoavulkaninstance.h qcocoavulkaninstance.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
qcocoaaccessibility.h qcocoaaccessibility.mm
qcocoaaccessibilityelement.h qcocoaaccessibilityelement.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qcocoasessionmanager.cpp qcocoasessionmanager.h
)
diff --git a/src/plugins/platforms/cocoa/CMakeLists.txt b/src/plugins/platforms/cocoa/CMakeLists.txt
index 51d7038950..d9832c2c6c 100644
--- a/src/plugins/platforms/cocoa/CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/CMakeLists.txt
@@ -77,7 +77,7 @@ set(qcocoaresources_resource_files
"images/waitcursor.png"
)
-qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
+qt_internal_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
PREFIX
"/qt-project.org/mac/cursors"
FILES
@@ -91,23 +91,23 @@ qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
## Scopes:
#####################################################################
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qcocoaglcontext.h qcocoaglcontext.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qcocoavulkaninstance.h qcocoavulkaninstance.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
qcocoaaccessibility.h qcocoaaccessibility.mm
qcocoaaccessibilityelement.h qcocoaaccessibilityelement.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qcocoasessionmanager.cpp qcocoasessionmanager.h
)
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 62f2cc30e0..e6e46cda81 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -92,10 +92,6 @@
#include <qpa/qwindowsysteminterface.h>
#include <qwindowdefs.h>
-QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(lcQpaApplication, "qt.qpa.application");
-QT_END_NAMESPACE
-
QT_USE_NAMESPACE
@implementation QCocoaApplicationDelegate {
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index c29ab2d8f8..b96bb1e3dc 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -58,21 +58,6 @@ protected:
QCFType<CGColorSpaceRef> colorSpace() const;
};
-class QNSWindowBackingStore : public QCocoaBackingStore
-{
-public:
- QNSWindowBackingStore(QWindow *window);
- ~QNSWindowBackingStore();
-
- void resize(const QSize &size, const QRegion &staticContents) override;
- void flush(QWindow *, const QRegion &, const QPoint &) override;
-
-private:
- bool windowHasUnifiedToolbar() const;
- QImage::Format format() const override;
- void redrawRoundedBottomCorners(CGRect) const;
-};
-
class QCALayerBackingStore : public QObject, public QCocoaBackingStore
{
Q_OBJECT
@@ -96,6 +81,9 @@ public:
QPlatformGraphicsBuffer *graphicsBuffer() const override;
private:
+ void observeBackingPropertiesChanges();
+ bool eventFilter(QObject *watched, QEvent *event) override;
+
QSize m_requestedSize;
QRegion m_paintedRegion;
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 26cab9aa58..01787da1af 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -64,297 +64,43 @@ QCFType<CGColorSpaceRef> QCocoaBackingStore::colorSpace() const
// ----------------------------------------------------------------------------
-QNSWindowBackingStore::QNSWindowBackingStore(QWindow *window)
+QCALayerBackingStore::QCALayerBackingStore(QWindow *window)
: QCocoaBackingStore(window)
{
- // Choose an appropriate window depth based on the requested surface format.
- // On deep color displays the default bit depth is 16-bit, so unless we need
- // that level of precision we opt out of it (and the expensive RGB32 -> RGB64
- // conversions that come with it if our backingstore depth does not match).
-
- NSWindow *nsWindow = static_cast<QCocoaWindow *>(window->handle())->view().window;
- auto colorSpaceName = NSColorSpaceFromDepth(nsWindow.depthLimit);
-
- static const int kDefaultBitDepth = 8;
- auto surfaceFormat = window->requestedFormat();
- auto bitsPerSample = qMax(kDefaultBitDepth, qMax(surfaceFormat.redBufferSize(),
- qMax(surfaceFormat.greenBufferSize(), surfaceFormat.blueBufferSize())));
-
- // NSBestDepth does not seem to guarantee a window depth deep enough for the
- // given bits per sample, even if documented as such. For example, requesting
- // 10 bits per sample will not give us a 16-bit format, even if that's what's
- // available. Work around this by manually bumping the bit depth.
- bitsPerSample = !(bitsPerSample & (bitsPerSample - 1))
- ? bitsPerSample : qNextPowerOfTwo(bitsPerSample);
-
- auto bestDepth = NSBestDepth(colorSpaceName, bitsPerSample, 0, NO, nullptr);
-
- // Disable dynamic depth limit, otherwise our depth limit will be overwritten
- // by AppKit if the window moves to a screen with a different depth. We call
- // this before setting the depth limit, as the call will reset the depth to 0.
- [nsWindow setDynamicDepthLimit:NO];
-
- qCDebug(lcQpaBackingStore) << "Using" << NSBitsPerSampleFromDepth(bestDepth)
- << "bit window depth for" << nsWindow;
+ qCDebug(lcQpaBackingStore) << "Creating QCALayerBackingStore for" << window;
+ m_buffers.resize(1);
- nsWindow.depthLimit = bestDepth;
+ observeBackingPropertiesChanges();
+ window->installEventFilter(this);
}
-QNSWindowBackingStore::~QNSWindowBackingStore()
+QCALayerBackingStore::~QCALayerBackingStore()
{
}
-bool QNSWindowBackingStore::windowHasUnifiedToolbar() const
+void QCALayerBackingStore::observeBackingPropertiesChanges()
{
Q_ASSERT(window()->handle());
- return static_cast<QCocoaWindow *>(window()->handle())->m_drawContentBorderGradient;
-}
-
-QImage::Format QNSWindowBackingStore::format() const
-{
- if (windowHasUnifiedToolbar())
- return QImage::Format_ARGB32_Premultiplied;
-
- return QRasterBackingStore::format();
-}
-
-void QNSWindowBackingStore::resize(const QSize &size, const QRegion &staticContents)
-{
- qCDebug(lcQpaBackingStore) << "Resize requested to" << size;
- QRasterBackingStore::resize(size, staticContents);
-
- // The window shadow rendered by AppKit is based on the shape/content of the
- // NSWindow surface. Technically any flush of the backingstore can result in
- // a potentially new shape of the window, and would need a shadow invalidation,
- // but this is likely too expensive to do at every flush for the few cases where
- // clients change the shape dynamically. One case where we do know that the shadow
- // likely needs invalidation, if the window has partially transparent content,
- // is after a resize, where AppKit's default shadow may be based on the previous
- // window content.
- QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
- if (cocoaWindow->isContentView() && !cocoaWindow->isOpaque())
- cocoaWindow->m_needsInvalidateShadow = true;
-}
-
-/*!
- Flushes the given \a region from the specified \a window onto the
- screen.
-
- The \a window is the top level window represented by this backingstore,
- or a non-transient child of that window.
-
- If the \a window is a child window, the \a region will be in child window
- coordinates, and the \a offset will be the child window's offset in relation
- to the backingstore's top level window.
-*/
-void QNSWindowBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
-{
- if (m_image.isNull())
- return;
-
- // Use local pool so that any stale image references are cleaned up after flushing
- QMacAutoReleasePool pool;
-
- const QWindow *topLevelWindow = this->window();
-
- Q_ASSERT(topLevelWindow->handle() && window->handle());
- Q_ASSERT(!topLevelWindow->handle()->isForeignWindow() && !window->handle()->isForeignWindow());
-
- QNSView *topLevelView = qnsview_cast(static_cast<QCocoaWindow *>(topLevelWindow->handle())->view());
- QNSView *view = qnsview_cast(static_cast<QCocoaWindow *>(window->handle())->view());
-
- if (lcQpaBackingStore().isDebugEnabled()) {
- QString targetViewDescription;
- if (view != topLevelView) {
- QDebug targetDebug(&targetViewDescription);
- targetDebug << "onto" << topLevelView << "at" << offset;
- }
- qCDebug(lcQpaBackingStore) << "Flushing" << region << "of" << view << qPrintable(targetViewDescription);
- }
-
- // Normally a NSView is drawn via drawRect, as part of the display cycle in the
- // main runloop, via setNeedsDisplay and friends. AppKit will lock focus on each
- // individual view, starting with the top level and then traversing any subviews,
- // calling drawRect for each of them. This pull model results in expose events
- // sent to Qt, which result in drawing to the backingstore and flushing it.
- // Qt may also decide to paint and flush the backingstore via e.g. timers,
- // or other events such as mouse events, in which case we're in a push model.
- // If there is no focused view, it means we're in the latter case, and need
- // to manually flush the NSWindow after drawing to its graphic context.
- const bool drawingOutsideOfDisplayCycle = ![NSView focusView];
-
- // We also need to ensure the flushed view has focus, so that the graphics
- // context is set up correctly (coordinate system, clipping, etc). Outside
- // of the normal display cycle there is no focused view, as explained above,
- // so we have to handle it manually. There's also a corner case inside the
- // normal display cycle due to way QWidgetRepaintManager composits native child
- // widgets, where we'll get a flush of a native child during the drawRect of
- // its parent/ancestor, and the parent/ancestor being the one locked by AppKit.
- // In this case we also need to lock and unlock focus manually.
- const bool shouldHandleViewLockManually = [NSView focusView] != view;
- if (shouldHandleViewLockManually && !QT_IGNORE_DEPRECATIONS([view lockFocusIfCanDraw])) {
- qWarning() << "failed to lock focus of" << view;
- return;
- }
-
- const qreal devicePixelRatio = m_image.devicePixelRatio();
-
- // If the flushed window is a content view, and we're filling the drawn area
- // completely, or it doesn't have a window background we need to preserve,
- // we can get away with copying instead of blending the backing store.
- QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
- const NSCompositingOperation compositingOperation = cocoaWindow->isContentView()
- && (cocoaWindow->isOpaque() || view.window.backgroundColor == NSColor.clearColor)
- ? NSCompositingOperationCopy : NSCompositingOperationSourceOver;
-
-#ifdef QT_DEBUG
- static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults]
- boolForKey:@"QtCocoaDebugBackingStoreFlush"];
-#endif
-
- // -------------------------------------------------------------------------
-
- // The current contexts is typically a NSWindowGraphicsContext, but can be
- // NSBitmapGraphicsContext e.g. when debugging the view hierarchy in Xcode.
- // If we need to distinguish things here in the future, we can use e.g.
- // [NSGraphicsContext drawingToScreen], or the attributes of the context.
- NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext];
- Q_ASSERT_X(graphicsContext, "QCocoaBackingStore",
- "Focusing the view should give us a current graphics context");
-
- // Tag backingstore image with color space based on the window.
- // Note: This does not copy the underlying image data.
- QCFType<CGImageRef> cgImage = CGImageCreateCopyWithColorSpace(
- QCFType<CGImageRef>(m_image.toCGImage()), colorSpace());
-
- // Create temporary image to use for blitting, without copying image data
- NSImage *backingStoreImage = [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease];
-
- QRegion clippedRegion = region;
- for (QWindow *w = window; w; w = w->parent()) {
- if (!w->mask().isEmpty()) {
- clippedRegion &= w == window ? w->mask()
- : w->mask().translated(window->mapFromGlobal(w->mapToGlobal(QPoint(0, 0))));
- }
- }
-
- for (const QRect &viewLocalRect : clippedRegion) {
- QPoint backingStoreOffset = viewLocalRect.topLeft() + offset;
- QRect backingStoreRect(backingStoreOffset * devicePixelRatio, viewLocalRect.size() * devicePixelRatio);
- if (graphicsContext.flipped) // Flip backingStoreRect to match graphics context
- backingStoreRect.moveTop(m_image.height() - (backingStoreRect.y() + backingStoreRect.height()));
-
- CGRect viewRect = viewLocalRect.toCGRect();
-
- [backingStoreImage drawInRect:viewRect fromRect:backingStoreRect.toCGRect()
- operation:compositingOperation fraction:1.0 respectFlipped:YES hints:nil];
-
-#ifdef QT_DEBUG
- if (Q_UNLIKELY(debugBackingStoreFlush)) {
- [[NSColor colorWithCalibratedRed:drand48() green:drand48() blue:drand48() alpha:0.3] set];
- [NSBezierPath fillRect:viewRect];
-
- if (drawingOutsideOfDisplayCycle) {
- [[[NSColor magentaColor] colorWithAlphaComponent:0.5] set];
- [NSBezierPath strokeLineFromPoint:viewLocalRect.topLeft().toCGPoint()
- toPoint:viewLocalRect.bottomRight().toCGPoint()];
- }
- }
-#endif
- }
-
- // -------------------------------------------------------------------------
-
- if (shouldHandleViewLockManually)
- QT_IGNORE_DEPRECATIONS([view unlockFocus]);
-
- if (drawingOutsideOfDisplayCycle) {
- redrawRoundedBottomCorners([view convertRect:region.boundingRect().toCGRect() toView:nil]);
- QT_IGNORE_DEPRECATIONS([view.window flushWindow]);
- }
-
- // Done flushing to NSWindow backingstore
-
- QCocoaWindow *topLevelCocoaWindow = static_cast<QCocoaWindow *>(topLevelWindow->handle());
- if (Q_UNLIKELY(topLevelCocoaWindow->m_needsInvalidateShadow)) {
- qCDebug(lcQpaBackingStore) << "Invalidating window shadow for" << topLevelCocoaWindow;
- [topLevelView.window invalidateShadow];
- topLevelCocoaWindow->m_needsInvalidateShadow = false;
- }
-}
-
-/*
- When drawing outside of the display cycle, which Qt Widget does a lot,
- we end up drawing over the NSThemeFrame, losing the rounded corners of
- windows in the process.
-
- To work around this, until we've enabled updates via setNeedsDisplay and/or
- enabled layer-backed views, we ask the NSWindow to redraw the bottom corners
- if they intersect with the flushed region.
-
- This is the same logic used internally by e.g [NSView displayIfNeeded],
- [NSRulerView _scrollToMatchContentView], and [NSClipView _immediateScrollToPoint:],
- as well as the workaround used by WebKit to fix a similar bug:
-
- https://trac.webkit.org/changeset/85376/webkit
-*/
-void QNSWindowBackingStore::redrawRoundedBottomCorners(CGRect windowRect) const
-{
-#if !defined(QT_APPLE_NO_PRIVATE_APIS)
- Q_ASSERT(this->window()->handle());
- NSWindow *window = static_cast<QCocoaWindow *>(this->window()->handle())->nativeWindow();
-
- static SEL intersectBottomCornersWithRect = NSSelectorFromString(
- [NSString stringWithFormat:@"_%s%s:", "intersectBottomCorners", "WithRect"]);
- if (NSMethodSignature *signature = [window methodSignatureForSelector:intersectBottomCornersWithRect]) {
- NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
- invocation.target = window;
- invocation.selector = intersectBottomCornersWithRect;
- [invocation setArgument:&windowRect atIndex:2];
- [invocation invoke];
-
- NSRect cornerOverlap = NSZeroRect;
- [invocation getReturnValue:&cornerOverlap];
- if (!NSIsEmptyRect(cornerOverlap)) {
- static SEL maskRoundedBottomCorners = NSSelectorFromString(
- [NSString stringWithFormat:@"_%s%s:", "maskRounded", "BottomCorners"]);
- if ((signature = [window methodSignatureForSelector:maskRoundedBottomCorners])) {
- invocation = [NSInvocation invocationWithMethodSignature:signature];
- invocation.target = window;
- invocation.selector = maskRoundedBottomCorners;
- [invocation setArgument:&cornerOverlap atIndex:2];
- [invocation invoke];
- }
- }
- }
-#else
- Q_UNUSED(windowRect);
-#endif
-}
-
-// ----------------------------------------------------------------------------
-
-QCALayerBackingStore::QCALayerBackingStore(QWindow *window)
- : QCocoaBackingStore(window)
-{
- qCDebug(lcQpaBackingStore) << "Creating QCALayerBackingStore for" << window;
- m_buffers.resize(1);
-
- // Ideally this would be plumbed from the platform layer to QtGui, and
- // the QBackingStore would be recreated, but we don't have that code yet,
- // so at least make sure we update our backingstore when the backing
- // properties (color space e.g.) are changed.
- NSView *view = static_cast<QCocoaWindow *>(window->handle())->view();
+ NSView *view = static_cast<QCocoaWindow *>(window()->handle())->view();
m_backingPropertiesObserver = QMacNotificationObserver(view.window,
NSWindowDidChangeBackingPropertiesNotification, [this]() {
- qCDebug(lcQpaBackingStore) << "Backing properties for"
- << this->window() << "did change";
backingPropertiesChanged();
});
}
-QCALayerBackingStore::~QCALayerBackingStore()
+bool QCALayerBackingStore::eventFilter(QObject *watched, QEvent *event)
{
+ Q_ASSERT(watched == window());
+
+ if (event->type() == QEvent::PlatformSurface) {
+ auto *surfaceEvent = static_cast<QPlatformSurfaceEvent*>(event);
+ if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated)
+ observeBackingPropertiesChanges();
+ else
+ m_backingPropertiesObserver = QMacNotificationObserver();
+ }
+
+ return false;
}
void QCALayerBackingStore::resize(const QSize &size, const QRegion &staticContents)
@@ -654,6 +400,15 @@ QImage QCALayerBackingStore::toImage() const
void QCALayerBackingStore::backingPropertiesChanged()
{
+ // Ideally this would be plumbed from the platform layer to QtGui, and
+ // the QBackingStore would be recreated, but we don't have that code yet,
+ // so at least make sure we update our backingstore when the backing
+ // properties (color space e.g.) are changed.
+
+ Q_ASSERT(window()->handle());
+
+ qCDebug(lcQpaBackingStore) << "Backing properties for" << window() << "did change";
+
qCDebug(lcQpaBackingStore) << "Updating color space of existing buffers";
for (auto &buffer : m_buffers) {
if (buffer)
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 49812423eb..8d256ae09e 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -181,8 +181,34 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
- (void)updateQtColor
{
- NSColor *color = [mColorPanel color];
- mQtColor = qt_mac_toQColor(color);
+ // Discard the color space and pass the color components to QColor. This
+ // is a good option as long as QColor is color-unmanaged: we preserve the
+ // exact RGB value from the color picker, which is predictable. Further,
+ // painting with the color will reproduce the same color on-screen, as
+ // long as the the same screen is used for selecting the color.
+ NSColor *componentColor = [[mColorPanel color] colorUsingType:NSColorTypeComponentBased];
+ switch (componentColor.colorSpace.colorSpaceModel)
+ {
+ case NSColorSpaceModelGray: {
+ CGFloat white = 0, alpha = 0;
+ [componentColor getWhite:&white alpha:&alpha];
+ mQtColor.setRgbF(white, white, white, alpha);
+ } break;
+ case NSColorSpaceModelRGB: {
+ CGFloat red = 0, green = 0, blue = 0, alpha = 0;
+ [componentColor getRed:&red green:&green blue:&blue alpha:&alpha];
+ mQtColor.setRgbF(red, green, blue, alpha);
+ } break;
+ case NSColorSpaceModelCMYK: {
+ CGFloat cyan = 0, magenta = 0, yellow = 0, black = 0, alpha = 0;
+ [componentColor getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
+ mQtColor.setCmykF(cyan, magenta, yellow, black, alpha);
+ } break;
+ default:
+ qWarning("QNSColorPanelDelegate: Unsupported color space model");
+ break;
+ }
+
if (mHelper)
emit mHelper->currentColorChanged(mQtColor);
}
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h
index a062b92506..eee2692666 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.h
+++ b/src/plugins/platforms/cocoa/qcocoadrag.h
@@ -95,7 +95,7 @@ public:
protected:
bool hasFormat_sys(const QString &mimeType) const;
QStringList formats_sys() const;
- QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const;
+ QVariant retrieveData_sys(const QString &mimeType, QMetaType type) const;
public:
CFStringRef dropPasteboard;
};
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index eed9d3a42b..f681981d34 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -130,6 +130,10 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
m_drag = o;
m_executed_drop_action = Qt::IgnoreAction;
+ QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
+ m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
+ dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
+
if (maybeDragMultipleItems())
return m_executed_drop_action;
@@ -138,10 +142,6 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
NSImage *dragImage = [NSImage imageFromQImage:pm.toImage()];
Q_ASSERT(dragImage);
- QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
- m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
- dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
-
NSPoint event_location = [m_lastEvent locationInWindow];
NSWindow *theWindow = [m_lastEvent window];
Q_ASSERT(theWindow);
@@ -186,7 +186,7 @@ bool QCocoaDrag::maybeDragMultipleItems()
const auto &qtUrls = m_drag->mimeData()->urls();
NSPasteboard *dragBoard = [NSPasteboard pasteboardWithName:NSPasteboardNameDrag];
- if (int(dragBoard.pasteboardItems.count) == 1 && qtUrls.size() <= 1) {
+ if (qtUrls.size() <= 1) {
// Good old -dragImage: works perfectly for this ...
return false;
}
@@ -216,13 +216,18 @@ bool QCocoaDrag::maybeDragMultipleItems()
// 0. We start from URLs, which can be actually in a list (thus technically
// only ONE item in the pasteboard. The fact it's only one does not help, we are
// still getting an exception because of the number of items/images mismatch ...
+ // We only set the image for the first item and nil for the rest, the image already
+ // contains a combined picture for all urls we drag.
+ auto imageOrNil = dragImage;
for (const auto &qtUrl : qtUrls) {
NSURL *nsUrl = qtUrl.toNSURL();
auto *newItem = [[[NSDraggingItem alloc] initWithPasteboardWriter:nsUrl] autorelease];
const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y,
dragImage.size.width,
dragImage.size.height);
- [newItem setDraggingFrame:itemFrame contents:dragImage];
+
+ [newItem setDraggingFrame:itemFrame contents:imageOrNil];
+ imageOrNil = nil;
[dragItems addObject:newItem];
}
// 1. Repeat for non-url items, if any:
@@ -231,7 +236,7 @@ bool QCocoaDrag::maybeDragMultipleItems()
const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y,
dragImage.size.width,
dragImage.size.height);
- [newItem setDraggingFrame:itemFrame contents:dragImage];
+ [newItem setDraggingFrame:itemFrame contents:imageOrNil];
[dragItems addObject:newItem];
}
@@ -332,7 +337,7 @@ QStringList QCocoaDropData::formats_sys() const
return formats;
}
-QVariant QCocoaDropData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const
+QVariant QCocoaDropData::retrieveData_sys(const QString &mimeType, QMetaType type) const
{
QVariant data;
PasteboardRef board;
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
index b8d2532b8e..823633ffb9 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
@@ -115,12 +115,11 @@ public:
~QCocoaEventDispatcher();
bool processEvents(QEventLoop::ProcessEventsFlags flags);
- bool hasPendingEvents();
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
- void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
+ void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object);
bool unregisterTimer(int timerId);
bool unregisterTimers(QObject *object);
QList<TimerInfo> registeredTimers(QObject *object) const;
@@ -129,7 +128,6 @@ public:
void wakeUp();
void interrupt();
- void flush();
static void clearCurrentThreadCocoaEventDispatcherInterruptFlag();
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 0480ec0482..042abae1ca 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -196,7 +196,7 @@ void QCocoaEventDispatcherPrivate::maybeStopCFRunLoopTimer()
runLoopTimerRef = nullptr;
}
-void QCocoaEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj)
+void QCocoaEventDispatcher::registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *obj)
{
#ifndef QT_NO_DEBUG
if (timerId < 1 || interval < 0 || !obj) {
@@ -288,13 +288,6 @@ void QCocoaEventDispatcher::unregisterSocketNotifier(QSocketNotifier *notifier)
d->cfSocketNotifier.unregisterSocketNotifier(notifier);
}
-bool QCocoaEventDispatcher::hasPendingEvents()
-{
- extern uint qGlobalPostedEventsCount();
- extern bool qt_is_gui_used; //qapplication.cpp
- return qGlobalPostedEventsCount() || (qt_is_gui_used && !CFRunLoopIsWaiting(CFRunLoopGetMain()));
-}
-
static bool isUserInputEvent(NSEvent* event)
{
switch ([event type]) {
@@ -969,9 +962,6 @@ void QCocoaEventDispatcher::interrupt()
d->cancelWaitForMoreEvents();
}
-void QCocoaEventDispatcher::flush()
-{ }
-
// QTBUG-56746: The behavior of processEvents() has been changed to not clear
// the interrupt flag. Use this function to clear it.
void QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag()
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index d2037923d0..bdf185d275 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -68,8 +68,6 @@
#include <CoreFoundation/CFNumber.h>
-QT_FORWARD_DECLARE_CLASS(QString)
-QT_FORWARD_DECLARE_CLASS(QStringList)
QT_FORWARD_DECLARE_CLASS(QFileInfo)
QT_FORWARD_DECLARE_CLASS(QWindow)
QT_USE_NAMESPACE
@@ -435,7 +433,7 @@ static QString strippedText(QString s)
Q_UNUSED(sender);
if (mHelper && [mSavePanel isVisible]) {
QString selection = QString::fromNSString([[mSavePanel URL] path]);
- if (selection != mCurrentSelection) {
+ if (selection != *mCurrentSelection) {
*mCurrentSelection = selection;
mHelper->QNSOpenSavePanelDelegate_selectionChanged(selection);
}
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index 0e8f09ab30..e1c9d0a194 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -66,7 +66,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
QString family(QCFString((CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute)));
QString style(QCFString(((CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute))));
- newFont = QFontDatabase().font(family, style, pSize);
+ newFont = QFontDatabase::font(family, style, pSize);
newFont.setUnderline(resolveFont.underline());
newFont.setStrikeOut(resolveFont.strikeOut());
}
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 9dbd1a11bf..633b9256c8 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
class QCocoaWindow;
-class QCocoaGLContext : public QPlatformOpenGLContext, public QPlatformInterface::QCocoaGLContext
+class QCocoaGLContext : public QPlatformOpenGLContext, public QNativeInterface::QCocoaGLContext
{
public:
QCocoaGLContext(QOpenGLContext *context);
@@ -81,7 +81,6 @@ private:
static NSOpenGLPixelFormat *pixelFormatForSurfaceFormat(const QSurfaceFormat &format);
bool setDrawable(QPlatformSurface *surface);
- void prepareDrawable(QCocoaWindow *platformWindow);
void updateSurfaceFormat();
NSOpenGLContext *m_context = nil;
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index c2fcb6cdbc..7b0cc3fac3 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -393,8 +393,6 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
if (view == QT_IGNORE_DEPRECATIONS(m_context.view))
return true;
- prepareDrawable(cocoaWindow);
-
// Setting the drawable may happen on a separate thread as a result of
// a call to makeCurrent, so we need to set up the observers before we
// associate the view with the context. That way we will guarantee that
@@ -410,12 +408,8 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
m_updateObservers.clear();
- if (view.layer) {
- m_updateObservers.append(QMacNotificationObserver(view, NSViewFrameDidChangeNotification, updateCallback));
- m_updateObservers.append(QMacNotificationObserver(view.window, NSWindowDidChangeScreenNotification, updateCallback));
- } else {
- m_updateObservers.append(QMacNotificationObserver(view, QT_IGNORE_DEPRECATIONS(NSViewGlobalFrameDidChangeNotification), updateCallback));
- }
+ m_updateObservers.append(QMacNotificationObserver(view, NSViewFrameDidChangeNotification, updateCallback));
+ m_updateObservers.append(QMacNotificationObserver(view.window, NSWindowDidChangeScreenNotification, updateCallback));
m_updateObservers.append(QMacNotificationObserver([NSApplication sharedApplication],
NSApplicationDidChangeScreenParametersNotification, updateCallback));
@@ -437,30 +431,6 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
return true;
}
-void QCocoaGLContext::prepareDrawable(QCocoaWindow *platformWindow)
-{
- // We generally want high-DPI GL surfaces, unless the user has explicitly disabled them
- bool prefersBestResolutionOpenGLSurface = qt_mac_resolveOption(YES,
- platformWindow->window(), "_q_mac_wantsBestResolutionOpenGLSurface",
- "QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
-
- auto *view = platformWindow->view();
-
- // The only case we have to opt out ourselves is when using the Apple software renderer
- // in combination with surface-backed views, as these together do not support high-DPI.
- if (prefersBestResolutionOpenGLSurface) {
- int rendererID = 0;
- [m_context getValues:&rendererID forParameter:NSOpenGLContextParameterCurrentRendererID];
- bool isSoftwareRenderer = (rendererID & kCGLRendererIDMatchingMask) == kCGLRendererGenericFloatID;
- if (isSoftwareRenderer && !view.layer) {
- qCInfo(lcQpaOpenGLContext) << "Disabling high resolution GL surface due to software renderer";
- prefersBestResolutionOpenGLSurface = false;
- }
- }
-
- QT_IGNORE_DEPRECATIONS(view.wantsBestResolutionOpenGLSurface) = prefersBestResolutionOpenGLSurface;
-}
-
// NSOpenGLContext is not re-entrant. Even when using separate contexts per thread,
// view, and window, calls into the API will still deadlock. For more information
// see https://openradar.appspot.com/37064579
@@ -494,19 +464,17 @@ void QCocoaGLContext::swapBuffers(QPlatformSurface *surface)
return;
}
- if (QT_IGNORE_DEPRECATIONS(m_context.view).layer) {
- // Flushing an NSOpenGLContext will hit the screen immediately, ignoring
- // any Core Animation transactions in place. This may result in major
- // visual artifacts if the flush happens out of sync with the size
- // of the layer, view, and window reflected by other parts of the UI,
- // e.g. if the application flushes in the resize event or a timer during
- // window resizing, instead of in the expose event.
- auto *cocoaWindow = static_cast<QCocoaWindow *>(surface);
- if (cocoaWindow->geometry().size() != cocoaWindow->m_exposedRect.size()) {
- qCInfo(lcQpaOpenGLContext) << "Window exposed size does not match geometry (yet)."
- << "Skipping flush to avoid visual artifacts.";
- return;
- }
+ // Flushing an NSOpenGLContext will hit the screen immediately, ignoring
+ // any Core Animation transactions in place. This may result in major
+ // visual artifacts if the flush happens out of sync with the size
+ // of the layer, view, and window reflected by other parts of the UI,
+ // e.g. if the application flushes in the resize event or a timer during
+ // window resizing, instead of in the expose event.
+ auto *cocoaWindow = static_cast<QCocoaWindow *>(surface);
+ if (cocoaWindow->geometry().size() != cocoaWindow->m_exposedRect.size()) {
+ qCInfo(lcQpaOpenGLContext) << "Window exposed size does not match geometry (yet)."
+ << "Skipping flush to avoid visual artifacts.";
+ return;
}
QMutexLocker locker(&s_reentrancyMutex);
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index d85db6d9e1..883c409924 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -55,6 +55,7 @@
#include <QtCore/qloggingcategory.h>
#include <QtGui/qpalette.h>
#include <QtGui/qscreen.h>
+#include <qpa/qplatformdialoghelper.h>
#include <objc/runtime.h>
#include <objc/message.h>
@@ -71,6 +72,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcQpaWindow)
Q_DECLARE_LOGGING_CATEGORY(lcQpaDrawing)
Q_DECLARE_LOGGING_CATEGORY(lcQpaMouse)
Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen)
+Q_DECLARE_LOGGING_CATEGORY(lcQpaApplication)
class QPixmap;
class QString;
@@ -211,7 +213,7 @@ QT_END_NAMESPACE
- (instancetype)initWithPanelDelegate:(id<QNSPanelDelegate>)panelDelegate;
- (void)dealloc;
-- (NSButton *)createButtonWithTitle:(const char *)title;
+- (NSButton *)createButtonWithTitle:(QPlatformDialogHelper::StandardButton)type;
- (void)layout;
@end
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 446c23be81..389766fdc7 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -59,6 +59,7 @@ Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
Q_LOGGING_CATEGORY(lcQpaDrawing, "qt.qpa.drawing");
Q_LOGGING_CATEGORY(lcQpaMouse, "qt.qpa.input.mouse", QtCriticalMsg);
Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen", QtCriticalMsg);
+Q_LOGGING_CATEGORY(lcQpaApplication, "qt.qpa.application");
//
// Conversion Functions
@@ -392,11 +393,10 @@ QT_END_NAMESPACE
{
if ((self = [super initWithFrame:NSZeroRect])) {
// create OK and Cancel buttons and add these as subviews
- _okButton = [self createButtonWithTitle:"&OK"];
+ _okButton = [self createButtonWithTitle:QPlatformDialogHelper::Ok];
_okButton.action = @selector(onOkClicked);
_okButton.target = panelDelegate;
-
- _cancelButton = [self createButtonWithTitle:"Cancel"];
+ _cancelButton = [self createButtonWithTitle:QPlatformDialogHelper::Cancel];
_cancelButton.action = @selector(onCancelClicked);
_cancelButton.target = panelDelegate;
@@ -420,12 +420,13 @@ QT_END_NAMESPACE
[super dealloc];
}
-- (NSButton *)createButtonWithTitle:(const char *)title
+- (NSButton *)createButtonWithTitle:(QPlatformDialogHelper::StandardButton)type
{
NSButton *button = [[NSButton alloc] initWithFrame:NSZeroRect];
button.buttonType = NSButtonTypeMomentaryLight;
button.bezelStyle = NSBezelStyleRounded;
- const QString &cleanTitle = QPlatformTheme::removeMnemonics(QCoreApplication::translate("QDialogButtonBox", title));
+ const QString &cleanTitle =
+ QPlatformTheme::removeMnemonics(QGuiApplicationPrivate::platformTheme()->standardButtonText(type));
// FIXME: Not obvious, from Cocoa's documentation, that QString::toNSString() makes a deep copy
button.title = (NSString *)cleanTitle.toCFString();
((NSButtonCell *)button.cell).font =
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index f8b9e9fc12..4f1969dd98 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
class QCocoaIntegration : public QObject, public QPlatformIntegration
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QCocoaGLIntegration
+ , public QNativeInterface::Private::QCocoaGLIntegration
#endif
{
Q_OBJECT
@@ -132,6 +132,7 @@ public:
void setApplicationIcon(const QIcon &icon) const override;
void beep() const override;
+ void quit() const override;
void closePopups(QWindow *forWindow = nullptr);
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 4f4373fbac..872d9bb7f1 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -259,8 +259,8 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
// AppKit expects rendering to happen on the main thread, and we can
// easily end up in situations where rendering on secondary threads
// will result in visual artifacts, bugs, or even deadlocks, when
- // building with SDK 10.14 or higher which enbles view layer-backing.
- return QMacVersion::buildSDK() < QOperatingSystemVersion(QOperatingSystemVersion::MacOSMojave);
+ // layer-backed.
+ return false;
case OpenGL:
case BufferQueueingOpenGL:
#endif
@@ -333,13 +333,7 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi
return nullptr;
}
- QPlatformBackingStore *backingStore = nullptr;
- if (platformWindow->view().layer)
- backingStore = new QCALayerBackingStore(window);
- else
- backingStore = new QNSWindowBackingStore(window);
-
- return backingStore;
+ return new QCALayerBackingStore(window);
}
QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
@@ -494,6 +488,12 @@ void QCocoaIntegration::beep() const
NSBeep();
}
+void QCocoaIntegration::quit() const
+{
+ qCDebug(lcQpaApplication) << "Terminating application";
+ [NSApp terminate:nil];
+}
+
void QCocoaIntegration::closePopups(QWindow *forWindow)
{
for (auto it = m_popupWindowStack.begin(); it != m_popupWindowStack.end();) {
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
index d1654e84bb..dca7b576f6 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
@@ -454,6 +454,14 @@ const QCocoaKeyMapper::KeyMap &QCocoaKeyMapper::keyMapForKey(VirtualKeyCode virt
qCDebug(lcQpaKeyMapper, "Updating key map for virtual key = 0x%02x!", (uint)virtualKey);
+ // Key mapping via [NSEvent charactersByApplyingModifiers:] only works for key down
+ // events, but we might (wrongly) get into this code path for other key events such
+ // as NSEventTypeFlagsChanged.
+ const bool canMapCocoaEvent = NSApp.currentEvent.type == NSEventTypeKeyDown;
+
+ if (!canMapCocoaEvent)
+ qCWarning(lcQpaKeyMapper) << "Could not map key to character for event" << NSApp.currentEvent;
+
for (int i = 0; i < kNumModifierCombinations; ++i) {
Q_ASSERT(!i || keyMap[i] == 0);
@@ -473,19 +481,19 @@ const QCocoaKeyMapper::KeyMap &QCocoaKeyMapper::keyMapForKey(VirtualKeyCode virt
unicodeKey = QChar(unicodeString[0]);
if (@available(macOS 10.15, *)) {
- // Until we've verified that the Cocoa API works as expected
- // we first run the event through the Carbon APIs and then
- // compare the results to Cocoa.
- Q_ASSERT(NSApp.currentEvent);
- Q_ASSERT(NSApp.currentEvent.type == NSEventTypeKeyDown);
- auto cocoaModifiers = toCocoaModifiers(qtModifiers);
- auto *charactersWithModifiers = [NSApp.currentEvent charactersByApplyingModifiers:cocoaModifiers];
- Q_ASSERT(charactersWithModifiers && charactersWithModifiers.length > 0);
- auto cocoaUnicodeKey = QChar([charactersWithModifiers characterAtIndex:0]);
- if (cocoaUnicodeKey != unicodeKey) {
- qCWarning(lcQpaKeyMapper) << "Mismatch between Cocoa" << cocoaUnicodeKey
- << "and Carbon" << unicodeKey << "for virtual key" << virtualKey
- << "with" << qtModifiers;
+ if (canMapCocoaEvent) {
+ // Until we've verified that the Cocoa API works as expected
+ // we first run the event through the Carbon APIs and then
+ // compare the results to Cocoa.
+ auto cocoaModifiers = toCocoaModifiers(qtModifiers);
+ auto *charactersWithModifiers = [NSApp.currentEvent charactersByApplyingModifiers:cocoaModifiers];
+ Q_ASSERT(charactersWithModifiers && charactersWithModifiers.length > 0);
+ auto cocoaUnicodeKey = QChar([charactersWithModifiers characterAtIndex:0]);
+ if (cocoaUnicodeKey != unicodeKey) {
+ qCWarning(lcQpaKeyMapper) << "Mismatch between Cocoa" << cocoaUnicodeKey
+ << "and Carbon" << unicodeKey << "for virtual key" << virtualKey
+ << "with" << qtModifiers;
+ }
}
}
@@ -505,7 +513,11 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
{
QList<int> ret;
- auto keyMap = keyMapForKey(event->nativeVirtualKey(), QChar(event->key()));
+ const auto nativeVirtualKey = event->nativeVirtualKey();
+ if (!nativeVirtualKey)
+ return ret;
+
+ auto keyMap = keyMapForKey(nativeVirtualKey, QChar(event->key()));
auto unmodifiedKey = keyMap[Qt::NoModifier];
Q_ASSERT(unmodifiedKey != Qt::Key_unknown);
@@ -514,7 +526,7 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
// The base key, with the complete set of modifiers,
// is always valid, and the first priority.
- ret << int(unmodifiedKey + eventModifiers);
+ ret << int(unmodifiedKey) + int(eventModifiers);
// FIXME: We only compute the first 8 combinations. Why?
for (int i = 1; i < 8; ++i) {
@@ -526,7 +538,7 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
// perfectly, the current candidate modifiers.
auto candidateModifiers = modifierCombinations[i];
if ((eventModifiers & candidateModifiers) == candidateModifiers)
- ret << int(keyAfterApplyingModifiers + (eventModifiers & ~candidateModifiers));
+ ret << int(keyAfterApplyingModifiers) + int(eventModifiers & ~candidateModifiers);
}
return ret;
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 6bd033bfeb..1bf9cface0 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
class QCocoaMenu : public QPlatformMenu, public QCocoaMenuObject
- , public QPlatformInterface::Private::QCocoaMenu
+ , public QNativeInterface::Private::QCocoaMenu
{
public:
QCocoaMenu();
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 8937765f6b..4c7064a845 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -93,7 +93,7 @@ void QCocoaMenu::setMinimumWidth(int width)
void QCocoaMenu::setFont(const QFont &font)
{
- if (font.resolve()) {
+ if (font.resolveMask()) {
NSFont *customMenuFont = [NSFont fontWithName:font.family().toNSString()
size:font.pointSize()];
m_nativeMenu.font = customMenuFont;
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.h b/src/plugins/platforms/cocoa/qcocoamenubar.h
index 94333e3bb1..7186e48829 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.h
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class QCocoaWindow;
class QCocoaMenuBar : public QPlatformMenuBar
- , public QPlatformInterface::Private::QCocoaMenuBar
+ , public QNativeInterface::Private::QCocoaMenuBar
{
Q_OBJECT
public:
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 39a124ea44..511c72988a 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -353,9 +353,8 @@ NSMenuItem *QCocoaMenuItem::sync()
#ifndef QT_NO_SHORTCUT
if (accel.count() == 1) {
- auto shortcut = accel[0];
- auto key = Qt::Key(shortcut & ~Qt::KeyboardModifierMask);
- auto modifiers = Qt::KeyboardModifiers(shortcut & Qt::KeyboardModifierMask);
+ auto key = accel[0].key();
+ auto modifiers = accel[0].keyboardModifiers();
QChar cocoaKey = QCocoaKeyMapper::toCocoaKey(key);
if (cocoaKey.isNull())
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 3b5b5fc6f8..a975f2d76c 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -271,7 +271,7 @@ void QCocoaSystemTrayIcon::statusItemClicked()
activationReason = QPlatformSystemTrayIcon::DoubleClick;
} else {
auto mouseButton = cocoaButton2QtButton(mouseEvent);
- if (mouseButton == Qt::MidButton)
+ if (mouseButton == Qt::MiddleButton)
activationReason = QPlatformSystemTrayIcon::MiddleClick;
else if (mouseButton == Qt::RightButton)
activationReason = QPlatformSystemTrayIcon::Context;
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 674a8da60a..f88569df05 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -477,7 +477,7 @@ public:
return QAbstractFileIconEngine::toSizeList(sizes, sizes + sizeof(sizes) / sizeof(sizes[0]));
}
- QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) const override
+ QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) override
{ return QCocoaFileIconEngine::availableIconSizes(); }
protected:
@@ -501,7 +501,7 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
case QPlatformTheme::StyleNames:
- return QStringList(QStringLiteral("macintosh"));
+ return QStringList(QStringLiteral("macOS"));
case QPlatformTheme::DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::MacLayout);
case KeyboardScheme:
@@ -575,14 +575,14 @@ QList<QKeySequence> QCocoaTheme::keyBindings(QKeySequence::StandardKey key) cons
auto bindings = QPlatformTheme::keyBindings(key);
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
- static auto swapCtrlMeta = [](int keySequence) {
- auto originalKeySequence = keySequence;
- keySequence &= ~(Qt::ControlModifier | Qt::MetaModifier);
- if (originalKeySequence & Qt::ControlModifier)
- keySequence |= Qt::MetaModifier;
- if (originalKeySequence & Qt::MetaModifier)
- keySequence |= Qt::ControlModifier;
- return keySequence;
+ static auto swapCtrlMeta = [](QKeyCombination keyCombination) {
+ const auto originalKeyModifiers = keyCombination.keyboardModifiers();
+ auto newKeyboardModifiers = originalKeyModifiers & ~(Qt::ControlModifier | Qt::MetaModifier);
+ if (originalKeyModifiers & Qt::ControlModifier)
+ newKeyboardModifiers |= Qt::MetaModifier;
+ if (originalKeyModifiers & Qt::MetaModifier)
+ newKeyboardModifiers |= Qt::ControlModifier;
+ return QKeyCombination(newKeyboardModifiers, keyCombination.key());
};
QList<QKeySequence> swappedBindings;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 927c3bd751..9a2fa5f025 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -100,7 +100,7 @@ class QDebug;
class QCocoaMenuBar;
class QCocoaWindow : public QObject, public QPlatformWindow,
- public QPlatformInterface::Private::QCocoaWindow
+ public QNativeInterface::Private::QCocoaWindow
{
Q_OBJECT
public:
@@ -261,8 +261,6 @@ public: // for QNSView
bool m_inSetStyleMask;
QCocoaMenuBar *m_menubar;
- bool m_needsInvalidateShadow;
-
bool m_frameStrutEventsEnabled;
QRect m_exposedRect;
int m_registerTouchCount;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 9a6555ca8c..38aa343d4f 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -80,7 +80,7 @@ static void qRegisterNotificationCallbacks()
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
- const QMetaObject *metaObject = QMetaType::metaObjectForType(qRegisterMetaType<QCocoaWindow*>());
+ const QMetaObject *metaObject = QMetaType(qRegisterMetaType<QCocoaWindow*>()).metaObject();
Q_ASSERT(metaObject);
for (int i = 0; i < metaObject->methodCount(); ++i) {
@@ -145,7 +145,6 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle)
, m_inSetGeometry(false)
, m_inSetStyleMask(false)
, m_menubar(nullptr)
- , m_needsInvalidateShadow(false)
, m_frameStrutEventsEnabled(false)
, m_registerTouchCount(0)
, m_resizableTransientParent(false)
@@ -307,6 +306,9 @@ bool QCocoaWindow::startSystemMove()
case NSEventTypeRightMouseDown:
case NSEventTypeOtherMouseDown:
case NSEventTypeMouseMoved:
+ case NSEventTypeLeftMouseDragged:
+ case NSEventTypeRightMouseDragged:
+ case NSEventTypeOtherMouseDragged:
// The documentation only describes starting a system move
// based on mouse down events, but move events also work.
[m_view.window performWindowDragWithEvent:NSApp.currentEvent];
@@ -1056,27 +1058,15 @@ void QCocoaWindow::setMask(const QRegion &region)
{
qCDebug(lcQpaWindow) << "QCocoaWindow::setMask" << window() << region;
- if (m_view.layer) {
- if (!region.isEmpty()) {
- QCFType<CGMutablePathRef> maskPath = CGPathCreateMutable();
- for (const QRect &r : region)
- CGPathAddRect(maskPath, nullptr, r.toCGRect());
- CAShapeLayer *maskLayer = [CAShapeLayer layer];
- maskLayer.path = maskPath;
- m_view.layer.mask = maskLayer;
- } else {
- m_view.layer.mask = nil;
- }
+ if (!region.isEmpty()) {
+ QCFType<CGMutablePathRef> maskPath = CGPathCreateMutable();
+ for (const QRect &r : region)
+ CGPathAddRect(maskPath, nullptr, r.toCGRect());
+ CAShapeLayer *maskLayer = [CAShapeLayer layer];
+ maskLayer.path = maskPath;
+ m_view.layer.mask = maskLayer;
} else {
- if (isContentView()) {
- // Setting the mask requires invalidating the NSWindow shadow, but that needs
- // to happen after the backingstore has been redrawn, so that AppKit can pick
- // up the new window shape based on the backingstore content. Doing a display
- // directly here is not an option, as the window might not be exposed at this
- // time, and so would not result in an updated backingstore.
- m_needsInvalidateShadow = true;
- [m_view setNeedsDisplay:YES];
- }
+ m_view.layer.mask = nil;
}
}
@@ -1239,15 +1229,18 @@ void QCocoaWindow::windowDidResignKey()
if (isForeignWindow())
return;
- // Key window will be non-nil if another window became key, so do not
- // set the active window to zero here -- the new key window's
- // NSWindowDidBecomeKeyNotification hander will change the active window.
- NSWindow *keyWindow = [NSApp keyWindow];
- if (!keyWindow || keyWindow == m_view.window) {
- // No new key window, go ahead and set the active window to zero
- if (!windowIsPopupType())
- QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
- nullptr, Qt::ActiveWindowFocusReason);
+ // The current key window will be non-nil if another window became key. If that
+ // window is a Qt window, we delay the window activation event until the didBecomeKey
+ // notification is delivered to the active window, to ensure an atomic update.
+ NSWindow *newKeyWindow = [NSApp keyWindow];
+ if (newKeyWindow && newKeyWindow != m_view.window
+ && [newKeyWindow conformsToProtocol:@protocol(QNSWindowProtocol)])
+ return;
+
+ // Lost key window, go ahead and set the active window to zero
+ if (!windowIsPopupType()) {
+ QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
+ nullptr, Qt::ActiveWindowFocusReason);
}
}
@@ -1673,7 +1666,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
applyContentBorderThickness(nsWindow);
- if (format().colorSpace() == QSurfaceFormat::sRGBColorSpace)
+ if (format().colorSpace() == QColorSpace::SRgb)
nsWindow.colorSpace = NSColorSpace.sRGBColorSpace;
return nsWindow;
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.h b/src/plugins/platforms/cocoa/qmacclipboard.h
index 0cb6239690..df892a2810 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.h
+++ b/src/plugins/platforms/cocoa/qmacclipboard.h
@@ -92,7 +92,7 @@ public:
QStringList formats() const;
bool hasFormat(const QString &format) const;
- QVariant retrieveData(const QString &format, QVariant::Type) const;
+ QVariant retrieveData(const QString &format, QMetaType) const;
void clear();
bool sync() const;
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm
index 2afd3f6e13..8df4242e70 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.mm
+++ b/src/plugins/platforms/cocoa/qmacclipboard.mm
@@ -84,7 +84,7 @@ OSStatus PasteboardGetItemCountSafe(PasteboardRef paste, ItemCount *cnt)
class QMacMimeData : public QMimeData
{
public:
- QVariant variantData(const QString &mime) { return retrieveData(mime, QVariant::Invalid); }
+ QVariant variantData(const QString &mime) { return retrieveData(mime, QMetaType()); }
private:
QMacMimeData();
};
@@ -313,7 +313,7 @@ public:
QMacPasteboardMimeSource(const QMacPasteboard *p) : QMimeData(), paste(p) { }
~QMacPasteboardMimeSource() { }
virtual QStringList formats() const { return paste->formats(); }
- virtual QVariant retrieveData(const QString &format, QVariant::Type type) const { return paste->retrieveData(format, type); }
+ virtual QVariant retrieveData(const QString &format, QMetaType type) const { return paste->retrieveData(format, type); }
};
QMimeData
@@ -476,7 +476,7 @@ QMacPasteboard::hasFormat(const QString &format) const
}
QVariant
-QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
+QMacPasteboard::retrieveData(const QString &format, QMetaType) const
{
if (!paste)
return QVariant();
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm
index 2b9cffa714..d5e5a14835 100644
--- a/src/plugins/platforms/cocoa/qnsview_drawing.mm
+++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm
@@ -43,7 +43,13 @@
- (void)initDrawing
{
- [self updateLayerBacking];
+ if (qt_mac_resolveOption(-1, m_platformWindow->window(),
+ "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER") != -1) {
+ qCWarning(lcQpaDrawing) << "Layer-backing is always enabled."
+ << " QT_MAC_WANTS_LAYER/_q_mac_wantsLayer has no effect.";
+ }
+
+ self.wantsLayer = YES;
}
- (BOOL)isOpaque
@@ -60,40 +66,6 @@
// ----------------------- Layer setup -----------------------
-- (void)updateLayerBacking
-{
- self.wantsLayer = [self layerEnabledByMacOS]
- || [self layerExplicitlyRequested]
- || [self shouldUseMetalLayer];
-}
-
-- (BOOL)layerEnabledByMacOS
-{
- // AppKit has its own logic for this, but if we rely on that, our layers are created
- // by AppKit at a point where we've already set up other parts of the platform plugin
- // based on the presence of layers or not. Once we've rewritten these parts to support
- // dynamically picking up layer enablement we can let AppKit do its thing.
- return QMacVersion::buildSDK() >= QOperatingSystemVersion::MacOSMojave
- && QMacVersion::currentRuntime() >= QOperatingSystemVersion::MacOSMojave;
-}
-
-- (BOOL)layerExplicitlyRequested
-{
- static bool wantsLayer = [&]() {
- int wantsLayer = qt_mac_resolveOption(-1, m_platformWindow->window(),
- "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER");
-
- if (wantsLayer != -1 && [self layerEnabledByMacOS]) {
- qCWarning(lcQpaDrawing) << "Layer-backing cannot be explicitly controlled on 10.14 when built against the 10.14 SDK";
- return true;
- }
-
- return wantsLayer == 1;
- }();
-
- return wantsLayer;
-}
-
- (BOOL)shouldUseMetalLayer
{
// MetalSurface needs a layer, and so does VulkanSurface (via MoltenVK)
@@ -146,8 +118,7 @@
{
qCDebug(lcQpaDrawing) << "Making" << self
<< (self.wantsLayer ? "layer-backed" : "layer-hosted")
- << "with" << layer << "due to being" << ([self layerExplicitlyRequested] ? "explicitly requested"
- : [self shouldUseMetalLayer] ? "needed by surface type" : "enabled by macOS");
+ << "with" << layer;
if (layer.delegate && layer.delegate != self) {
qCWarning(lcQpaDrawing) << "Layer already has delegate" << layer.delegate
@@ -242,24 +213,9 @@
*/
- (void)drawRect:(NSRect)dirtyBoundingRect
{
+ Q_UNUSED(dirtyBoundingRect);
Q_ASSERT_X(!self.layer, "QNSView",
"The drawRect code path should not be hit when we are layer backed");
-
- if (!m_platformWindow)
- return;
-
- QRegion exposedRegion;
- const NSRect *dirtyRects;
- NSInteger numDirtyRects;
- [self getRectsBeingDrawn:&dirtyRects count:&numDirtyRects];
- for (int i = 0; i < numDirtyRects; ++i)
- exposedRegion += QRectF::fromCGRect(dirtyRects[i]).toRect();
-
- if (exposedRegion.isEmpty())
- exposedRegion = QRectF::fromCGRect(dirtyBoundingRect).toRect();
-
- qCDebug(lcQpaDrawing) << "[QNSView drawRect:]" << m_platformWindow->window() << exposedRegion;
- m_platformWindow->handleExposeEvent(exposedRegion);
}
/*
diff --git a/src/plugins/platforms/cocoa/qnsview_keys.mm b/src/plugins/platforms/cocoa/qnsview_keys.mm
index 37c46204e1..09d78485f4 100644
--- a/src/plugins/platforms/cocoa/qnsview_keys.mm
+++ b/src/plugins/platforms/cocoa/qnsview_keys.mm
@@ -53,11 +53,12 @@
m_inputSource = [characters retain];
}
- // There is no way to get the scan code from carbon/cocoa. But we cannot
- // use the value 0, since it indicates that the event originates from somewhere
- // else than the keyboard.
- quint32 nativeScanCode = 1;
- quint32 nativeVirtualKey = [nsevent keyCode];
+ // Scan codes are hardware dependent codes for each key. There is no way to get these
+ // from Carbon or Cocoa, so leave it 0, as documented in QKeyEvent::nativeScanCode().
+ const quint32 nativeScanCode = 0;
+
+ // Virtual keys on the other hand are mapped to be the same keys on any system
+ const quint32 nativeVirtualKey = nsevent.keyCode;
QChar ch = QChar::ReplacementCharacter;
int keyCode = Qt::Key_unknown;
@@ -192,14 +193,21 @@
- (void)flagsChanged:(NSEvent *)nsevent
{
ulong timestamp = [nsevent timestamp] * 1000;
- ulong modifiers = [nsevent modifierFlags];
- Qt::KeyboardModifiers qmodifiers = QCocoaKeyMapper::fromCocoaModifiers(modifiers);
+ ulong nativeModifiers = [nsevent modifierFlags];
+ Qt::KeyboardModifiers modifiers = QCocoaKeyMapper::fromCocoaModifiers(nativeModifiers);
+
+ // Scan codes are hardware dependent codes for each key. There is no way to get these
+ // from Carbon or Cocoa, so leave it 0, as documented in QKeyEvent::nativeScanCode().
+ const quint32 nativeScanCode = 0;
+
+ // Virtual keys on the other hand are mapped to be the same keys on any system
+ const quint32 nativeVirtualKey = nsevent.keyCode;
// calculate the delta and remember the current modifiers for next time
static ulong m_lastKnownModifiers;
ulong lastKnownModifiers = m_lastKnownModifiers;
- ulong delta = lastKnownModifiers ^ modifiers;
- m_lastKnownModifiers = modifiers;
+ ulong delta = lastKnownModifiers ^ nativeModifiers;
+ m_lastKnownModifiers = nativeModifiers;
struct qt_mac_enum_mapper
{
@@ -225,11 +233,14 @@
else if (qtCode == Qt::Key_Control)
qtCode = Qt::Key_Meta;
}
- QWindowSystemInterface::handleKeyEvent(m_platformWindow->window(),
- timestamp,
- (lastKnownModifiers & mac_mask) ? QEvent::KeyRelease : QEvent::KeyPress,
- qtCode,
- qmodifiers ^ QCocoaKeyMapper::fromCocoaModifiers(mac_mask));
+ QWindowSystemInterface::handleExtendedKeyEvent(m_platformWindow->window(),
+ timestamp,
+ (lastKnownModifiers & mac_mask) ? QEvent::KeyRelease
+ : QEvent::KeyPress,
+ qtCode,
+ modifiers ^ QCocoaKeyMapper::fromCocoaModifiers(mac_mask),
+ nativeScanCode, nativeVirtualKey,
+ nativeModifiers ^ mac_mask);
}
}
diff --git a/src/plugins/platforms/direct2d/CMakeLists.txt b/src/plugins/platforms/direct2d/CMakeLists.txt
new file mode 100644
index 0000000000..3d507af070
--- /dev/null
+++ b/src/plugins/platforms/direct2d/CMakeLists.txt
@@ -0,0 +1,283 @@
+# Generated from direct2d.pro.
+
+#####################################################################
+## QWindowsDirect2DIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWindowsDirect2DIntegrationPlugin
+ OUTPUT_NAME qdirect2d
+ TYPE platforms
+ SOURCES
+ ../windows/qtwindowsglobal.h
+ ../windows/qwin10helpers.cpp ../windows/qwin10helpers.h
+ ../windows/qwindowsapplication.cpp ../windows/qwindowsapplication.h
+ ../windows/qwindowscombase.h
+ ../windows/qwindowscontext.cpp ../windows/qwindowscontext.h
+ ../windows/qwindowscursor.cpp ../windows/qwindowscursor.h
+ ../windows/qwindowsdialoghelpers.cpp ../windows/qwindowsdialoghelpers.h
+ ../windows/qwindowsdropdataobject.cpp ../windows/qwindowsdropdataobject.h
+ ../windows/qwindowsinputcontext.cpp ../windows/qwindowsinputcontext.h
+ ../windows/qwindowsintegration.cpp ../windows/qwindowsintegration.h
+ ../windows/qwindowsinternalmimedata.cpp ../windows/qwindowsinternalmimedata.h
+ ../windows/qwindowskeymapper.cpp ../windows/qwindowskeymapper.h
+ ../windows/qwindowsmenu.cpp ../windows/qwindowsmenu.h
+ ../windows/qwindowsmime.cpp ../windows/qwindowsmime.h
+ ../windows/qwindowsmousehandler.cpp ../windows/qwindowsmousehandler.h
+ ../windows/qwindowsnativeinterface.cpp ../windows/qwindowsnativeinterface.h
+ ../windows/qwindowsole.cpp ../windows/qwindowsole.h
+ ../windows/qwindowsopengltester.cpp ../windows/qwindowsopengltester.h
+ ../windows/qwindowspointerhandler.cpp ../windows/qwindowspointerhandler.h
+ ../windows/qwindowsscreen.cpp ../windows/qwindowsscreen.h
+ ../windows/qwindowsservices.cpp ../windows/qwindowsservices.h
+ ../windows/qwindowstheme.cpp ../windows/qwindowstheme.h
+ ../windows/qwindowsthreadpoolrunner.h
+ ../windows/qwindowswindow.cpp ../windows/qwindowswindow.h
+ qwindowsdirect2dbackingstore.cpp qwindowsdirect2dbackingstore.h
+ qwindowsdirect2dbitmap.cpp qwindowsdirect2dbitmap.h
+ qwindowsdirect2dcontext.cpp qwindowsdirect2dcontext.h
+ qwindowsdirect2ddevicecontext.cpp qwindowsdirect2ddevicecontext.h
+ qwindowsdirect2dhelpers.h
+ qwindowsdirect2dintegration.cpp qwindowsdirect2dintegration.h
+ qwindowsdirect2dnativeinterface.cpp qwindowsdirect2dnativeinterface.h
+ qwindowsdirect2dpaintdevice.cpp qwindowsdirect2dpaintdevice.h
+ qwindowsdirect2dpaintengine.cpp qwindowsdirect2dpaintengine.h
+ qwindowsdirect2dplatformpixmap.cpp qwindowsdirect2dplatformpixmap.h
+ qwindowsdirect2dplatformplugin.cpp
+ qwindowsdirect2dwindow.cpp qwindowsdirect2dwindow.h
+ DEFINES
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_FOREACH
+ INCLUDE_DIRECTORIES
+ ../windows
+ LIBRARIES
+ advapi32
+ d2d1 # special case
+ dwrite # special case
+ gdi32
+ ole32
+ shell32
+ user32
+ winmm
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ d3d11
+ dwmapi
+ dxgi
+ dxguid
+ imm32
+ oleaut32
+ shlwapi
+ version
+ winspool
+ wtsapi32
+)
+
+# Resources:
+set_source_files_properties("../windows/openglblacklists/default.json"
+ PROPERTIES QT_RESOURCE_ALIAS "default.json"
+)
+set(openglblacklists_resource_files
+ "openglblacklists/default.json"
+)
+
+qt_internal_add_resource(QWindowsDirect2DIntegrationPlugin "openglblacklists"
+ PREFIX
+ "/qt-project.org/windows/openglblacklists"
+ BASE
+ "../windows"
+ FILES
+ ${openglblacklists_resource_files}
+)
+
+#### Keys ignored in scope 1:.:.:direct2d.pro:<TRUE>:
+# OTHER_FILES = "direct2d.json"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:direct2d.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
+# PLUGIN_EXTENDS = "-"
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
+ PUBLIC_LIBRARIES
+ opengl32
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION MINGW
+ PUBLIC_LIBRARIES
+ uuid
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_opengl
+ SOURCES
+ ../windows/qwindowsglcontext.cpp ../windows/qwindowsglcontext.h
+ ../windows/qwindowsopenglcontext.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
+ SOURCES
+ ../windows/qwindowssystemtrayicon.cpp ../windows/qwindowssystemtrayicon.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_vulkan
+ SOURCES
+ ../windows/qwindowsvulkaninstance.cpp ../windows/qwindowsvulkaninstance.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_clipboard
+ SOURCES
+ ../windows/qwindowsclipboard.cpp ../windows/qwindowsclipboard.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
+ SOURCES
+ ../windows/qwindowsdrag.cpp ../windows/qwindowsdrag.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_tabletevent
+ SOURCES
+ ../windows/qwindowstabletsupport.cpp ../windows/qwindowstabletsupport.h
+ INCLUDE_DIRECTORIES
+ ${QT_SOURCE_TREE}/src/3rdparty/wintab
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+ SOURCES
+ ../windows/qwindowssessionmanager.cpp ../windows/qwindowssessionmanager.h
+)
+
+if(QT_FEATURE_imageformat_png)
+ # Resources:
+ set_source_files_properties("../windows/images/closedhandcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedhandcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/closedhandcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedhandcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/closedhandcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedhandcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/dragcopycursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragcopycursor_32.png"
+ )
+ set_source_files_properties("../windows/images/dragcopycursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragcopycursor_48.png"
+ )
+ set_source_files_properties("../windows/images/dragcopycursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragcopycursor_64.png"
+ )
+ set_source_files_properties("../windows/images/draglinkcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/draglinkcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/draglinkcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/draglinkcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/draglinkcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/draglinkcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/dragmovecursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragmovecursor_32.png"
+ )
+ set_source_files_properties("../windows/images/dragmovecursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragmovecursor_48.png"
+ )
+ set_source_files_properties("../windows/images/dragmovecursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragmovecursor_64.png"
+ )
+ set_source_files_properties("../windows/images/openhandcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/openhandcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/openhandcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/openhandcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/openhandcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/openhandcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/splithcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splithcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/splithcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splithcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/splithcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splithcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/splitvcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splitvcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/splitvcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splitvcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/splitvcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splitvcursor_64.png"
+ )
+ set(cursors_resource_files
+ "images/closedhandcursor_32.png"
+ "images/closedhandcursor_48.png"
+ "images/closedhandcursor_64.png"
+ "images/dragcopycursor_32.png"
+ "images/dragcopycursor_48.png"
+ "images/dragcopycursor_64.png"
+ "images/draglinkcursor_32.png"
+ "images/draglinkcursor_48.png"
+ "images/draglinkcursor_64.png"
+ "images/dragmovecursor_32.png"
+ "images/dragmovecursor_48.png"
+ "images/dragmovecursor_64.png"
+ "images/openhandcursor_32.png"
+ "images/openhandcursor_48.png"
+ "images/openhandcursor_64.png"
+ "images/splithcursor_32.png"
+ "images/splithcursor_48.png"
+ "images/splithcursor_64.png"
+ "images/splitvcursor_32.png"
+ "images/splitvcursor_48.png"
+ "images/splitvcursor_64.png"
+ )
+
+ qt_internal_add_resource(QWindowsDirect2DIntegrationPlugin "cursors"
+ PREFIX
+ "/qt-project.org/windows/cursors"
+ BASE
+ "../windows"
+ FILES
+ ${cursors_resource_files}
+ )
+endif()
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_accessibility
+ SOURCES
+ ../windows/uiautomation/qwindowsuiaaccessibility.cpp ../windows/uiautomation/qwindowsuiaaccessibility.h
+ ../windows/uiautomation/qwindowsuiabaseprovider.cpp ../windows/uiautomation/qwindowsuiabaseprovider.h
+ ../windows/uiautomation/qwindowsuiaexpandcollapseprovider.cpp ../windows/uiautomation/qwindowsuiaexpandcollapseprovider.h
+ ../windows/uiautomation/qwindowsuiagriditemprovider.cpp ../windows/uiautomation/qwindowsuiagriditemprovider.h
+ ../windows/uiautomation/qwindowsuiagridprovider.cpp ../windows/uiautomation/qwindowsuiagridprovider.h
+ ../windows/uiautomation/qwindowsuiainvokeprovider.cpp ../windows/uiautomation/qwindowsuiainvokeprovider.h
+ ../windows/uiautomation/qwindowsuiamainprovider.cpp ../windows/uiautomation/qwindowsuiamainprovider.h
+ ../windows/uiautomation/qwindowsuiaprovidercache.cpp ../windows/uiautomation/qwindowsuiaprovidercache.h
+ ../windows/uiautomation/qwindowsuiarangevalueprovider.cpp ../windows/uiautomation/qwindowsuiarangevalueprovider.h
+ ../windows/uiautomation/qwindowsuiaselectionitemprovider.cpp ../windows/uiautomation/qwindowsuiaselectionitemprovider.h
+ ../windows/uiautomation/qwindowsuiaselectionprovider.cpp ../windows/uiautomation/qwindowsuiaselectionprovider.h
+ ../windows/uiautomation/qwindowsuiatableitemprovider.cpp ../windows/uiautomation/qwindowsuiatableitemprovider.h
+ ../windows/uiautomation/qwindowsuiatableprovider.cpp ../windows/uiautomation/qwindowsuiatableprovider.h
+ ../windows/uiautomation/qwindowsuiatextprovider.cpp ../windows/uiautomation/qwindowsuiatextprovider.h
+ ../windows/uiautomation/qwindowsuiatextrangeprovider.cpp ../windows/uiautomation/qwindowsuiatextrangeprovider.h
+ ../windows/uiautomation/qwindowsuiatoggleprovider.cpp ../windows/uiautomation/qwindowsuiatoggleprovider.h
+ ../windows/uiautomation/qwindowsuiautils.cpp ../windows/uiautomation/qwindowsuiautils.h
+ ../windows/uiautomation/qwindowsuiavalueprovider.cpp ../windows/uiautomation/qwindowsuiavalueprovider.h
+ ../windows/uiautomation/qwindowsuiawindowprovider.cpp ../windows/uiautomation/qwindowsuiawindowprovider.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
+ PUBLIC_LIBRARIES
+ uuid
+)
+
+# begin special case
+if (MINGW)
+ set_source_files_properties(../windows/qwindowspointerhandler.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+endif()
+# end special case
diff --git a/src/plugins/platforms/directfb/.prev_CMakeLists.txt b/src/plugins/platforms/directfb/.prev_CMakeLists.txt
index c6957d57ec..074c9eff3f 100644
--- a/src/plugins/platforms/directfb/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/directfb/.prev_CMakeLists.txt
@@ -32,14 +32,14 @@ qt_internal_add_plugin(QDirectFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
SOURCES
qdirectfb_egl.cpp qdirectfb_egl.h
DEFINES
DIRECTFB_GL_EGL
)
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
DEFINES
DIRECTFB_PLATFORM_HOOKS
)
@@ -47,7 +47,7 @@ qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOK
#### Keys ignored in scope 3:.:.:directfb.pro:NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY:
# QMAKE_LIBDIR = "$$DIRECTFB_PLATFORM_HOOKS_LIBDIR"
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
SOURCES
qdirectfbeglhooks_stub.cpp
)
diff --git a/src/plugins/platforms/directfb/CMakeLists.txt b/src/plugins/platforms/directfb/CMakeLists.txt
index 5e4a2f2baa..c66d8bd169 100644
--- a/src/plugins/platforms/directfb/CMakeLists.txt
+++ b/src/plugins/platforms/directfb/CMakeLists.txt
@@ -38,14 +38,14 @@ qt_internal_add_plugin(QDirectFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
SOURCES
qdirectfb_egl.cpp qdirectfb_egl.h
DEFINES
DIRECTFB_GL_EGL
)
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
DEFINES
DIRECTFB_PLATFORM_HOOKS
)
@@ -53,7 +53,7 @@ qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOK
#### Keys ignored in scope 3:.:.:directfb.pro:NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY:
# QMAKE_LIBDIR = "$$DIRECTFB_PLATFORM_HOOKS_LIBDIR"
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
SOURCES
qdirectfbeglhooks_stub.cpp
)
diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp
index de84827777..85e7f08917 100644
--- a/src/plugins/platforms/directfb/main.cpp
+++ b/src/plugins/platforms/directfb/main.cpp
@@ -64,7 +64,7 @@ public:
QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- QDirectFbIntegration *integration = 0;
+ QDirectFbIntegration *integration = nullptr;
if (!system.compare(QLatin1String("directfb"), Qt::CaseInsensitive))
integration = new QDirectFbIntegration;
diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
index 95e6093fab..f38ad8f306 100644
--- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp
+++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
extern QDirectFBEGLHooks platform_hook;
static QDirectFBEGLHooks *hooks = &platform_hook;
#else
-static QDirectFBEGLHooks *hooks = 0;
+static QDirectFBEGLHooks *hooks = nullptr;
#endif
/**
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
index f3e8282101..460596a18c 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
IDirectFB *QDirectFbConvenience::dfbInterface()
{
- static IDirectFB *dfb = 0;
+ static IDirectFB *dfb = nullptr;
if (!dfb) {
DFBResult result = DirectFBCreate(&dfb);
if (result != DFB_OK) {
@@ -136,7 +136,7 @@ Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier
case DIBI_RIGHT: // value is 0x01
return Qt::RightButton;
case DIBI_MIDDLE: // value is 0x02
- return Qt::MidButton;
+ return Qt::MiddleButton;
case 0x03:
return Qt::BackButton;
case 0x04:
@@ -198,7 +198,7 @@ Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mas
buttons |= Qt::LeftButton;
}
if (mask & DIBM_MIDDLE) {
- buttons |= Qt::MidButton;
+ buttons |= Qt::MiddleButton;
}
if (mask & DIBM_RIGHT) {
buttons |= Qt::RightButton;
@@ -247,7 +247,7 @@ QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type)
return QEvent::None;
}
}
-QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0;
+QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = nullptr;
QDirectFbKeyMap *QDirectFbConvenience::keyMap()
{
if (!dfbKeymap)
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h
index 19fc068307..dd10f6bc85 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.h
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h
@@ -98,13 +98,13 @@ template <typename T>
class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >
{
public:
- QDirectFBPointer(T *t = 0)
+ QDirectFBPointer(T *t = nullptr)
: QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >(t)
{}
T** outPtr()
{
- this->reset(0);
+ this->reset(nullptr);
return &this->d;
}
};
diff --git a/src/plugins/platforms/eglfs/.prev_CMakeLists.txt b/src/plugins/platforms/eglfs/.prev_CMakeLists.txt
index 2fbaf4d018..cd1acc22e2 100644
--- a/src/plugins/platforms/eglfs/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/.prev_CMakeLists.txt
@@ -4,7 +4,7 @@
## EglFSDeviceIntegration Module:
#####################################################################
-qt_add_module(EglFSDeviceIntegration
+qt_internal_add_module(EglFSDeviceIntegration
INTERNAL_MODULE
SOURCES
api/qeglfsdeviceintegration.cpp api/qeglfsdeviceintegration_p.h
@@ -32,12 +32,12 @@ qt_add_module(EglFSDeviceIntegration
## Scopes:
#####################################################################
-qt_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
SOURCES
api/qeglfscontext.cpp api/qeglfscontext_p.h
api/qeglfscursor.cpp api/qeglfscursor_p.h
@@ -45,12 +45,12 @@ qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
Qt::OpenGLPrivate
)
-qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
DEFINES
EGLFS_PLATFORM_HOOKS
)
-qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
DEFINES
EGLFS_PREFERRED_PLUGIN=
)
@@ -62,7 +62,7 @@ if(QT_FEATURE_cursor)
"cursor.json"
)
- qt_add_resource(EglFSDeviceIntegration "cursor"
+ qt_internal_add_resource(EglFSDeviceIntegration "cursor"
PREFIX
"/"
FILES
@@ -70,7 +70,7 @@ if(QT_FEATURE_cursor)
)
endif()
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
SOURCES
api/vulkan/qeglfsvulkaninstance.cpp api/vulkan/qeglfsvulkaninstance_p.h
api/vulkan/qeglfsvulkanwindow.cpp api/vulkan/qeglfsvulkanwindow_p.h
diff --git a/src/plugins/platforms/eglfs/CMakeLists.txt b/src/plugins/platforms/eglfs/CMakeLists.txt
index f74a15f9e6..81b53ee234 100644
--- a/src/plugins/platforms/eglfs/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/CMakeLists.txt
@@ -1,11 +1,25 @@
# Generated from eglfs.pro.
-qt_find_package(EGL) # special case
+# special case begin
+qt_find_package(EGL)
+
+if(QT_FEATURE_eglfs_gbm)
+ set(_device_integration "eglfs_kms")
+elseif(QT_FEATURE_eglfs_egldevice)
+ set(_device_integration "eglfs_kms_egldevice")
+elseif(QT_FEATURE_eglfs_viv)
+ set(_device_integration "eglfs_viv")
+elseif(QT_FEATURE_eglfs_brcm)
+ set(_device_integration "eglfs_brcm")
+endif()
+
+set(QT_QPA_DEFAULT_EGLFS_INTEGRATION "${_device_integration}" CACHE STRING "Default EGLFS device integration plugin")
+# special case end
#####################################################################
## EglFSDeviceIntegration Module:
#####################################################################
-qt_add_module(EglFSDeviceIntegration
+qt_internal_add_module(EglFSDeviceIntegration
INTERNAL_MODULE
SOURCES
api/qeglfsdeviceintegration.cpp api/qeglfsdeviceintegration_p.h
@@ -18,6 +32,7 @@ qt_add_module(EglFSDeviceIntegration
DEFINES
QT_BUILD_EGL_DEVICE_LIB
QT_EGL_NO_X11
+ EGLFS_PREFERRED_PLUGIN=${QT_QPA_DEFAULT_EGLFS_INTEGRATION} # special case
INCLUDE_DIRECTORIES
api
PUBLIC_LIBRARIES
@@ -34,12 +49,12 @@ qt_add_module(EglFSDeviceIntegration
## Scopes:
#####################################################################
-qt_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
SOURCES
api/qeglfscontext.cpp api/qeglfscontext_p.h
api/qeglfscursor.cpp api/qeglfscursor_p.h
@@ -49,12 +64,12 @@ qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
# special case begin
# comment out
-#qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
+#qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
#DEFINES
#EGLFS_PLATFORM_HOOKS
#)
-#qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
+#qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
#DEFINES
#EGLFS_PREFERRED_PLUGIN=
#)
@@ -67,7 +82,7 @@ if(QT_FEATURE_cursor)
"cursor.json"
)
- qt_add_resource(EglFSDeviceIntegration "cursor"
+ qt_internal_add_resource(EglFSDeviceIntegration "cursor"
PREFIX
"/"
FILES
@@ -75,7 +90,7 @@ if(QT_FEATURE_cursor)
)
endif()
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
SOURCES
api/vulkan/qeglfsvulkaninstance.cpp api/vulkan/qeglfsvulkaninstance_p.h
api/vulkan/qeglfsvulkanwindow.cpp api/vulkan/qeglfsvulkanwindow_p.h
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 4b5a3c8c70..3ef30f1fa9 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -224,19 +224,12 @@ QSize QEglFSDeviceIntegration::screenSize() const
QDpi QEglFSDeviceIntegration::logicalDpi() const
{
- const QSizeF ps = physicalScreenSize();
- const QSize s = screenSize();
-
- if (!ps.isEmpty() && !s.isEmpty())
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
- else
- return QDpi(100, 100);
+ return QDpi(100, 100);
}
-qreal QEglFSDeviceIntegration::pixelDensity() const
+QDpi QEglFSDeviceIntegration::logicalBaseDpi() const
{
- return qMax(1, qRound(logicalDpi().first / qreal(100)));
+ return QDpi(100, 100);
}
Qt::ScreenOrientation QEglFSDeviceIntegration::nativeOrientation() const
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
index 08447a40ea..29efb75137 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
@@ -80,7 +80,7 @@ public:
virtual QSizeF physicalScreenSize() const;
virtual QSize screenSize() const;
virtual QDpi logicalDpi() const;
- virtual qreal pixelDensity() const;
+ virtual QDpi logicalBaseDpi() const;
virtual Qt::ScreenOrientation nativeOrientation() const;
virtual Qt::ScreenOrientation orientation() const;
virtual int screenDepth() const;
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
index 9bc24f36f9..5ba24b107a 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
@@ -70,10 +70,10 @@ class QEvdevKeyboardManager;
class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
#if QT_CONFIG(evdev)
- , public QPlatformInterface::Private::QEvdevKeyMapper
+ , public QNativeInterface::Private::QEvdevKeyMapper
#endif
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QEGLIntegration
+ , public QNativeInterface::Private::QEGLIntegration
#endif
{
public:
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
index 81f2e07f6b..0b133c55a7 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
@@ -115,9 +115,9 @@ QDpi QEglFSScreen::logicalDpi() const
return qt_egl_device_integration()->logicalDpi();
}
-qreal QEglFSScreen::pixelDensity() const
+QDpi QEglFSScreen::logicalBaseDpi() const
{
- return qt_egl_device_integration()->pixelDensity();
+ return qt_egl_device_integration()->logicalBaseDpi();
}
Qt::ScreenOrientation QEglFSScreen::nativeOrientation() const
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
index cf4a7afc33..c749beb388 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
@@ -74,7 +74,7 @@ public:
QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
- qreal pixelDensity() const override;
+ QDpi logicalBaseDpi() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt
index 7ddcb8993f..827bb51fd3 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt
@@ -22,13 +22,13 @@ if(QT_FEATURE_eglfs_mali)
# add_subdirectory(eglfs_mali) # special case TODO
endif()
if(QT_FEATURE_eglfs_viv)
- # add_subdirectory(eglfs_viv) # special case TODO
+ add_subdirectory(eglfs_viv)
endif()
if(QT_FEATURE_eglfs_rcar)
# add_subdirectory(eglfs_rcar) # special case TODO
endif()
if(QT_FEATURE_eglfs_viv_wl)
- # add_subdirectory(eglfs_viv_wl) # special case TODO
+ add_subdirectory(eglfs_viv_wl)
endif()
if(QT_FEATURE_eglfs_openwfd)
# add_subdirectory(eglfs_openwfd) # special case TODO
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp
index 7654034f85..697d92a5ca 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp
@@ -75,19 +75,12 @@ QSizeF QEglFSEmulatorScreen::physicalSize() const
QDpi QEglFSEmulatorScreen::logicalDpi() const
{
- const QSizeF ps = m_physicalSize;
- const QSize s = m_geometry.size();
-
- if (!ps.isEmpty() && !s.isEmpty())
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
- else
- return QDpi(100, 100);
+ return logicalBaseDpi();
}
-qreal QEglFSEmulatorScreen::pixelDensity() const
+QDpi QEglFSEmulatorScreen::logicalBaseDpi() const
{
- return m_pixelDensity;
+ return QDpi(100, 100);
}
qreal QEglFSEmulatorScreen::refreshRate() const
@@ -163,9 +156,6 @@ void QEglFSEmulatorScreen::initFromJsonObject(const QJsonObject &description)
m_physicalSize.setHeight(value.toInt());
}
- value = description.value(QLatin1String("pixelDensity"));
- if (!value.isUndefined() && value.isDouble())
- m_pixelDensity = value.toDouble();
value = description.value(QLatin1String("refreshRate"));
if (!value.isUndefined() && value.isDouble())
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h
index c4994720fa..c1d92bf44d 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h
@@ -58,7 +58,7 @@ public:
QImage::Format format() const override;
QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
- qreal pixelDensity() const override;
+ QDpi logicalBaseDpi() const override;
qreal refreshRate() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;
@@ -74,7 +74,6 @@ private:
int m_depth;
QImage::Format m_format;
QSizeF m_physicalSize;
- float m_pixelDensity;
float m_refreshRate;
Qt::ScreenOrientation m_nativeOrientation;
Qt::ScreenOrientation m_orientation;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..6f1d5f6751
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt
@@ -0,0 +1,32 @@
+# Generated from eglfs_kms_egldevice.pro.
+
+#####################################################################
+## QEglFSKmsEglDeviceIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QEglFSKmsEglDeviceIntegrationPlugin
+ OUTPUT_NAME qeglfs-kms-egldevice-integration
+ TYPE egldeviceintegrations
+ SOURCES
+ qeglfskmsegldevice.cpp qeglfskmsegldevice.h
+ qeglfskmsegldeviceintegration.cpp qeglfskmsegldeviceintegration.h
+ qeglfskmsegldevicemain.cpp
+ qeglfskmsegldevicescreen.cpp qeglfskmsegldevicescreen.h
+ DEFINES
+ QT_EGL_NO_X11
+ INCLUDE_DIRECTORIES
+ ../../api
+ ../eglfs_kms_support
+ PUBLIC_LIBRARIES
+ Libdrm::Libdrm
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::EglFsKmsSupportPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::KmsSupportPrivate
+)
+
+#### Keys ignored in scope 1:.:.:eglfs_kms_egldevice.pro:<TRUE>:
+# OTHER_FILES = "$$PWD/eglfs_kms_egldevice.json"
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt
index 6f1d5f6751..61b5470cdf 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt
@@ -30,3 +30,10 @@ qt_internal_add_plugin(QEglFSKmsEglDeviceIntegrationPlugin
#### Keys ignored in scope 1:.:.:eglfs_kms_egldevice.pro:<TRUE>:
# OTHER_FILES = "$$PWD/eglfs_kms_egldevice.json"
+
+# begin special case
+qt_internal_extend_target(QEglFSKmsEglDeviceIntegrationPlugin
+ CONDITION QNX
+ COMPILE_OPTIONS -fpermissive
+)
+# end special case
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..3d600c52f1
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt
@@ -0,0 +1,28 @@
+# Generated from eglfs_kms_support.pro.
+
+#####################################################################
+## EglFsKmsSupport Module:
+#####################################################################
+
+qt_internal_add_module(EglFsKmsSupport
+ INTERNAL_MODULE
+ NO_MODULE_HEADERS
+ SOURCES
+ qeglfskmsdevice.cpp qeglfskmsdevice.h
+ qeglfskmseventreader.cpp qeglfskmseventreader.h
+ qeglfskmshelpers.h
+ qeglfskmsintegration.cpp qeglfskmsintegration.h
+ qeglfskmsscreen.cpp qeglfskmsscreen.h
+ DEFINES
+ QT_EGL_NO_X11
+ INCLUDE_DIRECTORIES
+ ../../api
+ PUBLIC_LIBRARIES
+ Libdrm::Libdrm
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::KmsSupportPrivate
+)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt
index ec11b355af..d71f1407f8 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt
@@ -4,7 +4,7 @@
## EglFsKmsSupport Module:
#####################################################################
-qt_add_module(EglFsKmsSupport
+qt_internal_add_module(EglFsKmsSupport
INTERNAL_MODULE
NO_MODULE_HEADERS
SOURCES
@@ -26,3 +26,10 @@ qt_add_module(EglFsKmsSupport
Qt::GuiPrivate
Qt::KmsSupportPrivate
)
+
+# begin special case
+qt_internal_extend_target(EglFsKmsSupport
+ CONDITION QNX
+ COMPILE_OPTIONS -fpermissive
+)
+# end special case
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
index 59d7ec104c..ad8479d9ad 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
@@ -160,14 +160,12 @@ QSizeF QEglFSKmsScreen::physicalSize() const
QDpi QEglFSKmsScreen::logicalDpi() const
{
- const QSizeF ps = physicalSize();
- const QSize s = geometry().size();
-
- if (!ps.isEmpty() && !s.isEmpty())
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
- else
- return QDpi(100, 100);
+ return logicalBaseDpi();
+}
+
+QDpi QEglFSKmsScreen::logicalBaseDpi() const
+{
+ return QDpi(100, 100);
}
Qt::ScreenOrientation QEglFSKmsScreen::nativeOrientation() const
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
index 103476bc54..9f21a9e54b 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
@@ -69,6 +69,7 @@ public:
QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
+ QDpi logicalBaseDpi() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h
index 369d175bcf..b3dfa77e1b 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h
@@ -53,7 +53,7 @@
QT_BEGIN_NAMESPACE
class QEglFSKmsVsp2Screen : public QEglFSKmsScreen
- , public QPlatformInterface::Private::QVsp2Screen
+ , public QNativeInterface::Private::QVsp2Screen
{
public:
QEglFSKmsVsp2Screen(QEglFSKmsDevice *device, const QKmsOutput &output);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt
new file mode 100644
index 0000000000..72952c6c5d
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Generated from eglfs_viv.pro.
+
+#####################################################################
+## QEglFSVivIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QEglFSVivIntegrationPlugin
+ OUTPUT_NAME qeglfs-viv-integration
+ TYPE egldeviceintegrations
+ SOURCES
+ qeglfsvivintegration.cpp qeglfsvivintegration.h
+ qeglfsvivmain.cpp
+ DEFINES
+ EGL_API_FB=1
+ LINUX=1
+ INCLUDE_DIRECTORIES
+ ../../api
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+)
+
+#### Keys ignored in scope 1:.:.:eglfs_viv.pro:<TRUE>:
+# OTHER_FILES = "$$PWD/eglfs_viv.json"
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt
new file mode 100644
index 0000000000..269bdde02c
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Generated from eglfs_viv_wl.pro.
+
+#####################################################################
+## QEglFSVivWaylandIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QEglFSVivWaylandIntegrationPlugin
+ OUTPUT_NAME qeglfs-viv-wl-integration
+ TYPE egldeviceintegrations
+ SOURCES
+ qeglfsvivwlintegration.cpp qeglfsvivwlintegration.h
+ qeglfsvivwlmain.cpp
+ DEFINES
+ EGL_API_FB=1
+ LINUX=1
+ INCLUDE_DIRECTORIES
+ ../../api
+ LIBRARIES
+ Wayland::Server
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+)
+
+#### Keys ignored in scope 1:.:.:eglfs_viv_wl.pro:<TRUE>:
+# OTHER_FILES = "$$PWD/eglfs_viv_wl.json"
diff --git a/src/plugins/platforms/integrity/qintegrityhidmanager.h b/src/plugins/platforms/integrity/qintegrityhidmanager.h
index c8780b2dc2..1e421328c2 100644
--- a/src/plugins/platforms/integrity/qintegrityhidmanager.h
+++ b/src/plugins/platforms/integrity/qintegrityhidmanager.h
@@ -52,7 +52,7 @@ class QIntegrityHIDManager : public QThread
{
Q_OBJECT
public:
- QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = 0);
+ QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = nullptr);
~QIntegrityHIDManager();
void run(void);
diff --git a/src/plugins/platforms/ios/.prev_CMakeLists.txt b/src/plugins/platforms/ios/.prev_CMakeLists.txt
index 138f323878..2e494c7d23 100644
--- a/src/plugins/platforms/ios/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/ios/.prev_CMakeLists.txt
@@ -42,12 +42,12 @@ qt_internal_add_plugin(QIOSIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
SOURCES
qiosclipboard.h qiosclipboard.mm
qiosdocumentpickercontroller.h qiosdocumentpickercontroller.mm
diff --git a/src/plugins/platforms/ios/CMakeLists.txt b/src/plugins/platforms/ios/CMakeLists.txt
index 995dcc0a9d..e238cf70fa 100644
--- a/src/plugins/platforms/ios/CMakeLists.txt
+++ b/src/plugins/platforms/ios/CMakeLists.txt
@@ -45,12 +45,12 @@ qt_disable_apple_app_extension_api_only(QIOSIntegrationPlugin)
## Scopes:
#####################################################################
-qt_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
SOURCES
qiosclipboard.h qiosclipboard.mm
qiosdocumentpickercontroller.h qiosdocumentpickercontroller.mm
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt
index 526a053b02..1176e34935 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt
@@ -21,6 +21,14 @@ qt_internal_add_plugin(QIosOptionalPlugin_NSPhotoLibrary
Qt::GuiPrivate
)
+# special case begin
+set_target_properties(QIosOptionalPlugin_NSPhotoLibrary
+ PROPERTIES
+ DISABLE_PRECOMPILE_HEADERS ON
+)
+# special case end
+
+
#### Keys ignored in scope 1:.:.:nsphotolibrarysupport.pro:<TRUE>:
# OTHER_FILES = "plugin.json"
# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm
index 8b372b8749..2a3d8c603e 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm
@@ -52,7 +52,7 @@ class QIosOptionalPlugin_NSPhotoLibrary : public QObject, QIosOptionalPluginInte
Q_INTERFACES(QIosOptionalPluginInterface)
public:
- explicit QIosOptionalPlugin_NSPhotoLibrary(QObject* = 0) {};
+ explicit QIosOptionalPlugin_NSPhotoLibrary(QObject * = nullptr) {};
~QIosOptionalPlugin_NSPhotoLibrary() {}
UIViewController* createImagePickerController(QIOSFileDialog *fileDialog) const override
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
index c5244a51ad..01524a00e8 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
@@ -54,7 +54,7 @@ static QThreadStorage<QString> g_iteratorCurrentUrl;
static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache;
static const int kBufferSize = 10;
-static ALAsset *kNoAsset = 0;
+static ALAsset *kNoAsset = nullptr;
static bool ensureAuthorizationDialogNotBlocked()
{
@@ -366,7 +366,7 @@ bool QIOSFileEngineAssetsLibrary::close()
// Delete later, so that we can reuse the asset if a QFile is
// opened with the same path during the same event loop cycle.
m_data->deleteLater();
- m_data = 0;
+ m_data = nullptr;
}
return true;
}
@@ -410,7 +410,7 @@ qint64 QIOSFileEngineAssetsLibrary::read(char *data, qint64 maxlen)
if (!bytesRead)
return 0;
- NSError *error = 0;
+ NSError *error = nullptr;
[[asset defaultRepresentation] getBytes:(uint8_t *)data fromOffset:m_offset length:bytesRead error:&error];
if (error) {
diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm
index 236ca843d8..dc441c7194 100644
--- a/src/plugins/platforms/ios/qiosclipboard.mm
+++ b/src/plugins/platforms/ios/qiosclipboard.mm
@@ -138,7 +138,7 @@ public:
~QIOSMimeData() { }
QStringList formats() const override;
- QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
+ QVariant retrieveData(const QString &mimeType, QMetaType type) const override;
private:
const QClipboard::Mode m_mode;
@@ -160,7 +160,7 @@ QStringList QIOSMimeData::formats() const
return foundMimeTypes;
}
-QVariant QIOSMimeData::retrieveData(const QString &mimeType, QVariant::Type) const
+QVariant QIOSMimeData::retrieveData(const QString &mimeType, QMetaType) const
{
UIPasteboard *pb = [UIPasteboard pasteboardWithQClipboardMode:m_mode];
NSArray<NSString *> *pasteboardTypes = [pb pasteboardTypes];
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h
index 1f4c78dc74..cdbaa0931d 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.h
+++ b/src/plugins/platforms/ios/qioseventdispatcher.h
@@ -53,7 +53,7 @@ public:
bool processPostedEvents() override;
protected:
- explicit QIOSEventDispatcher(QObject *parent = 0);
+ explicit QIOSEventDispatcher(QObject *parent = nullptr);
};
class QIOSJumpingEventDispatcher : public QIOSEventDispatcher
@@ -61,7 +61,7 @@ class QIOSJumpingEventDispatcher : public QIOSEventDispatcher
Q_OBJECT
public:
- QIOSJumpingEventDispatcher(QObject *parent = 0);
+ QIOSJumpingEventDispatcher(QObject *parent = nullptr);
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
// Public since we can't friend Objective-C methods
@@ -76,4 +76,4 @@ private:
QT_END_NAMESPACE
-#endif // QIOSEVENTDISPATCHER_H \ No newline at end of file
+#endif // QIOSEVENTDISPATCHER_H
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index c5856051de..23aac6ad46 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -473,7 +473,8 @@ bool QIOSEventDispatcher::processPostedEvents()
return false;
QT_APPLE_SCOPED_LOG_ACTIVITY(lcEventDispatcher().isDebugEnabled(), "sendWindowSystemEvents");
- QEventLoop::ProcessEventsFlags flags = QEventLoop::ProcessEventsFlags(m_processEvents.flags.load());
+ QEventLoop::ProcessEventsFlags flags
+ = QEventLoop::ProcessEventsFlags(m_processEvents.flags.loadRelaxed());
qCDebug(lcEventDispatcher) << "Sending window system events for" << flags;
QWindowSystemInterface::sendWindowSystemEvents(flags);
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index a523d1be45..c0428dacb9 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -185,7 +185,7 @@ FirstResponderCandidate::FirstResponderCandidate(UIResponder *responder)
{
}
-UIResponder *FirstResponderCandidate::s_firstResponderCandidate = 0;
+UIResponder *FirstResponderCandidate::s_firstResponderCandidate = nullptr;
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h
index debdf7a638..36421a57c3 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.h
+++ b/src/plugins/platforms/ios/qiosinputcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -76,10 +76,10 @@ struct KeyboardState
struct ImeState
{
- ImeState() : currentState(0), focusObject(0) {}
+ ImeState() = default;
Qt::InputMethodQueries update(Qt::InputMethodQueries properties);
- QInputMethodQueryEvent currentState;
- QObject *focusObject;
+ QInputMethodQueryEvent currentState = QInputMethodQueryEvent({});
+ QObject *focusObject = nullptr;
};
class QIOSInputContext : public QPlatformInputContext
@@ -111,7 +111,7 @@ public:
void scrollToCursor();
void scroll(int y);
- void updateKeyboardState(NSNotification *notification = 0);
+ void updateKeyboardState(NSNotification *notification = nullptr);
const ImeState &imeState() { return m_imeState; }
const KeyboardState &keyboardState() { return m_keyboardState; }
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index d2229df133..0eb12498b4 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -297,7 +297,7 @@ QT_BEGIN_NAMESPACE
Qt::InputMethodQueries ImeState::update(Qt::InputMethodQueries properties)
{
if (!properties)
- return 0;
+ return {};
QInputMethodQueryEvent newState(properties);
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 74a77de757..737d7798ab 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -54,7 +54,7 @@
// m_currentMenu points to the currently visible menu.
// Only one menu will be visible at a time, and if a second menu
// is shown on top of a first, the first one will be told to hide.
-QIOSMenu *QIOSMenu::m_currentMenu = 0;
+QIOSMenu *QIOSMenu::m_currentMenu = nullptr;
// -------------------------------------------------------------------------
@@ -441,7 +441,7 @@ void QIOSMenu::dismiss()
break;
}
- m_currentMenu = 0;
+ m_currentMenu = nullptr;
m_visible = false;
}
@@ -458,13 +458,13 @@ void QIOSMenu::toggleShowUsingUIMenuController(bool show)
Q_ASSERT(m_menuController);
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES];
[m_menuController release];
- m_menuController = 0;
+ m_menuController = nullptr;
}
}
void QIOSMenu::toggleShowUsingUIPickerView(bool show)
{
- static QObject *focusObjectWithPickerView = 0;
+ static QObject *focusObjectWithPickerView = nullptr;
if (show) {
Q_ASSERT(!m_pickerView);
@@ -477,12 +477,12 @@ void QIOSMenu::toggleShowUsingUIPickerView(bool show)
} else {
Q_ASSERT(focusObjectWithPickerView);
focusObjectWithPickerView->removeEventFilter(this);
- focusObjectWithPickerView = 0;
+ focusObjectWithPickerView = nullptr;
Q_ASSERT(m_pickerView);
[m_pickerView listenForKeyboardWillHideNotification:NO];
[m_pickerView release];
- m_pickerView = 0;
+ m_pickerView = nullptr;
qApp->inputMethod()->update(Qt::ImEnabled | Qt::ImPlatformData);
}
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index 80636ab9c6..c7dbe43124 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -213,10 +213,12 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
{
[super traitCollectionDidChange:previousTraitCollection];
- if (self.screen == UIScreen.mainScreen) {
- if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) {
- QIOSTheme::initializeSystemPalette();
- QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>(nullptr);
+ if (@available(iOS 12, *)) {
+ if (self.screen == UIScreen.mainScreen) {
+ if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) {
+ QIOSTheme::initializeSystemPalette();
+ QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>(nullptr);
+ }
}
}
}
@@ -243,7 +245,7 @@ static QString deviceModelIdentifier()
char value[size];
sysctlbyname(key, &value, &size, NULL, 0);
- return QString::fromLatin1(value);
+ return QString::fromLatin1(QByteArrayView(value, qsizetype(size)));
#endif
}
diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm
index 1360af9d76..584dd1c8fc 100644
--- a/src/plugins/platforms/ios/qiostheme.mm
+++ b/src/plugins/platforms/ios/qiostheme.mm
@@ -160,7 +160,7 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
case QPlatformTheme::StyleNames:
- return QStringList(QStringLiteral("fusion"));
+ return QStringList(QStringLiteral("Fusion"));
case KeyboardScheme:
return QVariant(int(MacKeyboardScheme));
default:
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index f5dd20bace..4c56e03f42 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -394,7 +394,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
<< "xTilt" << qBound(-60.0, altitudeAngle * azimuth.dx, 60.0) << "yTilt" << qBound(-60.0, altitudeAngle * azimuth.dy, 60.0);
QWindowSystemInterface::handleTabletEvent(self.platformWindow->window(), timeStamp, localViewPosition, globalScreenPosition,
// device, pointerType, buttons
- int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), state == Qt::TouchPointReleased ? Qt::NoButton : Qt::LeftButton,
+ int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), state == QEventPoint::State::Released ? Qt::NoButton : Qt::LeftButton,
// pressure, xTilt, yTilt
pressure, qBound(-60.0, altitudeAngle * azimuth.dx, 60.0), qBound(-60.0, altitudeAngle * azimuth.dy, 60.0),
// tangentialPressure, rotation, z, uid, modifiers
diff --git a/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt b/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt
index 258b70603e..920404ec77 100644
--- a/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt
@@ -27,12 +27,12 @@ qt_internal_add_plugin(QLinuxFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
SOURCES
qlinuxfbdrmscreen.cpp qlinuxfbdrmscreen.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/linuxfb/CMakeLists.txt b/src/plugins/platforms/linuxfb/CMakeLists.txt
index ea5642f1c0..d903fdc6a7 100644
--- a/src/plugins/platforms/linuxfb/CMakeLists.txt
+++ b/src/plugins/platforms/linuxfb/CMakeLists.txt
@@ -28,12 +28,12 @@ qt_internal_add_plugin(QLinuxFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
SOURCES
qlinuxfbdrmscreen.cpp qlinuxfbdrmscreen.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
index 1e671ee7fc..3481abb47d 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
@@ -53,7 +53,7 @@ class QEvdevKeyboardManager;
class QLinuxFbIntegration : public QPlatformIntegration, public QPlatformNativeInterface
#if QT_CONFIG(evdev)
- , public QPlatformInterface::Private::QEvdevKeyMapper
+ , public QNativeInterface::Private::QEvdevKeyMapper
#endif
{
public:
diff --git a/src/plugins/platforms/minimal/.prev_CMakeLists.txt b/src/plugins/platforms/minimal/.prev_CMakeLists.txt
index bb670b4dd4..b51b64ef99 100644
--- a/src/plugins/platforms/minimal/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/minimal/.prev_CMakeLists.txt
@@ -26,7 +26,7 @@ qt_internal_add_plugin(QMinimalIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
+qt_internal_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
LIBRARIES
WrapFreetype::WrapFreetype
)
diff --git a/src/plugins/platforms/minimal/CMakeLists.txt b/src/plugins/platforms/minimal/CMakeLists.txt
index bf2e644251..3f6945ed26 100644
--- a/src/plugins/platforms/minimal/CMakeLists.txt
+++ b/src/plugins/platforms/minimal/CMakeLists.txt
@@ -29,7 +29,7 @@ qt_internal_add_plugin(QMinimalIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
+qt_internal_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
LIBRARIES
WrapFreetype::WrapFreetype
)
diff --git a/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt b/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt
index 15ce608f04..9483f41762 100644
--- a/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt
@@ -27,7 +27,7 @@ qt_internal_add_plugin(QMinimalEglIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qminimaleglbackingstore.cpp qminimaleglbackingstore.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/minimalegl/CMakeLists.txt b/src/plugins/platforms/minimalegl/CMakeLists.txt
index beb4d54257..1758eb3af0 100644
--- a/src/plugins/platforms/minimalegl/CMakeLists.txt
+++ b/src/plugins/platforms/minimalegl/CMakeLists.txt
@@ -30,7 +30,7 @@ qt_internal_add_plugin(QMinimalEglIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qminimaleglbackingstore.cpp qminimaleglbackingstore.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/offscreen/.prev_CMakeLists.txt b/src/plugins/platforms/offscreen/.prev_CMakeLists.txt
index c69719dda7..aa827366d3 100644
--- a/src/plugins/platforms/offscreen/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/offscreen/.prev_CMakeLists.txt
@@ -27,9 +27,11 @@ qt_internal_add_plugin(QOffscreenIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
+qt_internal_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
SOURCES
qoffscreenintegration_x11.cpp qoffscreenintegration_x11.h
+ LIBRARIES
+ X11::X11
)
#### Keys ignored in scope 3:.:.:offscreen.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
diff --git a/src/plugins/platforms/offscreen/CMakeLists.txt b/src/plugins/platforms/offscreen/CMakeLists.txt
index ee738851e5..160aa7df93 100644
--- a/src/plugins/platforms/offscreen/CMakeLists.txt
+++ b/src/plugins/platforms/offscreen/CMakeLists.txt
@@ -28,9 +28,11 @@ qt_internal_add_plugin(QOffscreenIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
+qt_internal_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
SOURCES
qoffscreenintegration_x11.cpp qoffscreenintegration_x11.h
+ LIBRARIES
+ X11::X11
)
#### Keys ignored in scope 3:.:.:offscreen.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp
index f364d9f004..6b696ed073 100644
--- a/src/plugins/platforms/offscreen/main.cpp
+++ b/src/plugins/platforms/offscreen/main.cpp
@@ -53,9 +53,8 @@ public:
QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
- Q_UNUSED(paramList);
if (!system.compare(QLatin1String("offscreen"), Qt::CaseInsensitive))
- return QOffscreenIntegration::createOffscreenIntegration();
+ return QOffscreenIntegration::createOffscreenIntegration(paramList);
return nullptr;
}
diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro
index 8b11e5ca74..6be725af7e 100644
--- a/src/plugins/platforms/offscreen/offscreen.pro
+++ b/src/plugins/platforms/offscreen/offscreen.pro
@@ -19,6 +19,7 @@ OTHER_FILES += offscreen.json
qtConfig(xlib):qtConfig(opengl):!qtConfig(opengles2) {
SOURCES += qoffscreenintegration_x11.cpp
HEADERS += qoffscreenintegration_x11.h
+ QMAKE_USE_PRIVATE += xlib
}
PLUGIN_TYPE = platforms
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
index de75a3e012..3d02721869 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
@@ -38,8 +38,10 @@
****************************************************************************/
#include "qoffscreencommon.h"
+#include "qoffscreenintegration.h"
#include "qoffscreenwindow.h"
+
#include <QtGui/private/qpixmap_raster_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -50,6 +52,12 @@ QT_BEGIN_NAMESPACE
QPlatformWindow *QOffscreenScreen::windowContainingCursor = nullptr;
+
+QList<QPlatformScreen *> QOffscreenScreen::virtualSiblings() const
+{
+ return m_integration->screens();
+}
+
class QOffscreenCursor : public QPlatformCursor
{
public:
@@ -93,9 +101,10 @@ private:
QPoint m_pos;
};
-QOffscreenScreen::QOffscreenScreen()
+QOffscreenScreen::QOffscreenScreen(const QOffscreenIntegration *integration)
: m_geometry(0, 0, 800, 600)
, m_cursor(new QOffscreenCursor)
+ , m_integration(integration)
{
}
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.h b/src/plugins/platforms/offscreen/qoffscreencommon.h
index f4f0142911..abb641fbbc 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.h
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.h
@@ -54,23 +54,34 @@
QT_BEGIN_NAMESPACE
+class QOffscreenIntegration;
class QOffscreenScreen : public QPlatformScreen
{
public:
- QOffscreenScreen();
+ QOffscreenScreen(const QOffscreenIntegration *integration);
QRect geometry() const override { return m_geometry; }
int depth() const override { return 32; }
QImage::Format format() const override { return QImage::Format_RGB32; }
+ QDpi logicalDpi() const override { return QDpi(m_logicalDpi, m_logicalDpi); }
+ QDpi logicalBaseDpi() const override { return QDpi(m_logicalBaseDpi, m_logicalBaseDpi); }
+ qreal devicePixelRatio() const override { return m_dpr; }
+ QString name() const override { return m_name; }
QPlatformCursor *cursor() const override { return m_cursor.data(); }
+ QList<QPlatformScreen *> virtualSiblings() const override;
QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
static QPlatformWindow *windowContainingCursor;
public:
+ QString m_name;
QRect m_geometry;
+ int m_logicalDpi = 96;
+ int m_logicalBaseDpi= 96;
+ qreal m_dpr = 1;
QScopedPointer<QPlatformCursor> m_cursor;
+ const QOffscreenIntegration *m_integration;
};
#if QT_CONFIG(draganddrop)
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
index ef0eb7e9cf..c9f97ce46a 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
@@ -54,6 +54,11 @@
#include <QtCore/private/qeventdispatcher_win_p.h>
#endif
+#include <QtCore/qfile.h>
+#include <QtCore/qjsonarray.h>
+#include <QtCore/qjsondocument.h>
+#include <QtCore/qjsonobject.h>
+#include <QtCore/qjsonvalue.h>
#include <QtGui/private/qpixmap_raster_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
@@ -80,25 +85,12 @@ public:
{
}
- bool processEvents(QEventLoop::ProcessEventsFlags flags)
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override
{
bool didSendEvents = BaseEventDispatcher::processEvents(flags);
return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
}
-
- bool hasPendingEvents()
- {
- return BaseEventDispatcher::hasPendingEvents()
- || QWindowSystemInterface::windowSystemEventsQueued();
- }
-
- void flush()
- {
- if (qApp)
- qApp->sendPostedEvents();
- BaseEventDispatcher::flush();
- }
};
QOffscreenIntegration::QOffscreenIntegration()
@@ -117,14 +109,98 @@ QOffscreenIntegration::QOffscreenIntegration()
m_drag.reset(new QOffscreenDrag);
#endif
m_services.reset(new QPlatformServices);
-
- QWindowSystemInterface::handleScreenAdded(new QOffscreenScreen);
}
QOffscreenIntegration::~QOffscreenIntegration()
{
}
+/*
+ The offscren platform plugin is configurable with a JSON configuration
+ file. Write the config to disk and pass the file path as a platform argument:
+
+ ./myapp -platform offscreen:configfile=/path/to/config.json
+
+ The supported top-level config keys are:
+ {
+ "synchronousWindowSystemEvents": <bool>
+ "windowFrameMargins": <bool>,
+ "screens": [<screens>],
+ }
+
+ Screen:
+ {
+ "name" : string,
+ "x": int,
+ "y": int,
+ "width": int,
+ "height": int,
+ "logicalDpi": int,
+ "logicalBaseDpi": int,
+ "dpr": double,
+ }
+*/
+void QOffscreenIntegration::configure(const QStringList& paramList)
+{
+ // Use config file configuring platform plugin, if one was specified
+ bool hasConfigFile = false;
+ QString configFilePath;
+ for (const QString &param : paramList) {
+ // Look for "configfile=/path/to/file/"
+ QString configPrefix(QLatin1String("configfile="));
+ if (param.startsWith(configPrefix)) {
+ hasConfigFile = true;
+ configFilePath= param.mid(configPrefix.length());
+ }
+ }
+
+ // Create the default screen if there was no config file
+ if (!hasConfigFile) {
+ QOffscreenScreen *offscreenScreen = new QOffscreenScreen(this);
+ m_screens.append(offscreenScreen);
+ QWindowSystemInterface::handleScreenAdded(offscreenScreen);
+ return;
+ }
+
+ // Read config file
+ if (configFilePath.isEmpty())
+ qFatal("Missing file path for -configfile platform option");
+ QFile configFile(configFilePath);
+ if (!configFile.exists())
+ qFatal("Could not find platform config file %s", qPrintable(configFilePath));
+ if (!configFile.open(QIODevice::ReadOnly))
+ qFatal("Could not open platform config file for reading %s, %s", qPrintable(configFilePath), qPrintable(configFile.errorString()));
+
+ QByteArray json = configFile.readAll();
+ QJsonParseError error;
+ QJsonDocument config = QJsonDocument::fromJson(json, &error);
+ if (config.isNull())
+ qFatal("Platform config file parse error: %s", qPrintable(error.errorString()));
+
+ // Apply configuration (create screens)
+ bool synchronousWindowSystemEvents = config["synchronousWindowSystemEvents"].toBool(false);
+ QWindowSystemInterface::setSynchronousWindowSystemEvents(synchronousWindowSystemEvents);
+ m_windowFrameMarginsEnabled = config["windowFrameMargins"].toBool(true);
+ QJsonArray screens = config["screens"].toArray();
+ for (QJsonValue screenValue : screens) {
+ QJsonObject screen = screenValue.toObject();
+ if (screen.isEmpty()) {
+ qWarning("QOffscreenIntegration::initializeWithPlatformArguments: empty screen object");
+ continue;
+ }
+ QOffscreenScreen *offscreenScreen = new QOffscreenScreen(this);
+ offscreenScreen->m_name = screen["name"].toString();
+ offscreenScreen->m_geometry = QRect(screen["x"].toInt(0), screen["y"].toInt(0),
+ screen["width"].toInt(640), screen["height"].toInt(480));
+ offscreenScreen->m_logicalDpi = screen["logicalDpi"].toInt(96);
+ offscreenScreen->m_logicalBaseDpi = screen["logicalBaseDpi"].toInt(96);
+ offscreenScreen->m_dpr = screen["dpr"].toDouble(1.0);
+
+ m_screens.append(offscreenScreen);
+ QWindowSystemInterface::handleScreenAdded(offscreenScreen);
+ }
+}
+
void QOffscreenIntegration::initialize()
{
m_inputContext.reset(QPlatformInputContextFactory::create());
@@ -147,7 +223,7 @@ bool QOffscreenIntegration::hasCapability(QPlatformIntegration::Capability cap)
QPlatformWindow *QOffscreenIntegration::createPlatformWindow(QWindow *window) const
{
Q_UNUSED(window);
- QPlatformWindow *w = new QOffscreenWindow(window);
+ QPlatformWindow *w = new QOffscreenWindow(window, m_windowFrameMarginsEnabled);
w->requestActivateWindow();
return w;
}
@@ -186,7 +262,7 @@ public:
{
switch (h) {
case StyleNames:
- return QVariant(QStringList(QStringLiteral("fusion")));
+ return QVariant(QStringList(QStringLiteral("Fusion")));
default:
break;
}
@@ -216,14 +292,25 @@ QPlatformServices *QOffscreenIntegration::services() const
return m_services.data();
}
-QOffscreenIntegration *QOffscreenIntegration::createOffscreenIntegration()
+QOffscreenIntegration *QOffscreenIntegration::createOffscreenIntegration(const QStringList& paramList)
{
+ QOffscreenIntegration *offscreenIntegration = nullptr;
+
#if QT_CONFIG(xlib) && QT_CONFIG(opengl) && !QT_CONFIG(opengles2)
QByteArray glx = qgetenv("QT_QPA_OFFSCREEN_NO_GLX");
if (glx.isEmpty())
- return new QOffscreenX11Integration;
+ offscreenIntegration = new QOffscreenX11Integration;
+#else
+ offscreenIntegration = new QOffscreenIntegration;
#endif
- return new QOffscreenIntegration;
+
+ offscreenIntegration->configure(paramList);
+ return offscreenIntegration;
+}
+
+QList<QPlatformScreen *> QOffscreenIntegration::screens() const
+{
+ return m_screens;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.h b/src/plugins/platforms/offscreen/qoffscreenintegration.h
index 098e726550..be47313913 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.h
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.h
@@ -55,6 +55,7 @@ public:
QOffscreenIntegration();
~QOffscreenIntegration();
+ void configure(const QStringList& paramList);
void initialize() override;
bool hasCapability(QPlatformIntegration::Capability cap) const override;
@@ -73,8 +74,9 @@ public:
QStringList themeNames() const override;
QPlatformTheme *createPlatformTheme(const QString &name) const override;
- static QOffscreenIntegration *createOffscreenIntegration();
+ static QOffscreenIntegration *createOffscreenIntegration(const QStringList& paramList);
+ QList<QPlatformScreen *> screens() const;
private:
QScopedPointer<QPlatformFontDatabase> m_fontDatabase;
#if QT_CONFIG(draganddrop)
@@ -82,6 +84,8 @@ private:
#endif
QScopedPointer<QPlatformInputContext> m_inputContext;
QScopedPointer<QPlatformServices> m_services;
+ QList<QPlatformScreen *> m_screens;
+ bool m_windowFrameMarginsEnabled = true;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp
index c866a55dc0..bb4d8aeaa1 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp
@@ -118,13 +118,15 @@ void *QOffscreenX11Integration::nativeResourceForContext(const QByteArray &resou
if (resource.toLower() == QByteArrayLiteral("glxconfig") ) {
if (context) {
QOffscreenX11GLXContext *glxPlatformContext = static_cast<QOffscreenX11GLXContext *>(context->handle());
- return glxPlatformContext->glxConfig();
+ if (glxPlatformContext)
+ return glxPlatformContext->glxConfig();
}
}
if (resource.toLower() == QByteArrayLiteral("glxcontext") ) {
if (context) {
QOffscreenX11GLXContext *glxPlatformContext = static_cast<QOffscreenX11GLXContext *>(context->handle());
- return glxPlatformContext->glxContext();
+ if (glxPlatformContext)
+ return glxPlatformContext->glxContext();
}
}
return nullptr;
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
index 005ac26151..01a75510fb 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
@@ -90,7 +90,7 @@ private:
class QOffscreenX11GLXContextData;
class QOffscreenX11GLXContext : public QPlatformOpenGLContext
- , public QPlatformInterface::QGLXContext
+ , public QNativeInterface::QGLXContext
{
public:
QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGLContext *context);
diff --git a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp
index 53880c877e..a46258a401 100644
--- a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp
@@ -47,18 +47,18 @@
QT_BEGIN_NAMESPACE
-QOffscreenWindow::QOffscreenWindow(QWindow *window)
+QOffscreenWindow::QOffscreenWindow(QWindow *window, bool frameMarginsEnabled)
: QPlatformWindow(window)
, m_positionIncludesFrame(false)
, m_visible(false)
, m_pendingGeometryChangeOnShow(true)
+ , m_frameMarginsRequested(frameMarginsEnabled)
{
- if (window->windowState() == Qt::WindowNoState)
- setGeometry(window->geometry());
- else
+ if (window->windowState() == Qt::WindowNoState) {
+ setGeometry(windowGeometry());
+ } else {
setWindowState(window->windowStates());
-
- QWindowSystemInterface::flushWindowSystemEvents();
+ }
static WId counter = 0;
m_winId = ++counter;
@@ -80,7 +80,7 @@ void QOffscreenWindow::setGeometry(const QRect &rect)
m_positionIncludesFrame = qt_window_private(window())->positionPolicy == QWindowPrivate::WindowFrameInclusive;
- setFrameMarginsEnabled(true);
+ setFrameMarginsEnabled(m_frameMarginsRequested);
setGeometryImpl(rect);
m_normalGeometry = geometry();
@@ -168,7 +168,7 @@ void QOffscreenWindow::setFrameMarginsEnabled(bool enabled)
void QOffscreenWindow::setWindowState(Qt::WindowStates state)
{
- setFrameMarginsEnabled(!(state & Qt::WindowFullScreen));
+ setFrameMarginsEnabled(m_frameMarginsRequested && !(state & Qt::WindowFullScreen));
m_positionIncludesFrame = false;
if (state & Qt::WindowMinimized)
diff --git a/src/plugins/platforms/offscreen/qoffscreenwindow.h b/src/plugins/platforms/offscreen/qoffscreenwindow.h
index e1f37bb034..32b8ca33cb 100644
--- a/src/plugins/platforms/offscreen/qoffscreenwindow.h
+++ b/src/plugins/platforms/offscreen/qoffscreenwindow.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class QOffscreenWindow : public QPlatformWindow
{
public:
- QOffscreenWindow(QWindow *window);
+ QOffscreenWindow(QWindow *window, bool frameMarginsEnabled);
~QOffscreenWindow();
void setGeometry(const QRect &rect) override;
@@ -74,6 +74,7 @@ private:
bool m_positionIncludesFrame;
bool m_visible;
bool m_pendingGeometryChangeOnShow;
+ bool m_frameMarginsRequested;
WId m_winId;
static QHash<WId, QOffscreenWindow *> m_windowForWinIdHash;
diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.h b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
index 24e28dae96..abacf80f54 100644
--- a/src/plugins/platforms/qnx/qqnxabstractnavigator.h
+++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
@@ -50,7 +50,7 @@ class QQnxAbstractNavigator : public QObject
{
Q_OBJECT
public:
- explicit QQnxAbstractNavigator(QObject *parent = 0);
+ explicit QQnxAbstractNavigator(QObject *parent = nullptr);
~QQnxAbstractNavigator();
bool invokeUrl(const QUrl &url);
diff --git a/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h b/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h
index 24be03b46c..92f6308487 100644
--- a/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h
+++ b/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h
@@ -64,7 +64,7 @@ public:
enum KeyboardMode { Default, Url, Email, Web, NumPunc, Number, Symbol, Phone, Pin, Password, Alphanumeric };
enum EnterKeyType { DefaultReturn, Connect, Done, Go, Join, Next, Search, Send, Submit };
- explicit QQnxAbstractVirtualKeyboard(QObject *parent = 0);
+ explicit QQnxAbstractVirtualKeyboard(QObject *parent = nullptr);
virtual bool showKeyboard() = 0;
virtual bool hideKeyboard() = 0;
diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp
index cd05a679b1..b02a989ea8 100644
--- a/src/plugins/platforms/qnx/qqnxbuffer.cpp
+++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp
@@ -77,7 +77,7 @@ QQnxBuffer::QQnxBuffer(screen_buffer_t buffer)
// Get access to buffer's data
errno = 0;
- uchar *dataPtr = 0;
+ uchar *dataPtr = nullptr;
Q_SCREEN_CRITICALERROR(
screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr),
"Failed to query buffer pointer");
diff --git a/src/plugins/platforms/qnx/qqnxbuffer.h b/src/plugins/platforms/qnx/qqnxbuffer.h
index 9ee0d5d60c..4b8adb20db 100644
--- a/src/plugins/platforms/qnx/qqnxbuffer.h
+++ b/src/plugins/platforms/qnx/qqnxbuffer.h
@@ -55,8 +55,8 @@ public:
virtual ~QQnxBuffer();
screen_buffer_t nativeBuffer() const { return m_buffer; }
- const QImage *image() const { return (m_buffer != 0) ? &m_image : 0; }
- QImage *image() { return (m_buffer != 0) ? &m_image : 0; }
+ const QImage *image() const { return (m_buffer != nullptr) ? &m_image : nullptr; }
+ QImage *image() { return (m_buffer != nullptr) ? &m_image : nullptr; }
QRect rect() const { return m_image.rect(); }
diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h
index aa2c118b3a..7cc67f2459 100644
--- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h
+++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h
@@ -64,7 +64,7 @@ public:
ButtonDown
};
- explicit QQnxButtonEventNotifier(QObject *parent = 0);
+ explicit QQnxButtonEventNotifier(QObject *parent = nullptr);
~QQnxButtonEventNotifier();
public Q_SLOTS:
diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp
index 78174549b1..437417a2d1 100644
--- a/src/plugins/platforms/qnx/qqnxclipboard.cpp
+++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp
@@ -141,9 +141,9 @@ public:
}
protected:
- QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const override
+ QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const override
{
- qClipboardDebug() << "mimetype=" << mimetype << "preferredType=" << preferredType;
+ qClipboardDebug() << "mimetype=" << mimetype << "preferredType=" << preferredType.name();
if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0)
return QMimeData::retrieveData(mimetype, preferredType);
diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp
index 69391c4fec..783ae2d20e 100644
--- a/src/plugins/platforms/qnx/qqnxglcontext.cpp
+++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
static QEGLPlatformContext::Flags makeFlags()
{
- QEGLPlatformContext::Flags result = 0;
+ QEGLPlatformContext::Flags result = {};
if (!QQnxIntegration::instance()->options().testFlag(QQnxIntegration::SurfacelessEGLContext))
result |= QEGLPlatformContext::NoSurfaceless;
@@ -69,7 +69,7 @@ static QEGLPlatformContext::Flags makeFlags()
}
QQnxGLContext::QQnxGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share)
- : QEGLPlatformContext(format, share, QQnxIntegration::instance()->eglDisplay(), 0, QVariant(),
+ : QEGLPlatformContext(format, share, QQnxIntegration::instance()->eglDisplay(), nullptr,
makeFlags())
{
}
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
index ce3a445d7c..79f6273e9f 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
@@ -76,8 +76,8 @@
static QQnxInputContext *sInputContextInstance;
static QColor sSelectedColor(0,0xb8,0,85);
-static const input_session_t *sSpellCheckSession = 0;
-static const input_session_t *sInputSession = 0;
+static const input_session_t *sSpellCheckSession = nullptr;
+static const input_session_t *sInputSession = nullptr;
static bool isSessionOkay(input_session_t *ic)
{
return ic !=0 && sInputSession != 0 && ic->component_id == sInputSession->component_id;
@@ -515,13 +515,13 @@ static spannable_string_t *toSpannableString(const QString &text)
}
-static const input_session_t *(*p_ictrl_open_session)(connection_interface_t *) = 0;
-static void (*p_ictrl_close_session)(input_session_t *) = 0;
-static int32_t (*p_ictrl_dispatch_event)(event_t*) = 0;
-static int32_t (*p_imf_client_init)() = 0;
-static void (*p_imf_client_disconnect)() = 0;
-static int32_t (*p_vkb_init_selection_service)() = 0;
-static int32_t (*p_ictrl_get_num_active_sessions)() = 0;
+static const input_session_t *(*p_ictrl_open_session)(connection_interface_t *) = nullptr;
+static void (*p_ictrl_close_session)(input_session_t *) = nullptr;
+static int32_t (*p_ictrl_dispatch_event)(event_t*) = nullptr;
+static int32_t (*p_imf_client_init)() = nullptr;
+static void (*p_imf_client_disconnect)() = nullptr;
+static int32_t (*p_vkb_init_selection_service)() = nullptr;
+static int32_t (*p_ictrl_get_num_active_sessions)() = nullptr;
static bool s_imfInitFailed = false;
static bool imfAvailable()
@@ -602,7 +602,7 @@ QQnxInputContext::~QQnxInputContext()
qInputContextDebug();
Q_ASSERT(sInputContextInstance == this);
- sInputContextInstance = 0;
+ sInputContextInstance = nullptr;
if (!imfAvailable())
return;
@@ -735,7 +735,7 @@ void QQnxInputContext::closeSession()
if (sInputSession) {
p_ictrl_close_session((input_session_t *)sInputSession);
- sInputSession = 0;
+ sInputSession = nullptr;
}
// These are likely already in the right state but this depends on the text control
// having called reset or commit. So, just in case, set them to proper values.
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
index 3e10052459..6bedfaf963 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
@@ -48,7 +48,7 @@ class QQnxNavigatorEventHandler : public QObject
{
Q_OBJECT
public:
- explicit QQnxNavigatorEventHandler(QObject *parent = 0);
+ explicit QQnxNavigatorEventHandler(QObject *parent = nullptr);
bool handleOrientationCheck(int angle);
void handleOrientationChange(int angle);
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h
index 17c31c096c..a761faea1c 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h
@@ -51,7 +51,7 @@ class QQnxNavigatorEventNotifier : public QObject
{
Q_OBJECT
public:
- explicit QQnxNavigatorEventNotifier(QQnxNavigatorEventHandler *eventHandler, QObject *parent = 0);
+ explicit QQnxNavigatorEventNotifier(QQnxNavigatorEventHandler *eventHandler, QObject *parent = nullptr);
~QQnxNavigatorEventNotifier();
public Q_SLOTS:
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.h b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
index 3c818f51a6..c58903b6b6 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatorpps.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
@@ -50,7 +50,7 @@ class QQnxNavigatorPps : public QQnxAbstractNavigator
{
Q_OBJECT
public:
- explicit QQnxNavigatorPps(QObject *parent = 0);
+ explicit QQnxNavigatorPps(QObject *parent = nullptr);
~QQnxNavigatorPps();
protected:
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index e70092b97e..fe68927fda 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -89,7 +89,7 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
if (!m_needsPosting)
return;
- QQnxWindow *targetWindow = 0;
+ QQnxWindow *targetWindow = nullptr;
if (window)
targetWindow = static_cast<QQnxWindow *>(window->handle());
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 5653c9ee57..7e971b2d66 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -141,15 +141,25 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
, m_lastButtonState(Qt::NoButton)
, m_lastMouseWindow(0)
, m_touchDevice(0)
+ , m_mouseDevice(0)
, m_eventThread(0)
, m_focusLostTimer(-1)
{
// Create a touch device
- m_touchDevice = new QPointingDevice;
- m_touchDevice->setType(QInputDevice::DeviceType::TouchScreen);
- m_touchDevice->setCapabilities(QPointingDevice::Capability::Position | QPointingDevice::Capability::Area | QPointingDevice::Capability::Pressure | QPointingDevice::Capability::NormalizedPosition);
+ m_touchDevice = new QPointingDevice(
+ QLatin1String("touchscreen"), 1, QInputDevice::DeviceType::TouchScreen,
+ QPointingDevice::PointerType::Finger,
+ QPointingDevice::Capability::Position | QPointingDevice::Capability::Area
+ | QPointingDevice::Capability::Pressure
+ | QPointingDevice::Capability::NormalizedPosition,
+ MaximumTouchPoints, 8);
QWindowSystemInterface::registerInputDevice(m_touchDevice);
+ m_mouseDevice = new QPointingDevice(QLatin1String("mouse"), 2, QInputDevice::DeviceType::Mouse,
+ QPointingDevice::PointerType::Generic,
+ QPointingDevice::Capability::Position, 1, 8);
+ QWindowSystemInterface::registerInputDevice(m_mouseDevice);
+
// initialize array of touch points
for (int i = 0; i < MaximumTouchPoints; i++) {
@@ -377,6 +387,10 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event)
screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta),
"Failed to query event wheel delta");
+ long long timestamp;
+ Q_SCREEN_CHECKERROR(screen_get_event_property_llv(event, SCREEN_PROPERTY_TIMESTAMP, &timestamp),
+ "Failed to get timestamp");
+
// Map window handle to top-level QWindow
QWindow *w = QQnxIntegration::instance()->window(qnxWindow);
@@ -414,7 +428,7 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event)
if (buttonState & 0x01)
buttons |= Qt::LeftButton;
if (buttonState & 0x02)
- buttons |= Qt::MidButton;
+ buttons |= Qt::MiddleButton;
if (buttonState & 0x04)
buttons |= Qt::RightButton;
if (buttonState & 0x08)
@@ -430,20 +444,55 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event)
if (w) {
// Inject mouse event into Qt only if something has changed.
- if (m_lastGlobalMousePoint != globalPoint ||
- m_lastLocalMousePoint != localPoint ||
- m_lastButtonState != buttons) {
- if (m_lastButtonState != 0 && buttons == 0)
+ if (m_lastGlobalMousePoint != globalPoint || m_lastLocalMousePoint != localPoint) {
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice, localPoint,
+ globalPoint, buttons, Qt::NoButton,
+ QEvent::MouseMove);
+ qScreenEventDebug() << "Qt mouse move, w=" << w << ", (" << localPoint.x() << ","
+ << localPoint.y() << "), b=" << static_cast<int>(buttons);
+ }
+
+ if (m_lastButtonState != buttons) {
+ static const auto supportedButtons = { Qt::LeftButton, Qt::MiddleButton,
+ Qt::RightButton, Qt::ExtraButton1,
+ Qt::ExtraButton2, Qt::ExtraButton3,
+ Qt::ExtraButton4, Qt::ExtraButton5 };
+
+ int releasedButtons = (m_lastButtonState ^ buttons) & ~buttons;
+ for (auto button : supportedButtons) {
+ if (releasedButtons & button) {
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice,
+ localPoint, globalPoint, buttons,
+ button, QEvent::MouseButtonRelease);
+ qScreenEventDebug() << "Qt mouse release, w=" << w << ", (" << localPoint.x()
+ << "," << localPoint.y() << "), b=" << button;
+ }
+ }
+
+ if (m_lastButtonState != 0 && buttons == 0) {
(static_cast<QQnxWindow *>(w->handle()))->handleActivationEvent();
- QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
- qScreenEventDebug() << "Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast<int>(buttons);
+ }
+
+ int pressedButtons = (m_lastButtonState ^ buttons) & buttons;
+ for (auto button : supportedButtons) {
+ if (pressedButtons & button) {
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice,
+ localPoint, globalPoint, buttons,
+ button, QEvent::MouseButtonPress);
+ qScreenEventDebug() << "Qt mouse press, w=" << w << ", (" << localPoint.x()
+ << "," << localPoint.y() << "), b=" << button;
+ }
+ }
}
if (wheelDelta) {
// Screen only supports a single wheel, so we will assume Vertical orientation for
// now since that is pretty much standard.
- QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical);
- qScreenEventDebug() << "Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
+ QPoint angleDelta(0, wheelDelta);
+ QWindowSystemInterface::handleWheelEvent(w, timestamp, m_mouseDevice, localPoint,
+ globalPoint, QPoint(), angleDelta);
+ qScreenEventDebug() << "Qt wheel, w=" << w << ", (" << localPoint.x() << ","
+ << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
}
}
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
index c20905fe0d..e7ee5e8118 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
@@ -98,6 +98,7 @@ private:
Qt::MouseButtons m_lastButtonState;
screen_window_t m_lastMouseWindow;
QPointingDevice *m_touchDevice;
+ QPointingDevice *m_mouseDevice;
QWindowSystemInterface::TouchPoint m_touchPoints[MaximumTouchPoints];
QList<QQnxScreenEventFilter*> m_eventFilters;
QQnxScreenEventThread *m_eventThread;
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 22a00d3d40..9d3b921c44 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -566,7 +566,7 @@ void QQnxWindow::removeFromParent()
if (Q_UNLIKELY(!m_parentWindow->m_childWindows.removeAll(this)))
qFatal("QQnxWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
else
- m_parentWindow = 0;
+ m_parentWindow = nullptr;
} else if (m_screen) {
m_screen->removeWindow(this);
}
@@ -634,7 +634,7 @@ void QQnxWindow::lower()
void QQnxWindow::requestActivateWindow()
{
- QQnxWindow *focusWindow = 0;
+ QQnxWindow *focusWindow = nullptr;
if (QGuiApplication::focusWindow())
focusWindow = static_cast<QQnxWindow*>(QGuiApplication::focusWindow()->handle());
@@ -664,7 +664,7 @@ void QQnxWindow::requestActivateWindow()
platformScreen->rootWindow()->m_windowGroupName == currentWindow->m_parentGroupName) {
currentWindow = platformScreen->rootWindow();
} else {
- currentWindow = 0;
+ currentWindow = nullptr;
}
}
diff --git a/src/plugins/platforms/vnc/.prev_CMakeLists.txt b/src/plugins/platforms/vnc/.prev_CMakeLists.txt
index ab11e57f0d..48e172ed70 100644
--- a/src/plugins/platforms/vnc/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/vnc/.prev_CMakeLists.txt
@@ -30,7 +30,7 @@ qt_internal_add_plugin(QVncIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
diff --git a/src/plugins/platforms/vnc/CMakeLists.txt b/src/plugins/platforms/vnc/CMakeLists.txt
index 5024459cf4..f3782b5434 100644
--- a/src/plugins/platforms/vnc/CMakeLists.txt
+++ b/src/plugins/platforms/vnc/CMakeLists.txt
@@ -31,7 +31,7 @@ qt_internal_add_plugin(QVncIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index aea8d26983..d1dc6634af 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -425,7 +425,7 @@ bool QRfbPointerEvent::read(QTcpSocket *s)
if (buttonMask & 1)
buttons |= Qt::LeftButton;
if (buttonMask & 2)
- buttons |= Qt::MidButton;
+ buttons |= Qt::MiddleButton;
if (buttonMask & 4)
buttons |= Qt::RightButton;
@@ -606,8 +606,11 @@ void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window)
void QVncClientCursor::addClient(QVncClient *client)
{
- if (!clients.contains(client))
+ if (!clients.contains(client)) {
clients.append(client);
+ // Force a cursor update when the client connects.
+ client->setDirtyCursor();
+ }
}
uint QVncClientCursor::removeClient(QVncClient *client)
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index 4ea69a3e78..9a16ae7719 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -454,9 +454,9 @@ void QWasmCompositor::drawFrameWindow(QWasmFrameOptions options, QPainter *paint
const QColor &c2 = options.palette.shadow().color();
const QColor &c3 = options.palette.midlight().color();
const QColor &c4 = options.palette.dark().color();
- const QBrush *fill = 0;
+ const QBrush *fill = nullptr;
- const qreal devicePixelRatio = painter->device()->devicePixelRatioF();
+ const qreal devicePixelRatio = painter->device()->devicePixelRatio();
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
const qreal inverseScale = qreal(1) / devicePixelRatio;
painter->scale(inverseScale, inverseScale);
@@ -599,7 +599,7 @@ void QWasmCompositor::drawShadePanel(QWasmTitleBarOptions options, QPainter *pai
int w = options.rect.width();
int h = options.rect.height();
- const qreal devicePixelRatio = painter->device()->devicePixelRatioF();
+ const qreal devicePixelRatio = painter->device()->devicePixelRatio();
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
const qreal inverseScale = qreal(1) / devicePixelRatio;
painter->scale(inverseScale, inverseScale);
diff --git a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
index 2e1b083557..1902f8a4a7 100644
--- a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
@@ -30,6 +30,7 @@
#include "qwasmeventdispatcher.h"
#include <QtCore/qcoreapplication.h>
+#include <QtGui/qpa/qwindowsysteminterface.h>
#include <emscripten.h>
@@ -144,7 +145,8 @@ void QWasmEventDispatcher::doMaintainTimers()
// native timer.
// Schedule a zero-timer to continue processing any pending events.
- if (!m_hasZeroTimer && hasPendingEvents()) {
+ extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
+ if (!m_hasZeroTimer && (qGlobalPostedEventsCount() || QWindowSystemInterface::windowSystemEventsQueued())) {
auto callback = [](void *eventDispatcher) {
QWasmEventDispatcher *that = static_cast<QWasmEventDispatcher *>(eventDispatcher);
that->m_hasZeroTimer = false;
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
index 2387f3cdea..82dd00bb65 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
@@ -337,6 +337,27 @@ QWasmEventTranslator::QWasmEventTranslator(QWasmScreen *screen)
initEventHandlers();
}
+QWasmEventTranslator::~QWasmEventTranslator()
+{
+ // deregister event handlers
+ QByteArray canvasSelector = "#" + screen()->canvasId().toUtf8();
+ emscripten_set_keydown_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_keyup_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_mousedown_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_mouseup_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_mousemove_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_focus_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_wheel_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_touchstart_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_touchend_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_touchmove_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_touchcancel_callback(canvasSelector.constData(), 0, 0, NULL);
+}
+
void QWasmEventTranslator::initEventHandlers()
{
QByteArray canvasSelector = "#" + screen()->canvasId().toUtf8();
@@ -353,7 +374,7 @@ void QWasmEventTranslator::initEventHandlers()
if (platform == MacOSPlatform) {
g_useNaturalScrolling = false; // make this !default on macOS
- if (emscripten::val::global("window")["safari"].isUndefined()) {
+ if (!emscripten::val::global("window")["safari"].isUndefined()) {
val canvas = screen()->canvas();
canvas.call<void>("addEventListener",
val("wheel"),
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.h b/src/plugins/platforms/wasm/qwasmeventtranslator.h
index f6c95770e9..b02685bedd 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.h
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.h
@@ -49,6 +49,7 @@ class QWasmEventTranslator : public QObject
public:
explicit QWasmEventTranslator(QWasmScreen *screen);
+ ~QWasmEventTranslator();
static int keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData);
static int mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData);
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index 0d196ec099..15d396f479 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -87,6 +87,12 @@ static void qtUpdateDpi()
QWasmIntegration::get()->updateDpi();
}
+static void resizeAllScreens(emscripten::val event)
+{
+ Q_UNUSED(event);
+ QWasmIntegration::get()->resizeAllScreens();
+}
+
EMSCRIPTEN_BINDINGS(qtQWasmIntegraton)
{
function("qtBrowserBeforeUnload", &browserBeforeUnload);
@@ -94,6 +100,7 @@ EMSCRIPTEN_BINDINGS(qtQWasmIntegraton)
function("qtRemoveCanvasElement", &removeCanvasElement);
function("qtResizeCanvasElement", &resizeCanvasElement);
function("qtUpdateDpi", &qtUpdateDpi);
+ function("qtResizeAllScreens", &resizeAllScreens);
}
QWasmIntegration *QWasmIntegration::s_instance;
@@ -136,6 +143,13 @@ QWasmIntegration::QWasmIntegration()
return 0;
};
emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, 1, onWindowResize);
+
+ // install visualViewport resize handler which picks up size and scale change on mobile.
+ emscripten::val visualViewport = emscripten::val::global("window")["visualViewport"];
+ if (!visualViewport.isUndefined()) {
+ visualViewport.call<void>("addEventListener", val("resize"),
+ val::module_property("qtResizeAllScreens"));
+ }
}
QWasmIntegration::~QWasmIntegration()
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp
index 0f1fd886d0..7b1fc0d42e 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.cpp
+++ b/src/plugins/platforms/wasm/qwasmscreen.cpp
@@ -50,17 +50,21 @@ using namespace emscripten;
QT_BEGIN_NAMESPACE
+const char * QWasmScreen::m_canvasResizeObserverCallbackContextPropertyName = "data-qtCanvasResizeObserverCallbackContext";
+
QWasmScreen::QWasmScreen(const emscripten::val &canvas)
: m_canvas(canvas)
{
m_compositor = new QWasmCompositor(this);
m_eventTranslator = new QWasmEventTranslator(this);
+ installCanvasResizeObserver();
updateQScreenAndCanvasRenderSize();
m_canvas.call<void>("focus");
}
QWasmScreen::~QWasmScreen()
{
+ m_canvas.set(m_canvasResizeObserverCallbackContextPropertyName, emscripten::val(intptr_t(0)));
destroy();
}
@@ -127,12 +131,23 @@ QDpi QWasmScreen::logicalDpi() const
qreal QWasmScreen::devicePixelRatio() const
{
- // FIXME: The effective device pixel ratio may be different from the
- // HTML window dpr if the OpenGL driver/GPU allocates a less than
- // full resolution surface. Use emscripten_webgl_get_drawing_buffer_size()
- // and compute the dpr instead.
- double htmlWindowDpr = emscripten::val::global("window")["devicePixelRatio"].as<double>();
- return qreal(htmlWindowDpr);
+ // window.devicePixelRatio gives us the scale factor between CSS and device pixels.
+ // This property reflects hardware configuration, and also browser zoom on desktop.
+ //
+ // window.visualViewport.scale gives us the zoom factor on mobile. If the html page is
+ // configured with "<meta name="viewport" content="width=device-width">" then this scale
+ // factor will be 1. Omitting the viewport configuration typically results on a zoomed-out
+ // viewport, with a scale factor <1. User pinch-zoom will change the scale factor; an event
+ // handler is installed in the QWasmIntegration constructor. Changing zoom level on desktop
+ // does not appear to change visualViewport.scale.
+ //
+ // The effective devicePixelRatio is the product of these two scale factors, upper-bounded
+ // by window.devicePixelRatio in order to avoid e.g. allocating a 10x widget backing store.
+ double dpr = emscripten::val::global("window")["devicePixelRatio"].as<double>();
+ emscripten::val visualViewport = emscripten::val::global("window")["visualViewport"];
+ double scale = visualViewport.isUndefined() ? 1.0 : visualViewport["scale"].as<double>();
+ double effectiveDevicePixelRatio = std::min(dpr * scale, dpr);
+ return qreal(effectiveDevicePixelRatio);
}
QString QWasmScreen::name() const
@@ -205,4 +220,42 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize()
m_compositor->redrawWindowContent();
}
+void QWasmScreen::canvasResizeObserverCallback(emscripten::val entries, emscripten::val)
+{
+ int count = entries["length"].as<int>();
+ if (count == 0)
+ return;
+ emscripten::val entry = entries[0];
+ QWasmScreen *screen =
+ reinterpret_cast<QWasmScreen *>(entry["target"][m_canvasResizeObserverCallbackContextPropertyName].as<intptr_t>());
+ if (!screen) {
+ qWarning() << "QWasmScreen::canvasResizeObserverCallback: missing screen pointer";
+ return;
+ }
+
+ // We could access contentBoxSize|contentRect|devicePixelContentBoxSize on the entry here, but
+ // these are not universally supported across all browsers. Get the sizes from the canvas instead.
+ screen->updateQScreenAndCanvasRenderSize();
+}
+
+EMSCRIPTEN_BINDINGS(qtCanvasResizeObserverCallback) {
+ emscripten::function("qtCanvasResizeObserverCallback", &QWasmScreen::canvasResizeObserverCallback);
+}
+
+void QWasmScreen::installCanvasResizeObserver()
+{
+ emscripten::val ResizeObserver = emscripten::val::global("ResizeObserver");
+ if (ResizeObserver == emscripten::val::undefined())
+ return; // ResizeObserver API is not available
+ emscripten::val resizeObserver = ResizeObserver.new_(emscripten::val::module_property("qtCanvasResizeObserverCallback"));
+ if (resizeObserver == emscripten::val::undefined())
+ return; // Something went horribly wrong
+
+ // We need to get back to this instance from the (static) resize callback;
+ // set a "data-" property on the canvas element.
+ m_canvas.set(m_canvasResizeObserverCallbackContextPropertyName, emscripten::val(intptr_t(this)));
+
+ resizeObserver.call<void>("observe", m_canvas);
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmscreen.h b/src/plugins/platforms/wasm/qwasmscreen.h
index ea7ffc4193..14d5a2f7d1 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.h
+++ b/src/plugins/platforms/wasm/qwasmscreen.h
@@ -78,6 +78,8 @@ public:
void invalidateSize();
void updateQScreenAndCanvasRenderSize();
+ void installCanvasResizeObserver();
+ static void canvasResizeObserverCallback(emscripten::val entries, emscripten::val);
public slots:
void setGeometry(const QRect &rect);
@@ -90,6 +92,7 @@ private:
int m_depth = 32;
QImage::Format m_format = QImage::Format_RGB32;
QWasmCursor m_cursor;
+ static const char * m_canvasResizeObserverCallbackContextPropertyName;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmtheme.cpp b/src/plugins/platforms/wasm/qwasmtheme.cpp
index 978d60d686..4b99f90591 100644
--- a/src/plugins/platforms/wasm/qwasmtheme.cpp
+++ b/src/plugins/platforms/wasm/qwasmtheme.cpp
@@ -50,7 +50,7 @@ QWasmTheme::~QWasmTheme()
QVariant QWasmTheme::themeHint(ThemeHint hint) const
{
if (hint == QPlatformTheme::StyleNames)
- return QVariant(QStringList() << QLatin1String("fusion"));
+ return QVariant(QStringList() << QLatin1String("Fusion"));
return QPlatformTheme::themeHint(hint);
}
diff --git a/src/plugins/platforms/wasm/wasm_shell.html b/src/plugins/platforms/wasm/wasm_shell.html
index d4bf632830..f5712d0418 100644
--- a/src/plugins/platforms/wasm/wasm_shell.html
+++ b/src/plugins/platforms/wasm/wasm_shell.html
@@ -3,9 +3,16 @@
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+
+ <!--Set visual viewport size for mobile devices to the device size,
+ witch results in a scale of 1 and a 1:1 mapping between CSS pixels
+ and Qt device independent pixels. -->
+ <meta name="viewport" content="width=device-width, height=device-height, user-scalable=0"/>
+
<title>@APPNAME@</title>
<style>
- html, body { padding: 0; margin : 0; overflow:hidden; height: 100% }
+ /* Make the html body cover the entire (visual) viewport with no scroll bars. */
+ html, body { padding: 0; margin: 0; overflow:hidden; height: 100vh }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas { border: 0px none; background-color: white; height:100%; width:100%; }
/* The contenteditable property is set to true for the canvas in order to support
diff --git a/src/plugins/platforms/windows/.prev_CMakeLists.txt b/src/plugins/platforms/windows/.prev_CMakeLists.txt
index d3e488ed20..cbb7bbcaa8 100644
--- a/src/plugins/platforms/windows/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/windows/.prev_CMakeLists.txt
@@ -69,7 +69,7 @@ set(openglblacklists_resource_files
"openglblacklists/default.json"
)
-qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
+qt_internal_add_resource(QWindowsIntegrationPlugin "openglblacklists"
PREFIX
"/qt-project.org/windows/openglblacklists"
FILES
@@ -83,7 +83,7 @@ qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
## Scopes:
#####################################################################
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qwindowsglcontext.cpp qwindowsglcontext.h
qwindowsopenglcontext.h
@@ -94,44 +94,44 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
#### Keys ignored in scope 3:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
# PLUGIN_EXTENDS = "-"
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
PUBLIC_LIBRARIES
opengl32
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
PUBLIC_LIBRARIES
uuid
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
SOURCES
qwindowssystemtrayicon.cpp qwindowssystemtrayicon.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qwindowsvulkaninstance.cpp qwindowsvulkaninstance.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
SOURCES
qwindowsclipboard.cpp qwindowsclipboard.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
SOURCES
qwindowsdrag.cpp qwindowsdrag.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
SOURCES
qwindowstabletsupport.cpp qwindowstabletsupport.h
INCLUDE_DIRECTORIES
${QT_SOURCE_TREE}/src/3rdparty/wintab
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qwindowssessionmanager.cpp qwindowssessionmanager.h
)
@@ -162,7 +162,7 @@ if(QT_FEATURE_imageformat_png)
"images/splitvcursor_64.png"
)
- qt_add_resource(QWindowsIntegrationPlugin "cursors"
+ qt_internal_add_resource(QWindowsIntegrationPlugin "cursors"
PREFIX
"/qt-project.org/windows/cursors"
FILES
@@ -170,7 +170,7 @@ if(QT_FEATURE_imageformat_png)
)
endif()
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
uiautomation/qwindowsuiaaccessibility.cpp uiautomation/qwindowsuiaaccessibility.h
uiautomation/qwindowsuiabaseprovider.cpp uiautomation/qwindowsuiabaseprovider.h
@@ -193,7 +193,7 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
uiautomation/qwindowsuiawindowprovider.cpp uiautomation/qwindowsuiawindowprovider.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
PUBLIC_LIBRARIES
uuid
)
diff --git a/src/plugins/platforms/windows/CMakeLists.txt b/src/plugins/platforms/windows/CMakeLists.txt
index fe12102811..77d2f2a714 100644
--- a/src/plugins/platforms/windows/CMakeLists.txt
+++ b/src/plugins/platforms/windows/CMakeLists.txt
@@ -70,7 +70,7 @@ set(openglblacklists_resource_files
"openglblacklists/default.json"
)
-qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
+qt_internal_add_resource(QWindowsIntegrationPlugin "openglblacklists"
PREFIX
"/qt-project.org/windows/openglblacklists"
FILES
@@ -84,7 +84,7 @@ qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
## Scopes:
#####################################################################
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qwindowsglcontext.cpp qwindowsglcontext.h
qwindowsopenglcontext.h
@@ -95,44 +95,44 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
#### Keys ignored in scope 3:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
# PLUGIN_EXTENDS = "-"
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
PUBLIC_LIBRARIES
opengl32
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
PUBLIC_LIBRARIES
uuid
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
SOURCES
qwindowssystemtrayicon.cpp qwindowssystemtrayicon.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qwindowsvulkaninstance.cpp qwindowsvulkaninstance.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
SOURCES
qwindowsclipboard.cpp qwindowsclipboard.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
SOURCES
qwindowsdrag.cpp qwindowsdrag.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
SOURCES
qwindowstabletsupport.cpp qwindowstabletsupport.h
INCLUDE_DIRECTORIES
${QT_SOURCE_TREE}/src/3rdparty/wintab
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qwindowssessionmanager.cpp qwindowssessionmanager.h
)
@@ -163,7 +163,7 @@ if(QT_FEATURE_imageformat_png)
"images/splitvcursor_64.png"
)
- qt_add_resource(QWindowsIntegrationPlugin "cursors"
+ qt_internal_add_resource(QWindowsIntegrationPlugin "cursors"
PREFIX
"/qt-project.org/windows/cursors"
FILES
@@ -171,7 +171,7 @@ if(QT_FEATURE_imageformat_png)
)
endif()
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
uiautomation/qwindowsuiaaccessibility.cpp uiautomation/qwindowsuiaaccessibility.h
uiautomation/qwindowsuiabaseprovider.cpp uiautomation/qwindowsuiabaseprovider.h
@@ -194,7 +194,13 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
uiautomation/qwindowsuiawindowprovider.cpp uiautomation/qwindowsuiawindowprovider.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
PUBLIC_LIBRARIES
uuid
)
+
+# begin special case
+if (MINGW)
+ set_source_files_properties(qwindowspointerhandler.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+endif()
+# end special case
diff --git a/src/plugins/platforms/windows/main.cpp b/src/plugins/platforms/windows/main.cpp
index 94d8470ab1..a3f81ec9fc 100644
--- a/src/plugins/platforms/windows/main.cpp
+++ b/src/plugins/platforms/windows/main.cpp
@@ -101,7 +101,7 @@ class QWindowsIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "windows.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&, int &, char **);
+ QPlatformIntegration *create(const QString &, const QStringList &, int &, char **) override;
};
QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, const QStringList& paramList, int &, char **)
diff --git a/src/plugins/platforms/windows/qwindowsapplication.cpp b/src/plugins/platforms/windows/qwindowsapplication.cpp
index fc495d999f..9997e0a903 100644
--- a/src/plugins/platforms/windows/qwindowsapplication.cpp
+++ b/src/plugins/platforms/windows/qwindowsapplication.cpp
@@ -112,13 +112,13 @@ void QWindowsApplication::setDarkModeHandling(QWindowsApplication::DarkModeHandl
m_darkModeHandling = handling;
}
-void QWindowsApplication::registerMime(QPlatformInterface::Private::QWindowsMime *mime)
+void QWindowsApplication::registerMime(QNativeInterface::Private::QWindowsMime *mime)
{
if (auto ctx = QWindowsContext::instance())
ctx->mimeConverter().registerMime(mime);
}
-void QWindowsApplication::unregisterMime(QPlatformInterface::Private::QWindowsMime *mime)
+void QWindowsApplication::unregisterMime(QNativeInterface::Private::QWindowsMime *mime)
{
if (auto ctx = QWindowsContext::instance())
ctx->mimeConverter().unregisterMime(mime);
diff --git a/src/plugins/platforms/windows/qwindowsapplication.h b/src/plugins/platforms/windows/qwindowsapplication.h
index 25a0cc7437..d57ce263c9 100644
--- a/src/plugins/platforms/windows/qwindowsapplication.h
+++ b/src/plugins/platforms/windows/qwindowsapplication.h
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
-class QWindowsApplication : public QPlatformInterface::Private::QWindowsApplication
+class QWindowsApplication : public QNativeInterface::Private::QWindowsApplication
{
public:
void setTouchWindowTouchType(TouchWindowTouchTypes type) override;
@@ -62,8 +62,8 @@ public:
DarkModeHandling darkModeHandling() const override;
void setDarkModeHandling(DarkModeHandling handling) override;
- void registerMime(QPlatformInterface::Private::QWindowsMime *mime) override;
- void unregisterMime(QPlatformInterface::Private::QWindowsMime *mime) override;
+ void registerMime(QNativeInterface::Private::QWindowsMime *mime) override;
+ void unregisterMime(QNativeInterface::Private::QWindowsMime *mime) override;
int registerMimeType(const QString &mime) override;
diff --git a/src/plugins/platforms/windows/qwindowscombase.h b/src/plugins/platforms/windows/qwindowscombase.h
index bb4b295395..749ad50234 100644
--- a/src/plugins/platforms/windows/qwindowscombase.h
+++ b/src/plugins/platforms/windows/qwindowscombase.h
@@ -85,16 +85,16 @@ public:
explicit QWindowsComBase(ULONG initialRefCount = 1) : m_ref(initialRefCount) {}
virtual ~QWindowsComBase() = default;
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface)
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface) override
{
*iface = nullptr;
return qWindowsComQueryInterface<IUnknown>(this, id, iface) || qWindowsComQueryInterface<ComInterface>(this, id, iface)
? S_OK : E_NOINTERFACE;
}
- ULONG STDMETHODCALLTYPE AddRef() { return ++m_ref; }
+ ULONG STDMETHODCALLTYPE AddRef() override { return ++m_ref; }
- ULONG STDMETHODCALLTYPE Release()
+ ULONG STDMETHODCALLTYPE Release() override
{
if (!--m_ref) {
delete this;
@@ -109,6 +109,7 @@ private:
// Clang does not consider __declspec(nothrow) as nothrow
QT_WARNING_DISABLE_CLANG("-Wmicrosoft-exception-spec")
+QT_WARNING_DISABLE_CLANG("-Wmissing-exception-spec")
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 70827cc57d..fe8b6f7085 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -102,7 +102,7 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c)
HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor)
{
HCURSOR cur = nullptr;
- const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatioF();
+ const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatio();
if (!qFuzzyCompare(pixmapScaleFactor, 1)) {
pixmap = pixmap.scaled((pixmapScaleFactor * QSizeF(pixmap.size())).toSize(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
@@ -170,7 +170,7 @@ static HCURSOR createBitmapCursor(const QCursor &cursor, qreal scaleFactor = 1)
Q_ASSERT(cursor.shape() == Qt::BitmapCursor && !cursor.bitmap(Qt::ReturnByValue).isNull());
QImage bbits = cursor.bitmap(Qt::ReturnByValue).toImage();
QImage mbits = cursor.mask(Qt::ReturnByValue).toImage();
- scaleFactor /= bbits.devicePixelRatioF();
+ scaleFactor /= bbits.devicePixelRatio();
if (!qFuzzyCompare(scaleFactor, 1)) {
const QSize scaledSize = (QSizeF(bbits.size()) * scaleFactor).toSize();
bbits = bbits.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 16a9110918..0312bde563 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -273,7 +273,7 @@ public:
explicit QWindowsDialogThread(const QWindowsNativeDialogBasePtr &d, HWND owner)
: m_dialog(d), m_owner(owner) {}
- void run();
+ void run() override;
private:
const QWindowsNativeDialogBasePtr m_dialog;
@@ -508,14 +508,20 @@ public:
static IFileDialogEvents *create(QWindowsNativeFileDialogBase *nativeFileDialog);
// IFileDialogEvents methods
- IFACEMETHODIMP OnFileOk(IFileDialog *);
- IFACEMETHODIMP OnFolderChange(IFileDialog *) { return S_OK; }
- IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *);
- IFACEMETHODIMP OnHelp(IFileDialog *) { return S_OK; }
- IFACEMETHODIMP OnSelectionChange(IFileDialog *);
- IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *, FDE_SHAREVIOLATION_RESPONSE *) { return S_OK; }
- IFACEMETHODIMP OnTypeChange(IFileDialog *);
- IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; }
+ IFACEMETHODIMP OnFileOk(IFileDialog *) override;
+ IFACEMETHODIMP OnFolderChange(IFileDialog *) override { return S_OK; }
+ IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *) override;
+ IFACEMETHODIMP OnSelectionChange(IFileDialog *) override;
+ IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *,
+ FDE_SHAREVIOLATION_RESPONSE *) override
+ {
+ return S_OK;
+ }
+ IFACEMETHODIMP OnTypeChange(IFileDialog *) override;
+ IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) override
+ {
+ return S_OK;
+ }
QWindowsNativeFileDialogEventHandler(QWindowsNativeFileDialogBase *nativeFileDialog) :
m_nativeFileDialog(nativeFileDialog) {}
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
index 8686749011..55167ad36d 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
@@ -80,7 +80,7 @@ public:
protected:
QWindowsDialogHelperBase() = default;
QWindowsNativeDialogBase *nativeDialog() const;
- inline bool hasNativeDialog() const { return m_nativeDialog; }
+ inline bool hasNativeDialog() const { return !m_nativeDialog.isNull(); }
void timerEvent(QTimerEvent *) override;
private:
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index bb1e1345dc..f46adf9132 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -190,20 +190,6 @@ static inline Qt::KeyboardModifiers toQtKeyboardModifiers(DWORD keyState)
return modifiers;
}
-static inline Qt::MouseButtons toQtMouseButtons(DWORD keyState)
-{
- Qt::MouseButtons buttons = Qt::NoButton;
-
- if (keyState & MK_LBUTTON)
- buttons |= Qt::LeftButton;
- if (keyState & MK_RBUTTON)
- buttons |= Qt::RightButton;
- if (keyState & MK_MBUTTON)
- buttons |= Qt::MidButton;
-
- return buttons;
-}
-
static Qt::KeyboardModifiers lastModifiers = Qt::NoModifier;
static Qt::MouseButtons lastButtons = Qt::NoButton;
@@ -231,8 +217,8 @@ public:
void createCursors();
// IDropSource methods
- STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState);
- STDMETHOD(GiveFeedback)(DWORD dwEffect);
+ STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState) override;
+ STDMETHOD(GiveFeedback)(DWORD dwEffect) override;
private:
struct CursorEntry {
@@ -386,7 +372,10 @@ void QWindowsOleDropSource::createCursors()
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
{
- Qt::MouseButtons buttons = toQtMouseButtons(grfKeyState);
+ // In some rare cases, when a mouse button is released but the mouse is static,
+ // grfKeyState will not be updated with these released buttons until the mouse
+ // is moved. So we use the async key state given by queryMouseButtons() instead.
+ Qt::MouseButtons buttons = QWindowsMouseHandler::queryMouseButtons();
SCODE result = S_OK;
if (fEscapePressed || QWindowsDrag::isCanceled()) {
@@ -505,7 +494,7 @@ void QWindowsOleDropTarget::handleDrag(QWindow *window, DWORD grfKeyState,
const Qt::DropActions actions = translateToQDragDropActions(*pdwEffect);
lastModifiers = toQtKeyboardModifiers(grfKeyState);
- lastButtons = toQtMouseButtons(grfKeyState);
+ lastButtons = QWindowsMouseHandler::queryMouseButtons();
const QPlatformDragQtResponse response =
QWindowSystemInterface::handleDrag(window, windowsDrag->dropData(),
@@ -603,7 +592,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
QWindowsDrag *windowsDrag = QWindowsDrag::instance();
lastModifiers = toQtKeyboardModifiers(grfKeyState);
- lastButtons = toQtMouseButtons(grfKeyState);
+ lastButtons = QWindowsMouseHandler::queryMouseButtons();
const QPlatformDropQtResponse response =
QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(),
diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h
index 5f30c59882..33b583b479 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.h
+++ b/src/plugins/platforms/windows/qwindowsdrag.h
@@ -66,10 +66,12 @@ public:
~QWindowsOleDropTarget() override;
// IDropTarget methods
- STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
- STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
- STDMETHOD(DragLeave)();
- STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
+ STDMETHOD(DragEnter)
+ (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
+ STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
+ STDMETHOD(DragLeave)() override;
+ STDMETHOD(Drop)
+ (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
private:
void handleDrag(QWindow *window, DWORD grfKeyState, const QPoint &, LPDWORD pdwEffect);
diff --git a/src/plugins/platforms/windows/qwindowsdropdataobject.h b/src/plugins/platforms/windows/qwindowsdropdataobject.h
index 16ba7b036a..407c809243 100644
--- a/src/plugins/platforms/windows/qwindowsdropdataobject.h
+++ b/src/plugins/platforms/windows/qwindowsdropdataobject.h
@@ -51,8 +51,8 @@ public:
~QWindowsDropDataObject() override;
// overridden IDataObject methods
- STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium);
- STDMETHOD(QueryGetData)(LPFORMATETC pformatetc);
+ STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium) override;
+ STDMETHOD(QueryGetData)(LPFORMATETC pformatetc) override;
private:
bool shouldIgnore(LPFORMATETC pformatetc) const;
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index aa93b85289..8c41cc135d 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -44,6 +44,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qsysinfo.h>
+#include <QtGui/qcolorspace.h>
#include <QtGui/qguiapplication.h>
#include <qpa/qplatformnativeinterface.h>
@@ -588,7 +589,7 @@ static int choosePixelFormat(HDC hdc,
iAttributes[i++] = FALSE;
}
// must be the last
- bool srgbRequested = format.colorSpace() == QSurfaceFormat::sRGBColorSpace;
+ bool srgbRequested = format.colorSpace() == QColorSpace::SRgb;
int srgbValuePosition = 0;
if (srgbRequested) {
srgbValuePosition = i;
@@ -710,10 +711,10 @@ static QSurfaceFormat
if (hasSampleBuffers) {
result.setSamples(iValues[13]);
if (hasSrgbSupport && iValues[14])
- result.setColorSpace(QSurfaceFormat::sRGBColorSpace);
+ result.setColorSpace(QColorSpace::SRgb);
} else {
if (hasSrgbSupport && iValues[12])
- result.setColorSpace(QSurfaceFormat::sRGBColorSpace);
+ result.setColorSpace(QColorSpace::SRgb);
}
if (additionalIn) {
if (iValues[7])
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h
index 2970f3d333..0e8383e5c0 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.h
+++ b/src/plugins/platforms/windows/qwindowsglcontext.h
@@ -200,7 +200,7 @@ public:
static QWindowsOpengl32DLL opengl32;
};
-class QWindowsGLContext : public QWindowsOpenGLContext, public QPlatformInterface::QWGLContext
+class QWindowsGLContext : public QWindowsOpenGLContext, public QNativeInterface::QWGLContext
{
public:
explicit QWindowsGLContext(QOpenGLStaticContext *staticContext, QOpenGLContext *context);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 6ec5f6e37f..74e6985980 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -183,8 +183,8 @@ bool parseIntOption(const QString &parameter,const QLatin1String &option,
return true;
}
-using DarkModeHandlingFlag = QPlatformInterface::Private::QWindowsApplication::DarkModeHandlingFlag;
-using DarkModeHandling = QPlatformInterface::Private::QWindowsApplication::DarkModeHandling;
+using DarkModeHandlingFlag = QNativeInterface::Private::QWindowsApplication::DarkModeHandlingFlag;
+using DarkModeHandling = QNativeInterface::Private::QWindowsApplication::DarkModeHandling;
static inline unsigned parseOptions(const QStringList &paramList,
int *tabletAbsoluteRange,
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index eaf62c750d..b5449b4a45 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -58,7 +58,7 @@ class QWindowsStaticOpenGLContext;
class QWindowsIntegration : public QPlatformIntegration
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QWindowsGLIntegration
+ , public QNativeInterface::Private::QWindowsGLIntegration
#endif
, public QWindowsApplication
{
@@ -95,7 +95,8 @@ public:
static QWindowsStaticOpenGLContext *staticOpenGLContext();
HMODULE openGLModuleHandle() const override;
- QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, QOpenGLContext *shareContext) const;
+ QOpenGLContext *createOpenGLContext(HGLRC context, HWND window,
+ QOpenGLContext *shareContext) const override;
#endif
QAbstractEventDispatcher *createEventDispatcher() const override;
void initialize() override;
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
index 21f64f04b6..5f63adba52 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
@@ -90,8 +90,7 @@ QStringList QWindowsInternalMimeData::formats_sys() const
return fmts;
}
-QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType,
- QVariant::Type type) const
+QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType, QMetaType type) const
{
IDataObject *pDataObj = retrieveDataObject();
if (!pDataObj)
@@ -103,9 +102,9 @@ QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType,
result = converter->convertToMime(mimeType, pDataObj, type);
releaseDataObject(pDataObj);
if (QWindowsContext::verbose) {
- qCDebug(lcQpaMime) <<__FUNCTION__ << ' ' << mimeType << ' ' << type
- << " returns " << result.type()
- << (result.type() != QVariant::ByteArray ? result.toString() : QStringLiteral("<data>"));
+ qCDebug(lcQpaMime) <<__FUNCTION__ << ' ' << mimeType << ' ' << type.name()
+ << " returns " << result.metaType().name()
+ << (result.userType() != QVariant::ByteArray ? result.toString() : QStringLiteral("<data>"));
}
return result;
}
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
index dbc1ea3922..998b8c871e 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
@@ -54,7 +54,7 @@ class QWindowsInternalMimeData : public QInternalMimeData {
public:
bool hasFormat_sys(const QString &mimetype) const override;
QStringList formats_sys() const override;
- QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const override;
+ QVariant retrieveData_sys(const QString &mimetype, QMetaType preferredType) const override;
protected:
virtual IDataObject *retrieveDataObject() const = 0;
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index bca23cb33e..229e485e22 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -907,7 +907,7 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
// the keys are not passed to the active media player.
# if QT_CONFIG(shortcut)
- const QKeySequence sequence(Qt::Modifier(state) + qtKey);
+ const QKeySequence sequence(Qt::Modifier(state) | Qt::Key(qtKey));
return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence);
# else
return false;
@@ -1255,7 +1255,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
#ifndef QT_NO_SHORTCUT
// Is Qt interested in the context menu key?
if (modifiers == Qt::SHIFT && code == Qt::Key_F10
- && !QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(QKeySequence(Qt::SHIFT + Qt::Key_F10))) {
+ && !QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(QKeySequence(Qt::SHIFT | Qt::Key_F10))) {
return false;
}
#endif // !QT_NO_SHORTCUT
@@ -1376,17 +1376,17 @@ QList<int> QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const
quint32 baseKey = kbItem.qtKey[0];
Qt::KeyboardModifiers keyMods = e->modifiers();
if (baseKey == Qt::Key_Return && (e->nativeModifiers() & ExtendedKey)) {
- result << int(Qt::Key_Enter + keyMods);
+ result << int(Qt::Key_Enter | keyMods);
return result;
}
- result << int(baseKey + keyMods); // The base key is _always_ valid, of course
+ result << int(baseKey) + int(keyMods); // The base key is _always_ valid, of course
for (size_t i = 1; i < NumMods; ++i) {
Qt::KeyboardModifiers neededMods = ModsTbl[i];
quint32 key = kbItem.qtKey[i];
if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) {
const Qt::KeyboardModifiers missingMods = keyMods & ~neededMods;
- const int matchedKey = int(key) + missingMods;
+ const int matchedKey = int(key) + int(missingMods);
const auto it =
std::find_if(result.begin(), result.end(),
[key] (int k) { return (k & ~Qt::KeyboardModifierMask) == key; });
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index 7cd35c7308..49bbe88d34 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -525,7 +525,7 @@ QDebug operator<<(QDebug d, IDataObject *dataObj)
/*!
\fn QVariant QWindowsMime::convertToMime(const QString &mimeType, IDataObject *pDataObj,
- QVariant::Type preferredType) const
+ QMetaType preferredType) const
Returns a QVariant containing the converted data for \a mimeType from \a pDataObj.
If possible the QVariant should be of the \a preferredType to avoid needless conversions.
@@ -544,11 +544,11 @@ QDebug operator<<(QDebug d, IDataObject *dataObj)
All subclasses must reimplement this pure virtual function.
*/
-class QWindowsMimeText : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeText : public QNativeInterface::Private::QWindowsMime
{
public:
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const override;
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const override;
@@ -664,7 +664,7 @@ QList<FORMATETC> QWindowsMimeText::formatsForMime(const QString &mimeType, const
return formatics;
}
-QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QMetaType preferredType) const
{
QVariant ret;
@@ -678,7 +678,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
data = getData(CF_TEXT, pDataObj);
if (!data.isEmpty()) {
const char* d = data.data();
- const unsigned s = qstrlen(d);
+ const unsigned s = unsigned(qstrlen(d));
QByteArray r(data.size()+1, '\0');
char* o = r.data();
int j=0;
@@ -691,7 +691,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
str = QString::fromLocal8Bit(r);
}
}
- if (preferredType == QVariant::String)
+ if (preferredType.id() == QMetaType::QString)
ret = str;
else
ret = std::move(str).toUtf8();
@@ -700,12 +700,12 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
return ret;
}
-class QWindowsMimeURI : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeURI : public QNativeInterface::Private::QWindowsMime
{
public:
QWindowsMimeURI();
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const override;
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const override;
@@ -819,7 +819,7 @@ QList<FORMATETC> QWindowsMimeURI::formatsForMime(const QString &mimeType, const
return formatics;
}
-QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QMetaType preferredType) const
{
if (mimeType == u"text/uri-list") {
if (canGetData(CF_HDROP, pDataObj)) {
@@ -847,7 +847,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
}
}
- if (preferredType == QVariant::Url && urls.size() == 1)
+ if (preferredType.id() == QMetaType::QUrl && urls.size() == 1)
return urls.at(0);
if (!urls.isEmpty())
return urls;
@@ -866,7 +866,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
return QVariant();
}
-class QWindowsMimeHtml : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeHtml : public QNativeInterface::Private::QWindowsMime
{
public:
QWindowsMimeHtml();
@@ -878,7 +878,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
@@ -928,14 +928,14 @@ in bytes). Charset used is mostly utf8, but can be different, ie. we have to loo
...html...
*/
-QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const
{
Q_UNUSED(preferredType);
QVariant result;
if (canConvertToMime(mime, pDataObj)) {
QByteArray html = getData(CF_HTML, pDataObj);
- static Q_RELAXED_CONSTEXPR auto startMatcher = qMakeStaticByteArrayMatcher("StartHTML:");
- static Q_RELAXED_CONSTEXPR auto endMatcher = qMakeStaticByteArrayMatcher("EndHTML:");
+ static constexpr auto startMatcher = qMakeStaticByteArrayMatcher("StartHTML:");
+ static constexpr auto endMatcher = qMakeStaticByteArrayMatcher("EndHTML:");
qCDebug(lcQpaMime) << __FUNCTION__ << "raw:" << html;
int start = startMatcher.indexIn(html);
int end = endMatcher.indexIn(html);
@@ -978,8 +978,8 @@ bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeDa
"StartFragment:0000000000\r\n" // 56-81
"EndFragment:0000000000\r\n\r\n"; // 82-107
- static Q_RELAXED_CONSTEXPR auto startFragmentMatcher = qMakeStaticByteArrayMatcher("<!--StartFragment-->");
- static Q_RELAXED_CONSTEXPR auto endFragmentMatcher = qMakeStaticByteArrayMatcher("<!--EndFragment-->");
+ static constexpr auto startFragmentMatcher = qMakeStaticByteArrayMatcher("<!--StartFragment-->");
+ static constexpr auto endFragmentMatcher = qMakeStaticByteArrayMatcher("<!--EndFragment-->");
if (startFragmentMatcher.indexIn(data) == -1)
result += "<!--StartFragment-->";
@@ -1004,7 +1004,7 @@ bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeDa
#ifndef QT_NO_IMAGEFORMAT_BMP
-class QWindowsMimeImage : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeImage : public QNativeInterface::Private::QWindowsMime
{
public:
QWindowsMimeImage();
@@ -1015,7 +1015,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
bool hasOriginalDIBV5(IDataObject *pDataObj) const;
@@ -1122,7 +1122,7 @@ bool QWindowsMimeImage::hasOriginalDIBV5(IDataObject *pDataObj) const
return !isSynthesized;
}
-QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *pDataObj, QMetaType preferredType) const
{
Q_UNUSED(preferredType);
QVariant result;
@@ -1158,7 +1158,7 @@ QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *
}
#endif
-class QBuiltInMimes : public QPlatformInterface::Private::QWindowsMime
+class QBuiltInMimes : public QNativeInterface::Private::QWindowsMime
{
public:
QBuiltInMimes();
@@ -1170,7 +1170,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
@@ -1255,14 +1255,14 @@ bool QBuiltInMimes::canConvertToMime(const QString &mimeType, IDataObject *pData
return mit != inFormats.cend() && canGetData(mit.key(), pDataObj);
}
-QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QMetaType preferredType) const
{
QVariant val;
if (canConvertToMime(mimeType, pDataObj)) {
QByteArray data = getData(inFormats.key(mimeType), pDataObj);
if (!data.isEmpty()) {
qCDebug(lcQpaMime) << __FUNCTION__;
- if (mimeType == u"text/html" && preferredType == QVariant::String) {
+ if (mimeType == u"text/html" && preferredType == QMetaType(QMetaType::QString)) {
// text/html is in wide chars on windows (compatible with Mozilla)
val = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData()));
} else {
@@ -1279,7 +1279,7 @@ QString QBuiltInMimes::mimeForFormat(const FORMATETC &formatetc) const
}
-class QLastResortMimes : public QPlatformInterface::Private::QWindowsMime
+class QLastResortMimes : public QNativeInterface::Private::QWindowsMime
{
public:
@@ -1291,7 +1291,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
@@ -1411,7 +1411,7 @@ bool QLastResortMimes::canConvertToMime(const QString &mimeType, IDataObject *pD
return canGetData(cf, pDataObj);
}
-QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QMetaType preferredType) const
{
Q_UNUSED(preferredType);
QVariant val;
@@ -1572,7 +1572,7 @@ QString QWindowsMimeConverter::clipboardFormatName(int cf)
QVariant QWindowsMimeConverter::convertToMime(const QStringList &mimeTypes,
IDataObject *pDataObj,
- QVariant::Type preferredType,
+ QMetaType preferredType,
QString *formatIn /* = 0 */) const
{
for (const QString &format : mimeTypes) {
@@ -1589,7 +1589,7 @@ QVariant QWindowsMimeConverter::convertToMime(const QStringList &mimeTypes,
}
}
}
- qCDebug(lcQpaMime) << __FUNCTION__ << "fails" << mimeTypes << pDataObj << preferredType;
+ qCDebug(lcQpaMime) << __FUNCTION__ << "fails" << mimeTypes << pDataObj << preferredType.id();
return QVariant();
}
diff --git a/src/plugins/platforms/windows/qwindowsmime.h b/src/plugins/platforms/windows/qwindowsmime.h
index ee71bee2ba..e131dba848 100644
--- a/src/plugins/platforms/windows/qwindowsmime.h
+++ b/src/plugins/platforms/windows/qwindowsmime.h
@@ -56,7 +56,7 @@ class QWindowsMimeConverter
{
Q_DISABLE_COPY_MOVE(QWindowsMimeConverter)
public:
- using QWindowsMime = QPlatformInterface::Private::QWindowsMime;
+ using QWindowsMime = QNativeInterface::Private::QWindowsMime;
QWindowsMimeConverter();
~QWindowsMimeConverter();
@@ -67,7 +67,7 @@ public:
QList<FORMATETC> allFormatsForMime(const QMimeData *mimeData) const;
// Convenience.
- QVariant convertToMime(const QStringList &mimeTypes, IDataObject *pDataObj, QVariant::Type preferredType,
+ QVariant convertToMime(const QStringList &mimeTypes, IDataObject *pDataObj, QMetaType preferredType,
QString *format = nullptr) const;
void registerMime(QWindowsMime *mime);
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 5e2710bc28..02c59d4d27 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -143,7 +143,7 @@ Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons()
if (GetAsyncKeyState(VK_RBUTTON) < 0)
result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton;
if (GetAsyncKeyState(VK_MBUTTON) < 0)
- result |= Qt::MidButton;
+ result |= Qt::MiddleButton;
if (GetAsyncKeyState(VK_XBUTTON1) < 0)
result |= Qt::XButton1;
if (GetAsyncKeyState(VK_XBUTTON2) < 0)
@@ -187,11 +187,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_LBUTTONDBLCLK: // Qt QPA does not handle double clicks, send as press
return {QEvent::MouseButtonPress, Qt::LeftButton};
case WM_MBUTTONDOWN:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_MBUTTONUP:
- return {QEvent::MouseButtonRelease, Qt::MidButton};
+ return {QEvent::MouseButtonRelease, Qt::MiddleButton};
case WM_MBUTTONDBLCLK:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_RBUTTONDOWN:
return {QEvent::MouseButtonPress, Qt::RightButton};
case WM_RBUTTONUP:
@@ -213,11 +213,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_NCLBUTTONDBLCLK:
return {QEvent::NonClientAreaMouseButtonPress, Qt::LeftButton};
case WM_NCMBUTTONDOWN:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCMBUTTONUP:
- return {QEvent::NonClientAreaMouseButtonRelease, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonRelease, Qt::MiddleButton};
case WM_NCMBUTTONDBLCLK:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCRBUTTONDOWN:
return {QEvent::NonClientAreaMouseButtonPress, Qt::RightButton};
case WM_NCRBUTTONUP:
diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h
index 759779c6c3..c556a3fb9c 100644
--- a/src/plugins/platforms/windows/qwindowsole.h
+++ b/src/plugins/platforms/windows/qwindowsole.h
@@ -65,17 +65,17 @@ public:
DWORD reportedPerformedEffect() const;
// IDataObject methods
- STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium);
- STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium);
- STDMETHOD(QueryGetData)(LPFORMATETC pformatetc);
- STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut);
- STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium,
- BOOL fRelease);
- STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc);
- STDMETHOD(DAdvise)(FORMATETC FAR* pFormatetc, DWORD advf,
- LPADVISESINK pAdvSink, DWORD FAR* pdwConnection);
- STDMETHOD(DUnadvise)(DWORD dwConnection);
- STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise);
+ STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium) override;
+ STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium) override;
+ STDMETHOD(QueryGetData)(LPFORMATETC pformatetc) override;
+ STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut) override;
+ STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR *pmedium, BOOL fRelease) override;
+ STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR *ppenumFormatEtc) override;
+ STDMETHOD(DAdvise)
+ (FORMATETC FAR *pFormatetc, DWORD advf, LPADVISESINK pAdvSink,
+ DWORD FAR *pdwConnection) override;
+ STDMETHOD(DUnadvise)(DWORD dwConnection) override;
+ STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR *ppenumAdvise) override;
private:
QPointer<QMimeData> data;
@@ -93,10 +93,10 @@ public:
bool isNull() const;
// IEnumFORMATETC methods
- STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetched);
- STDMETHOD(Skip)(ULONG celt);
- STDMETHOD(Reset)(void);
- STDMETHOD(Clone)(LPENUMFORMATETC FAR* newEnum);
+ STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR *pceltFetched) override;
+ STDMETHOD(Skip)(ULONG celt) override;
+ STDMETHOD(Reset)(void) override;
+ STDMETHOD(Clone)(LPENUMFORMATETC FAR *newEnum) override;
private:
bool copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const;
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index 00ac7fa2b7..0b1af47a65 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -263,7 +263,7 @@ static inline QString resolveBugListFile(const QString &fileName)
return fileName;
// Try QLibraryInfo::SettingsPath which is typically empty unless specified in qt.conf,
// then resolve via QStandardPaths::ConfigLocation.
- const QString settingsPath = QLibraryInfo::location(QLibraryInfo::SettingsPath);
+ const QString settingsPath = QLibraryInfo::path(QLibraryInfo::SettingsPath);
if (!settingsPath.isEmpty()) { // SettingsPath is empty unless specified in qt.conf.
const QFileInfo fi(settingsPath + u'/' + fileName);
if (fi.isFile())
@@ -283,7 +283,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
#if defined(QT_NO_OPENGL)
Q_UNUSED(gpu);
Q_UNUSED(requested);
- return 0;
+ return {};
#else
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description);
SupportedRenderersCache *srCache = supportedRenderersCache();
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index d5c3aeacff..41f17f5c3b 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -45,6 +45,9 @@
#endif
#include "qwindowspointerhandler.h"
+#if QT_CONFIG(tabletevent)
+# include "qwindowstabletsupport.h"
+#endif
#include "qwindowskeymapper.h"
#include "qwindowscontext.h"
#include "qwindowswindow.h"
@@ -197,11 +200,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_LBUTTONDBLCLK: // Qt QPA does not handle double clicks, send as press
return {QEvent::MouseButtonPress, Qt::LeftButton};
case WM_MBUTTONDOWN:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_MBUTTONUP:
- return {QEvent::MouseButtonRelease, Qt::MidButton};
+ return {QEvent::MouseButtonRelease, Qt::MiddleButton};
case WM_MBUTTONDBLCLK:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_RBUTTONDOWN:
return {QEvent::MouseButtonPress, Qt::RightButton};
case WM_RBUTTONUP:
@@ -223,11 +226,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_NCLBUTTONDBLCLK:
return {QEvent::NonClientAreaMouseButtonPress, Qt::LeftButton};
case WM_NCMBUTTONDOWN:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCMBUTTONUP:
- return {QEvent::NonClientAreaMouseButtonRelease, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonRelease, Qt::MiddleButton};
case WM_NCMBUTTONDBLCLK:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCRBUTTONDOWN:
return {QEvent::NonClientAreaMouseButtonPress, Qt::RightButton};
case WM_NCRBUTTONUP:
@@ -265,7 +268,7 @@ static Qt::MouseButtons queryMouseButtons()
if (GetAsyncKeyState(VK_RBUTTON) < 0)
result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton;
if (GetAsyncKeyState(VK_MBUTTON) < 0)
- result |= Qt::MidButton;
+ result |= Qt::MiddleButton;
if (GetAsyncKeyState(VK_XBUTTON1) < 0)
result |= Qt::XButton1;
if (GetAsyncKeyState(VK_XBUTTON2) < 0)
@@ -552,6 +555,17 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
return false; // Allow mouse messages to be generated.
}
+#if QT_CONFIG(tabletevent)
+QWindowsPointerHandler::QPointingDevicePtr QWindowsPointerHandler::findTabletDevice(QPointingDevice::PointerType pointerType) const
+{
+ for (const auto &d : m_tabletDevices) {
+ if (d->pointerType() == pointerType)
+ return d;
+ }
+ return {};
+}
+#endif
+
bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et,
MSG msg, PVOID vPenInfo)
{
@@ -565,28 +579,31 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
if (!QWindowsContext::user32dll.getPointerDeviceRects(penInfo->pointerInfo.sourceDevice, &pRect, &dRect))
return false;
- const auto sourceDevice = (qint64)penInfo->pointerInfo.sourceDevice;
+ const auto systemId = (qint64)penInfo->pointerInfo.sourceDevice;
const QPoint globalPos = QPoint(penInfo->pointerInfo.ptPixelLocation.x, penInfo->pointerInfo.ptPixelLocation.y);
const QPoint localPos = QWindowsGeometryHint::mapFromGlobal(hwnd, globalPos);
const QPointF hiResGlobalPos = QPointF(dRect.left + qreal(penInfo->pointerInfo.ptHimetricLocation.x - pRect.left)
/ (pRect.right - pRect.left) * (dRect.right - dRect.left),
dRect.top + qreal(penInfo->pointerInfo.ptHimetricLocation.y - pRect.top)
/ (pRect.bottom - pRect.top) * (dRect.bottom - dRect.top));
- const qreal pressure = (penInfo->penMask & PEN_MASK_PRESSURE) ? qreal(penInfo->pressure) / 1024.0 : 0.5;
- const qreal rotation = (penInfo->penMask & PEN_MASK_ROTATION) ? qreal(penInfo->rotation) : 0.0;
+ const bool hasPressure = (penInfo->penMask & PEN_MASK_PRESSURE) != 0;
+ const bool hasRotation = (penInfo->penMask & PEN_MASK_ROTATION) != 0;
+ const qreal pressure = hasPressure ? qreal(penInfo->pressure) / 1024.0 : 0.5;
+ const qreal rotation = hasRotation ? qreal(penInfo->rotation) : 0.0;
const qreal tangentialPressure = 0.0;
- const int xTilt = (penInfo->penMask & PEN_MASK_TILT_X) ? penInfo->tiltX : 0;
- const int yTilt = (penInfo->penMask & PEN_MASK_TILT_Y) ? penInfo->tiltY : 0;
+ const bool hasTiltX = (penInfo->penMask & PEN_MASK_TILT_X) != 0;
+ const bool hasTiltY = (penInfo->penMask & PEN_MASK_TILT_Y) != 0;
+ const int xTilt = hasTiltX ? penInfo->tiltX : 0;
+ const int yTilt = hasTiltY ? penInfo->tiltY : 0;
const int z = 0;
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaEvents).noquote().nospace() << Qt::showbase
- << __FUNCTION__ << " sourceDevice=" << sourceDevice
+ << __FUNCTION__ << " systemId=" << systemId
<< " globalPos=" << globalPos << " localPos=" << localPos << " hiResGlobalPos=" << hiResGlobalPos
<< " message=" << Qt::hex << msg.message
<< " flags=" << Qt::hex << penInfo->pointerInfo.pointerFlags;
- const QInputDevice::DeviceType device = QInputDevice::DeviceType::Stylus;
QPointingDevice::PointerType type;
// Since it may be the middle button, so if the checks fail then it should
// be set to Middle if it was used.
@@ -604,9 +621,33 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
mouseButtons = Qt::RightButton; // Either left or right, not both
}
+ auto device = findTabletDevice(type);
+ if (device.isNull()) {
+ QInputDevice::Capabilities caps(QInputDevice::Capability::Position
+ | QInputDevice::Capability::MouseEmulation
+ | QInputDevice::Capability::Hover);
+ if (hasPressure)
+ caps |= QInputDevice::Capability::Pressure;
+ if (hasRotation)
+ caps |= QInputDevice::Capability::Rotation;
+ if (hasTiltX)
+ caps |= QInputDevice::Capability::XTilt;
+ if (hasTiltY)
+ caps |= QInputDevice::Capability::YTilt;
+ const qint64 uniqueId = systemId | (qint64(type) << 32L);
+ device.reset(new QPointingDevice(QStringLiteral("wmpointer"),
+ systemId, QInputDevice::DeviceType::Stylus,
+ type, caps, 1, 3, QString(),
+ QPointingDeviceUniqueId::fromNumericId(uniqueId)));
+ QWindowSystemInterface::registerInputDevice(device.data());
+ m_tabletDevices.append(device);
+ }
+
+ const auto uniqueId = device->uniqueId().numericId();
+
switch (msg.message) {
case WM_POINTERENTER: {
- QWindowSystemInterface::handleTabletEnterProximityEvent(int(device), int(type), sourceDevice);
+ QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(window, device.data(), true);
m_windowUnderPointer = window;
// The local coordinates may fall outside the window.
// Wait until the next update to send the enter event.
@@ -619,12 +660,12 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
m_windowUnderPointer = nullptr;
m_currentWindow = nullptr;
}
- QWindowSystemInterface::handleTabletLeaveProximityEvent(int(device), int(type), sourceDevice);
+ QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(window, device.data(), false);
break;
case WM_POINTERDOWN:
case WM_POINTERUP:
case WM_POINTERUPDATE: {
- QWindow *target = QGuiApplicationPrivate::tabletDevicePoint(sourceDevice).target; // Pass to window that grabbed it.
+ QWindow *target = QGuiApplicationPrivate::tabletDevicePoint(uniqueId).target; // Pass to window that grabbed it.
if (!target && m_windowUnderPointer)
target = m_windowUnderPointer;
if (!target)
@@ -644,9 +685,10 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
}
const Qt::KeyboardModifiers keyModifiers = QWindowsKeyMapper::queryKeyboardModifiers();
- QWindowSystemInterface::handleTabletEvent(target, localPos, hiResGlobalPos, int(device), int(type), mouseButtons,
- pressure, xTilt, yTilt, tangentialPressure, rotation, z,
- sourceDevice, keyModifiers);
+ QWindowSystemInterface::handleTabletEvent(target, device.data(),
+ localPos, hiResGlobalPos, mouseButtons,
+ pressure, xTilt, yTilt, tangentialPressure,
+ rotation, z, keyModifiers);
return false; // Allow mouse messages to be generated.
}
}
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.h b/src/plugins/platforms/windows/qwindowspointerhandler.h
index 3b204c675b..d0f0b816d3 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.h
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.h
@@ -45,6 +45,7 @@
#include <QtCore/qpointer.h>
#include <QtCore/qscopedpointer.h>
+#include <QtCore/qsharedpointer.h>
#include <QtCore/qhash.h>
#include <QtGui/qevent.h>
@@ -57,6 +58,8 @@ class QWindowsPointerHandler
{
Q_DISABLE_COPY_MOVE(QWindowsPointerHandler)
public:
+ using QPointingDevicePtr = QSharedPointer<QPointingDevice>;
+
QWindowsPointerHandler() = default;
~QWindowsPointerHandler();
bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);
@@ -76,8 +79,14 @@ private:
bool translateMouseWheelEvent(QWindow *window, QWindow *currentWindowUnderPointer, MSG msg, QPoint globalPos, Qt::KeyboardModifiers keyModifiers);
void handleCaptureRelease(QWindow *window, QWindow *currentWindowUnderPointer, HWND hwnd, QEvent::Type eventType, Qt::MouseButtons mouseButtons);
void handleEnterLeave(QWindow *window, QWindow *currentWindowUnderPointer, QPoint globalPos);
+#if QT_CONFIG(tabletevent)
+ QPointingDevicePtr findTabletDevice(QPointingDevice::PointerType pointerType) const;
+#endif
QPointingDevice *m_touchDevice = nullptr;
+#if QT_CONFIG(tabletevent)
+ QList<QPointingDevicePtr> m_tabletDevices;
+#endif
QHash<int, QPointF> m_lastTouchPositions;
QHash<DWORD, int> m_touchInputIDToTouchPointID;
QPointer<QWindow> m_windowUnderPointer;
diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp
index 8a95cc53a8..fe2d8a36c0 100644
--- a/src/plugins/platforms/windows/qwindowsservices.cpp
+++ b/src/plugins/platforms/windows/qwindowsservices.cpp
@@ -56,15 +56,25 @@ QT_BEGIN_NAMESPACE
enum { debug = 0 };
-static quintptr runShellExecute(const wchar_t *path)
+class QWindowsShellExecuteThread : public QThread
{
- HINSTANCE result = nullptr;
- if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE))) {
- result = ShellExecute(nullptr, nullptr, path, nullptr, nullptr, SW_SHOWNORMAL);
- CoUninitialize();
+public:
+ explicit QWindowsShellExecuteThread(const wchar_t *path) : m_path(path) { }
+
+ void run() override
+ {
+ if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE))) {
+ m_result = ShellExecute(nullptr, nullptr, m_path, nullptr, nullptr, SW_SHOWNORMAL);
+ CoUninitialize();
+ }
}
- return reinterpret_cast<quintptr>(result);
-}
+
+ HINSTANCE result() const { return m_result; }
+
+private:
+ HINSTANCE m_result = nullptr;
+ const wchar_t *m_path;
+};
static inline bool shellExecute(const QUrl &url)
{
@@ -75,13 +85,11 @@ static inline bool shellExecute(const QUrl &url)
// Run ShellExecute() in a thread since it may spin the event loop.
// Prevent it from interfering with processing of posted events (QTBUG-85676).
- quintptr result = 0;
- quintptr *resultPtr = &result;
- const auto path = reinterpret_cast<const wchar_t *>(nativeFilePath.utf16());
- QScopedPointer<QThread> thread(QThread::create([path, resultPtr]
- () { *resultPtr = runShellExecute(path); }));
- thread->start();
- thread->wait();
+ QWindowsShellExecuteThread thread(reinterpret_cast<const wchar_t *>(nativeFilePath.utf16()));
+ thread.start();
+ thread.wait();
+
+ const auto result = reinterpret_cast<quintptr>(thread.result());
// ShellExecute returns a value greater than 32 if successful
if (result <= 32) {
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index f86dbb0c5f..fe4a0d4054 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -133,11 +133,10 @@ QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
{
QDebugStateSaver saver(d);
d.nospace();
- d << "TabletDevice id:" << t.uniqueId << " pressure: " << t.minPressure
+ d << "TabletDevice id:" << t.systemId << " pressure: " << t.minPressure
<< ".." << t.maxPressure << " tan pressure: " << t.minTanPressure << ".."
<< t.maxTanPressure << " area: (" << t.minX << ',' << t.minY << ',' << t.minZ
- << ")..(" << t.maxX << ',' << t.maxY << ',' << t.maxZ << ") device "
- << t.currentDevice << " pointer " << t.currentPointerType;
+ << ")..(" << t.maxX << ',' << t.maxY << ',' << t.maxZ << ')';
return d;
}
@@ -166,6 +165,48 @@ QDebug operator<<(QDebug d, const LOGCONTEXT &lc)
}
#endif // !QT_NO_DEBUG_STREAM
+QWinTabPointingDevice *createInputDevice(const QSharedPointer<QWindowsTabletDeviceData> &d,
+ QInputDevice::DeviceType devType,
+ QPointingDevice::PointerType pointerType)
+{
+ const qint64 uniqueId = d->systemId | (qint64(devType) << 32)
+ | (qint64(pointerType) << 48L);
+ QInputDevice::Capabilities caps(QInputDevice::Capability::Position
+ | QInputDevice::Capability::Pressure
+ | QInputDevice::Capability::MouseEmulation
+ | QInputDevice::Capability::Hover);
+ if (d->zCapability)
+ caps |= QInputDevice::Capability::ZPosition;
+ if (d->tiltCapability) {
+ caps |= QInputDevice::Capability::XTilt
+ | QInputDevice::Capability::YTilt
+ | QInputDevice::Capability::Rotation
+ | QInputDevice::Capability::TangentialPressure;
+ }
+
+ auto result = new QWinTabPointingDevice(d, QStringLiteral("wintab"), d->systemId,
+ devType, pointerType, caps, 1,
+ d->buttonsMap.size(), QString(),
+ QPointingDeviceUniqueId::fromNumericId(uniqueId));
+ QWindowSystemInterface::registerInputDevice(result);
+ return result;
+}
+
+QWinTabPointingDevice::QWinTabPointingDevice(const QWinTabPointingDevice::DeviceDataPtr &data,
+ const QString &name, qint64 systemId,
+ QInputDevice::DeviceType devType,
+ QPointingDevice::PointerType pType,
+ QInputDevice::Capabilities caps,
+ int maxPoints, int buttonCount,
+ const QString &seatName,
+ QPointingDeviceUniqueId uniqueId,
+ QObject *parent)
+ : QPointingDevice(name, systemId, devType, pType, caps, maxPoints, buttonCount,
+ seatName, uniqueId, parent),
+ m_deviceData(data)
+{
+}
+
QWindowsWinTab32DLL QWindowsTabletSupport::m_winTab32DLL;
/*!
@@ -320,14 +361,6 @@ void QWindowsTabletSupport::notifyActivate()
qCDebug(lcQpaTablet) << __FUNCTION__ << result;
}
-static inline int indexOfDevice(const QList<QWindowsTabletDeviceData> &devices, qint64 uniqueId)
-{
- for (int i = 0; i < devices.size(); ++i)
- if (devices.at(i).uniqueId == uniqueId)
- return i;
- return -1;
-}
-
static inline QInputDevice::DeviceType deviceType(const UINT cursorType)
{
if (((cursorType & 0x0006) == 0x0002) && ((cursorType & CursorTypeBitMask) != 0x0902))
@@ -366,10 +399,65 @@ static inline QPointingDevice::PointerType pointerType(unsigned currentCursor)
return QPointingDevice::PointerType::Unknown;
}
-QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(qint64 uniqueId, UINT cursorType) const
+inline void QWindowsTabletSupport::enterProximity(ulong time, QWindow *window)
+{
+ enterLeaveProximity(true, time, window);
+}
+
+inline void QWindowsTabletSupport::leaveProximity(ulong time, QWindow *window)
+{
+ enterLeaveProximity(false, time, window);
+}
+
+void QWindowsTabletSupport::enterLeaveProximity(bool enter, ulong time, QWindow *window)
+{
+ Q_ASSERT(!m_currentDevice.isNull());
+ if (time == 0) // Some leave events do not have a time associated
+ ++m_eventTime;
+ else
+ m_eventTime = time;
+ QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(window, m_eventTime,
+ m_currentDevice.data(),
+ enter);
+}
+
+QWindowsTabletSupport::DevicePtr QWindowsTabletSupport::findDevice(qint64 systemId) const
+{
+ for (const auto &d : m_devices) {
+ if (d->deviceData()->systemId == systemId)
+ return d;
+ }
+ return {};
+}
+
+QWindowsTabletSupport::DevicePtr QWindowsTabletSupport::findDevice(qint64 systemId,
+ QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType) const
+{
+ for (const auto &d : m_devices) {
+ if (d->deviceData()->systemId == systemId && d->type() == deviceType
+ && d->pointerType() == pointerType) {
+ return d;
+ }
+ }
+ return {};
+}
+
+// Clone a device for a new pointer type.
+QWindowsTabletSupport::DevicePtr QWindowsTabletSupport::clonePhysicalDevice(qint64 systemId,
+ QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType)
+{
+ auto similar = findDevice(systemId);
+ if (similar.isNull())
+ return {};
+ DevicePtr result(createInputDevice(similar->deviceData(), deviceType, pointerType));
+ m_devices.append(result);
+ return result;
+}
+
+void QWindowsTabletSupport::updateData(QWindowsTabletDeviceData *data) const
{
- QWindowsTabletDeviceData result;
- result.uniqueId = uniqueId;
/* browse WinTab's many info items to discover pressure handling. */
AXIS axis;
LOGCONTEXT lc;
@@ -377,22 +465,40 @@ QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(qint64 uniqueId, UINT
QWindowsTabletSupport::m_winTab32DLL.wTGet(m_context, &lc);
/* get the size of the pressure axis. */
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &axis);
- result.minPressure = int(axis.axMin);
- result.maxPressure = int(axis.axMax);
+ data->minPressure = int(axis.axMin);
+ data->maxPressure = int(axis.axMax);
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &axis);
- result.minTanPressure = int(axis.axMin);
- result.maxTanPressure = int(axis.axMax);
+ data->minTanPressure = int(axis.axMin);
+ data->maxTanPressure = int(axis.axMax);
LOGCONTEXT defaultLc;
/* get default region */
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEFCONTEXT, 0, &defaultLc);
- result.maxX = int(defaultLc.lcInExtX) - int(defaultLc.lcInOrgX);
- result.maxY = int(defaultLc.lcInExtY) - int(defaultLc.lcInOrgY);
- result.maxZ = int(defaultLc.lcInExtZ) - int(defaultLc.lcInOrgZ);
- result.currentDevice = deviceType(cursorType);
- result.zCapability = (cursorType == 0x0004);
- return result;
+ data->maxX = int(defaultLc.lcInExtX) - int(defaultLc.lcInOrgX);
+ data->maxY = int(defaultLc.lcInExtY) - int(defaultLc.lcInOrgY);
+ data->maxZ = int(defaultLc.lcInExtZ) - int(defaultLc.lcInOrgZ);
+}
+
+void QWindowsTabletSupport::updateButtons(unsigned currentCursor, QWindowsTabletDeviceData *data) const
+{
+ // We should check button map for changes on every proximity event, not
+ // only during initialization phase.
+ // WARNING: in 2016 there were some Wacom tablet drivers, which could mess up
+ // button mapping if the remapped button was pressed, while the
+ // application **didn't have input focus**. This bug is somehow
+ // related to the fact that Wacom drivers allow user to configure
+ // per-application button-mappings. If the bug shows up again,
+ // just move this button-map fetching into initialization block.
+ //
+ // See https://bugs.kde.org/show_bug.cgi?id=359561
+ BYTE logicalButtons[32];
+ memset(logicalButtons, 0, 32);
+ m_winTab32DLL.wTInfo(WTI_CURSORS + currentCursor, CSR_SYSBTNMAP, &logicalButtons);
+ data->buttonsMap.clear();
+ data->buttonsMap[0x1] = logicalButtons[0];
+ data->buttonsMap[0x2] = logicalButtons[1];
+ data->buttonsMap[0x4] = logicalButtons[2];
}
bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, LPARAM lParam)
@@ -401,21 +507,11 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L
const int totalPacks = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, 1, proximityBuffer);
if (!LOWORD(lParam)) {
- qCDebug(lcQpaTablet) << "leave proximity for device #" << m_currentDevice;
- if (m_currentDevice < 0 || m_currentDevice >= m_devices.size()) // QTBUG-65120, spurious leave observed
+ if (m_currentDevice.isNull()) // QTBUG-65120, spurious leave observed
return false;
+ qCDebug(lcQpaTablet) << "leave proximity for device #" << m_currentDevice.data();
m_state = PenUp;
- if (totalPacks > 0) {
- QWindowSystemInterface::handleTabletLeaveProximityEvent(proximityBuffer[0].pkTime,
- int(m_devices.at(m_currentDevice).currentDevice),
- int(m_devices.at(m_currentDevice).currentPointerType),
- m_devices.at(m_currentDevice).uniqueId);
- } else {
- QWindowSystemInterface::handleTabletLeaveProximityEvent(int(m_devices.at(m_currentDevice).currentDevice),
- int(m_devices.at(m_currentDevice).currentPointerType),
- m_devices.at(m_currentDevice).uniqueId);
-
- }
+ leaveProximity(totalPacks > 0 ? proximityBuffer[0].pkTime : 0u);
return true;
}
@@ -425,48 +521,37 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L
const UINT currentCursor = proximityBuffer[0].pkCursor;
UINT physicalCursorId;
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &physicalCursorId);
+ const qint64 systemId = physicalCursorId;
UINT cursorType;
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_CURSORS + currentCursor, CSR_TYPE, &cursorType);
- const qint64 uniqueId = (qint64(cursorType & DeviceIdMask) << 32L) | qint64(physicalCursorId);
+
+ const QInputDevice::DeviceType currentType = deviceType(cursorType);
+ const QPointingDevice::PointerType currentPointerType = pointerType(currentCursor);
// initializing and updating the cursor should be done in response to
// WT_CSRCHANGE. We do it in WT_PROXIMITY because some wintab never send
// the event WT_CSRCHANGE even if asked with CXO_CSRMESSAGES
- m_currentDevice = indexOfDevice(m_devices, uniqueId);
- if (m_currentDevice < 0) {
- m_currentDevice = m_devices.size();
- m_devices.push_back(tabletInit(uniqueId, cursorType));
+ m_currentDevice = findDevice(systemId, currentType, currentPointerType);
+ if (m_currentDevice.isNull())
+ m_currentDevice = clonePhysicalDevice(systemId, currentType, currentPointerType);
+ if (m_currentDevice.isNull()) {
+ QWinTabPointingDevice::DeviceDataPtr data(new QWindowsTabletDeviceData);
+ data->systemId = systemId;
+ data->tiltCapability = m_tiltSupport;
+ data->zCapability = (cursorType == 0x0004);
+ updateButtons(currentCursor, data.data());
+ m_currentDevice.reset(createInputDevice(data, currentType, currentPointerType));
+ m_devices.append(m_currentDevice);
}
- /**
- * We should check button map for changes on every proximity event, not
- * only during initialization phase.
- *
- * WARNING: in 2016 there were some Wacom table drivers, which could mess up
- * button mapping if the remapped button was pressed, while the
- * application **didn't have input focus**. This bug is somehow
- * related to the fact that Wacom drivers allow user to configure
- * per-application button-mappings. If the bug shows up again,
- * just move this button-map fetching into initialization block.
- *
- * See https://bugs.kde.org/show_bug.cgi?id=359561
- */
- BYTE logicalButtons[32];
- memset(logicalButtons, 0, 32);
- m_winTab32DLL.wTInfo(WTI_CURSORS + currentCursor, CSR_SYSBTNMAP, &logicalButtons);
- m_devices[m_currentDevice].buttonsMap[0x1] = logicalButtons[0];
- m_devices[m_currentDevice].buttonsMap[0x2] = logicalButtons[1];
- m_devices[m_currentDevice].buttonsMap[0x4] = logicalButtons[2];
+ // The user can switch pressure sensitivity level in the driver,which
+ // will make our saved values invalid (this option is provided by Wacom
+ // drivers for compatibility reasons, and it can be adjusted on the fly)
+ updateData(m_currentDevice->deviceData().data());
- m_devices[m_currentDevice].currentPointerType = pointerType(currentCursor);
m_state = PenProximity;
qCDebug(lcQpaTablet) << "enter proximity for device #"
- << m_currentDevice << m_devices.at(m_currentDevice);
- // TODO use the version taking a QPointingDevice, and own those instances; replace QWindowsTabletDeviceData
- // TODO QWindowSystemInterface::registerInputDevice() as early as possible, and before sending any events from it
- QWindowSystemInterface::handleTabletEnterProximityEvent(proximityBuffer[0].pkTime,
- int(m_devices.at(m_currentDevice).currentDevice),
- int(m_devices.at(m_currentDevice).currentPointerType),
- m_devices.at(m_currentDevice).uniqueId);
+ << m_currentDevice.data();
+ enterProximity(proximityBuffer[0].pkTime);
return true;
}
@@ -520,12 +605,10 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
{
static PACKET localPacketBuf[TabletPacketQSize]; // our own tablet packet queue.
const int packetCount = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, TabletPacketQSize, &localPacketBuf);
- if (!packetCount || m_currentDevice < 0)
+ if (!packetCount || m_currentDevice.isNull())
return false;
- const auto currentDevice = m_devices.at(m_currentDevice).currentDevice;
- const auto currentPointer = m_devices.at(m_currentDevice).currentPointerType;
- const qint64 uniqueId = m_devices.at(m_currentDevice).uniqueId;
+ const QWindowsTabletDeviceData &current = *m_currentDevice->deviceData();
// The tablet can be used in 2 different modes (reflected in enum Mode),
// depending on its settings:
@@ -545,8 +628,7 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
if (QWindowsContext::verbose > 1) {
qCDebug(lcQpaTablet) << __FUNCTION__ << "processing" << packetCount
- << "mode=" << m_mode << "target:"
- << QGuiApplicationPrivate::tabletDevicePoint(uniqueId).target;
+ << "mode=" << m_mode;
}
const Qt::KeyboardModifiers keyboardModifiers = QWindowsKeyMapper::queryKeyboardModifiers();
@@ -554,12 +636,31 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
for (int i = 0; i < packetCount ; ++i) {
const PACKET &packet = localPacketBuf[i];
- const int z = m_devices.at(m_currentDevice).zCapability ? int(packet.pkZ) : 0;
+ const int z = current.zCapability ? int(packet.pkZ) : 0;
+
+ const auto packetPointerType = pointerType(packet.pkCursor);
+
+ const Qt::MouseButtons buttons =
+ convertTabletButtons(packet.pkButtons, current);
+
+ if (buttons == Qt::NoButton && packetPointerType != m_currentDevice->pointerType()) {
+ leaveProximity(packet.pkTime);
+ Q_ASSERT(!m_currentDevice.isNull());
+ // Pointer type changed, find or clone a new device for this physical cursor.
+ const qint64 systemId = m_currentDevice->systemId();
+ const QInputDevice::DeviceType type = m_currentDevice->type();
+ m_currentDevice = findDevice(systemId, type, packetPointerType);
+ if (m_currentDevice.isNull())
+ m_currentDevice = clonePhysicalDevice(systemId, type, packetPointerType);
+ Q_ASSERT(!m_currentDevice.isNull());
+ enterProximity(packet.pkTime);
+ }
QPointF globalPosF =
- m_devices.at(m_currentDevice).scaleCoordinates(packet.pkX, packet.pkY, virtualDesktopArea);
+ current.scaleCoordinates(packet.pkX, packet.pkY, virtualDesktopArea);
- QWindow *target = QGuiApplicationPrivate::tabletDevicePoint(uniqueId).target; // Pass to window that grabbed it.
+ // Pass to window that grabbed it.
+ QWindow *target = QGuiApplicationPrivate::tabletDevicePoint(m_currentDevice->uniqueId().numericId()).target;
// Get Mouse Position and compare to tablet info
const QPoint mouseLocation = QWindowsCursor::mousePosition();
@@ -583,12 +684,12 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
Q_ASSERT(platformWindow);
const QPoint localPos = platformWindow->mapFromGlobal(globalPos);
- const qreal pressureNew = packet.pkButtons && (currentPointer == QPointingDevice::PointerType::Pen || currentPointer == QPointingDevice::PointerType::Eraser) ?
- m_devices.at(m_currentDevice).scalePressure(packet.pkNormalPressure) :
- qreal(0);
- const qreal tangentialPressure = currentDevice == QInputDevice::DeviceType::Airbrush ?
- m_devices.at(m_currentDevice).scaleTangentialPressure(packet.pkTangentPressure) :
- qreal(0);
+ const qreal pressureNew = packet.pkButtons
+ && (m_currentDevice->pointerType() == QPointingDevice::PointerType::Pen
+ || m_currentDevice->pointerType() == QPointingDevice::PointerType::Eraser)
+ ? current.scalePressure(packet.pkNormalPressure) : qreal(0);
+ const qreal tangentialPressure = m_currentDevice->type() == QInputDevice::DeviceType::Airbrush
+ ? current.scaleTangentialPressure(packet.pkTangentPressure) : qreal(0);
int tiltX = 0;
int tiltY = 0;
@@ -617,20 +718,18 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
qCDebug(lcQpaTablet)
<< "Packet #" << i << '/' << packetCount << "button:" << packet.pkButtons
<< globalPosF << z << "to:" << target << localPos << "(packet" << packet.pkX
- << packet.pkY << ") dev:" << currentDevice << "pointer:"
- << currentPointer << "P:" << pressureNew << "tilt:" << tiltX << ','
- << tiltY << "tanP:" << tangentialPressure << "rotation:" << rotation;
+ << packet.pkY << ") dev:" << m_currentDevice->type() << "pointer:"
+ << m_currentDevice->pointerType() << "P:" << pressureNew << "tilt:" << tiltX << ','
+ << tiltY << "tanP:" << tangentialPressure << "rotation:" << rotation
+ << " target=" << target;
}
- Qt::MouseButtons buttons =
- convertTabletButtons(packet.pkButtons, m_devices.at(m_currentDevice));
-
- QWindowSystemInterface::handleTabletEvent(target, packet.pkTime, QPointF(localPos), globalPosF,
- int(currentDevice), int(currentPointer),
- buttons,
- pressureNew, tiltX, tiltY,
+ m_eventTime = packet.pkTime;
+ QWindowSystemInterface::handleTabletEvent(target, packet.pkTime,
+ m_currentDevice.data(),
+ QPointF(localPos), globalPosF,
+ buttons, pressureNew, tiltX, tiltY,
tangentialPressure, rotation, z,
- uniqueId,
keyboardModifiers);
}
return true;
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h
index 229677dae4..dca2800215 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.h
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.h
@@ -47,6 +47,7 @@
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qpoint.h>
+#include <QtCore/qsharedpointer.h>
#include <wintab.h>
@@ -83,6 +84,8 @@ struct QWindowsWinTab32DLL
PtrWTQueueSizeSet wTQueueSizeSet = nullptr;
};
+// Data associated with a physical cursor (system ID) which is shared between
+// devices of varying device type/pointer type.
struct QWindowsTabletDeviceData
{
QPointF scaleCoordinates(int coordX, int coordY,const QRect &targetArea) const;
@@ -99,13 +102,31 @@ struct QWindowsTabletDeviceData
int maxY = 0;
int minZ = 0;
int maxZ = 0;
- qint64 uniqueId = 0;
- QInputDevice::DeviceType currentDevice = QInputDevice::DeviceType::Unknown;
- QPointingDevice::PointerType currentPointerType = QPointingDevice::PointerType::Unknown;
+ qint64 systemId = 0;
bool zCapability = false;
+ bool tiltCapability = false;
QHash<quint8, quint8> buttonsMap;
};
+class QWinTabPointingDevice : public QPointingDevice
+{
+public:
+ using DeviceDataPtr = QSharedPointer<QWindowsTabletDeviceData>;
+
+ explicit QWinTabPointingDevice(const DeviceDataPtr &data,
+ const QString &name, qint64 systemId,
+ QInputDevice::DeviceType devType,
+ PointerType pType, Capabilities caps, int maxPoints,
+ int buttonCount, const QString &seatName = QString(),
+ QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(),
+ QObject *parent = nullptr);
+
+ const DeviceDataPtr &deviceData() const { return m_deviceData; }
+
+private:
+ DeviceDataPtr m_deviceData;
+};
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t);
#endif
@@ -117,6 +138,9 @@ class QWindowsTabletSupport
explicit QWindowsTabletSupport(HWND window, HCTX context);
public:
+ using DevicePtr = QSharedPointer<QWinTabPointingDevice>;
+ using Devices = QList<DevicePtr>;
+
enum Mode
{
PenMode,
@@ -146,16 +170,29 @@ public:
private:
unsigned options() const;
QWindowsTabletDeviceData tabletInit(qint64 uniqueId, UINT cursorType) const;
+ void updateData(QWindowsTabletDeviceData *data) const;
+ void updateButtons(unsigned currentCursor, QWindowsTabletDeviceData *data) const;
+ void enterProximity(ulong time = 0, QWindow *window = nullptr);
+ void leaveProximity(ulong time = 0, QWindow *window = nullptr);
+ void enterLeaveProximity(bool enter, ulong time, QWindow *window = nullptr);
+ DevicePtr findDevice(qint64 systemId) const;
+ DevicePtr findDevice(qint64 systemId,
+ QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType) const;
+ DevicePtr clonePhysicalDevice(qint64 systemId,
+ QInputDevice::DeviceType deviceType,
+ QPointingDevice::PointerType pointerType);
static QWindowsWinTab32DLL m_winTab32DLL;
const HWND m_window;
const HCTX m_context;
static int m_absoluteRange;
bool m_tiltSupport = false;
- QList<QWindowsTabletDeviceData> m_devices;
- int m_currentDevice = -1;
+ Devices m_devices;
+ DevicePtr m_currentDevice;
Mode m_mode = PenMode;
State m_state = PenUp;
+ ulong m_eventTime = 0;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index ea74d8e372..0c778ecd24 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -888,7 +888,7 @@ public:
explicit QWindowsFileIconEngine(const QFileInfo &info, QPlatformTheme::IconOptions opts) :
QAbstractFileIconEngine(info, opts) {}
- QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) const override
+ QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) override
{ return QWindowsTheme::instance()->availableFileIconSizes(); }
protected:
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index a7cc36951a..5987324ac1 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1356,8 +1356,7 @@ bool QWindowsWindow::m_borderInFullScreenDefault = false;
QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) :
QWindowsBaseWindow(aWindow),
m_data(data),
- m_cursor(new CursorHandle),
- m_format(aWindow->requestedFormat())
+ m_cursor(new CursorHandle)
#if QT_CONFIG(vulkan)
, m_vkSurface(VK_NULL_HANDLE)
#endif
@@ -1431,6 +1430,11 @@ void QWindowsWindow::initialize()
}
}
+QSurfaceFormat QWindowsWindow::format() const
+{
+ return window()->requestedFormat();
+}
+
void QWindowsWindow::fireExpose(const QRegion &region, bool force)
{
if (region.isEmpty() && !force)
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index beed3e17df..1f1af82da2 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -125,12 +125,12 @@ struct QWindowsWindowData
};
class QWindowsBaseWindow : public QPlatformWindow,
- public QPlatformInterface::Private::QWindowsWindow
+ public QNativeInterface::Private::QWindowsWindow
{
Q_DISABLE_COPY_MOVE(QWindowsBaseWindow)
public:
- using TouchWindowTouchType = QPlatformInterface::Private::QWindowsApplication::TouchWindowTouchType;
- using TouchWindowTouchTypes = QPlatformInterface::Private::QWindowsApplication::TouchWindowTouchTypes;
+ using TouchWindowTouchType = QNativeInterface::Private::QWindowsApplication::TouchWindowTouchType;
+ using TouchWindowTouchTypes = QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes;
explicit QWindowsBaseWindow(QWindow *window) : QPlatformWindow(window) {}
@@ -249,7 +249,7 @@ public:
using QPlatformWindow::screenForGeometry;
- QSurfaceFormat format() const override { return m_format; }
+ QSurfaceFormat format() const override;
void setGeometry(const QRect &rect) override;
QRect geometry() const override { return m_data.geometry; }
QRect normalGeometry() const override;
@@ -402,7 +402,6 @@ private:
QWindowsOleDropTarget *m_dropTarget = nullptr;
unsigned m_savedStyle = 0;
QRect m_savedFrameGeometry;
- const QSurfaceFormat m_format;
HICON m_iconSmall = nullptr;
HICON m_iconBig = nullptr;
void *m_surface = nullptr;
diff --git a/src/plugins/platforms/xcb/.prev_CMakeLists.txt b/src/plugins/platforms/xcb/.prev_CMakeLists.txt
index 0cf401037e..58f635c081 100644
--- a/src/plugins/platforms/xcb/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/xcb/.prev_CMakeLists.txt
@@ -4,7 +4,7 @@
## XcbQpa Module:
#####################################################################
-qt_add_module(XcbQpa
+qt_internal_add_module(XcbQpa
INTERNAL_MODULE
NO_MODULE_HEADERS
SOURCES
@@ -53,7 +53,6 @@ qt_add_module(XcbQpa
XCB::SYNC
XCB::XCB
XCB::XFIXES
- XCB::XINERAMA
XCB::XINPUT
XCB::XKB
XKB::XKB
@@ -62,50 +61,50 @@ qt_add_module(XcbQpa
## Scopes:
#####################################################################
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_glib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_glib
LIBRARIES
GLIB2::GLIB2
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
SOURCES
qxcbdrag.cpp qxcbdrag.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
PUBLIC_LIBRARIES
X11::XCB
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
SOURCES
qxcbsessionmanager.cpp qxcbsessionmanager.h
PUBLIC_LIBRARIES
${X11_SM_LIB} ${X11_ICE_LIB}
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
SOURCES
qxcbvulkaninstance.cpp qxcbvulkaninstance.h
qxcbvulkanwindow.cpp qxcbvulkanwindow.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
-qt_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
+qt_internal_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
COMPILE_OPTIONS
-ftemplate-depth=1024
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
SOURCES
nativepainting/qbackingstore_x11.cpp nativepainting/qbackingstore_x11_p.h
nativepainting/qcolormap_x11.cpp nativepainting/qcolormap_x11_p.h
@@ -118,12 +117,12 @@ qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
nativepainting
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
PUBLIC_LIBRARIES
PkgConfig::XRender
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
LIBRARIES
WrapFreetype::WrapFreetype
)
diff --git a/src/plugins/platforms/xcb/CMakeLists.txt b/src/plugins/platforms/xcb/CMakeLists.txt
index 22a955fec6..7e78e9502f 100644
--- a/src/plugins/platforms/xcb/CMakeLists.txt
+++ b/src/plugins/platforms/xcb/CMakeLists.txt
@@ -4,7 +4,7 @@
## XcbQpa Module:
#####################################################################
-qt_add_module(XcbQpa
+qt_internal_add_module(XcbQpa
INTERNAL_MODULE
NO_MODULE_HEADERS
SOURCES
@@ -53,7 +53,7 @@ qt_add_module(XcbQpa
XCB::SYNC
XCB::XCB
XCB::XFIXES
- XCB::XINERAMA
+ # XCB::XINPUT # special case remove handled below
XCB::XKB
XKB::XKB
)
@@ -65,22 +65,22 @@ qt_disable_apple_app_extension_api_only(XcbQpa)
## Scopes:
#####################################################################
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_glib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_glib
LIBRARIES
GLIB2::GLIB2
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
SOURCES
qxcbdrag.cpp qxcbdrag.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
PUBLIC_LIBRARIES
X11::XCB
# special case begin
@@ -91,30 +91,30 @@ qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
# special case end
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
SOURCES
qxcbsessionmanager.cpp qxcbsessionmanager.h
PUBLIC_LIBRARIES
${X11_SM_LIB} ${X11_ICE_LIB}
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
SOURCES
qxcbvulkaninstance.cpp qxcbvulkaninstance.h
qxcbvulkanwindow.cpp qxcbvulkanwindow.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
-qt_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
+qt_internal_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
COMPILE_OPTIONS
-ftemplate-depth=1024
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
SOURCES
nativepainting/qbackingstore_x11.cpp nativepainting/qbackingstore_x11_p.h
nativepainting/qcolormap_x11.cpp nativepainting/qcolormap_x11_p.h
@@ -127,19 +127,19 @@ qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
nativepainting
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
PUBLIC_LIBRARIES
PkgConfig::XRender
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
LIBRARIES
WrapFreetype::WrapFreetype
)
# special case begin
if(TARGET XCB::XINPUT)
- qt_extend_target(XcbQpa LIBRARIES XCB::XINPUT)
+ qt_internal_extend_target(XcbQpa LIBRARIES XCB::XINPUT)
else()
set(xinput_source "${PROJECT_SOURCE_DIR}/src/3rdparty/xcb/libxcb/xinput.c")
set_source_files_properties(
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
index ddb4488105..be5c75aedc 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
class QXcbEglNativeInterfaceHandler;
class QXcbEglIntegration : public QXcbGlIntegration
- , public QPlatformInterface::Private::QEGLIntegration
+ , public QNativeInterface::Private::QEGLIntegration
{
public:
QXcbEglIntegration();
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt
index 94d9b60310..24cdf8f636 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt
@@ -29,12 +29,12 @@ qt_internal_add_plugin(QXcbGlxIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_xcb_glx
+qt_internal_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_xcb_glx
PUBLIC_LIBRARIES
XCB::GLX
)
-qt_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_dlopen AND NOT static
+qt_internal_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_dlopen AND NOT static
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
index a7468c8fac..62a9247fd9 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
@@ -54,7 +54,7 @@
QT_BEGIN_NAMESPACE
class QGLXContext : public QPlatformOpenGLContext,
- public QPlatformInterface::QGLXContext
+ public QNativeInterface::QGLXContext
{
public:
QGLXContext(Display *display, QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
index 18c1be9489..6b0c6dfee2 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
class QXcbNativeInterfaceHandler;
class QXcbGlxIntegration : public QXcbGlIntegration,
- public QPlatformInterface::Private::QGLXIntegration
+ public QNativeInterface::Private::QGLXIntegration
{
public:
QXcbGlxIntegration();
diff --git a/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp
index b4a9d64eb8..0eb522e1ed 100644
--- a/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp
@@ -320,7 +320,7 @@ static void init_direct(QXcbColormapPrivate *d, bool ownColormap)
XStoreColors(X11->display, d->colormap, colorTable.data(), colorTable.count());
}
-static QXcbColormap **cmaps = 0;
+static QXcbColormap **cmaps = nullptr;
void QXcbColormap::initialize()
{
@@ -343,7 +343,7 @@ void QXcbColormap::initialize()
d->visual = DefaultVisual(display, i);
d->defaultVisual = true;
- Visual *argbVisual = 0;
+ Visual *argbVisual = nullptr;
if (X11->visual && i == DefaultScreen(display)) {
// only use the outside colormap on the default screen
@@ -356,7 +356,7 @@ void QXcbColormap::initialize()
d->visual = find_visual(display, i, X11->visual_class, X11->visual_id,
&d->depth, &d->defaultVisual);
} else if (!X11->custom_cmap) {
- XStandardColormap *stdcmap = 0;
+ XStandardColormap *stdcmap = nullptr;
int ncmaps = 0;
#if QT_CONFIG(xrender)
diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
index ab0f537926..82900d4054 100644
--- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
@@ -2303,21 +2303,6 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co
#if QT_CONFIG(xrender)
if (X11->use_xrender && d->picture && qt_x11PictureHandle(pixmap)) {
-#if 0
- // ### Qt 5: enable this
- XRenderPictureAttributes attrs;
- attrs.repeat = true;
- XRenderChangePicture(d->dpy, pixmap.x11PictureHandle(), CPRepeat, &attrs);
-
- if (mono_src) {
- qt_render_bitmap(d->dpy, d->scrn, pixmap.x11PictureHandle(), d->picture,
- sx, sy, x, y, w, h, d->cpen);
- } else {
- XRenderComposite(d->dpy, d->composition_mode,
- pixmap.x11PictureHandle(), XNone, d->picture,
- sx, sy, 0, 0, x, y, w, h);
- }
-#else
const int numTiles = (w / pixmap.width()) * (h / pixmap.height());
if (numTiles < 100) {
// this is essentially qt_draw_tile(), inlined for
@@ -2400,7 +2385,6 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co
pmPicture, XNone, d->picture,
sx, sy, 0, 0, x, y, w, h);
}
-#endif
} else
#endif // QT_CONFIG(xrender)
if (pixmap.depth() > 1 && !static_cast<QX11PlatformPixmap*>(pixmap.handle())->x11_mask) {
diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp
index d55a49768c..bf45b409c5 100644
--- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp
@@ -282,9 +282,9 @@ static uint n_bits(uint v)
return i;
}
-static uint *red_scale_table = 0;
-static uint *green_scale_table = 0;
-static uint *blue_scale_table = 0;
+static uint *red_scale_table = nullptr;
+static uint *green_scale_table = nullptr;
+static uint *blue_scale_table = nullptr;
static void cleanup_scale_tables()
{
@@ -546,10 +546,10 @@ void QX11PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags f
Display *dpy = xinfo.display();
Visual *visual = (Visual *)xinfo.visual();
- XImage *xi = 0;
+ XImage *xi = nullptr;
bool trucol = (visual->c_class >= TrueColor);
size_t nbytes = image.sizeInBytes();
- uchar *newbits= 0;
+ uchar *newbits= nullptr;
#if QT_CONFIG(xrender)
if (alphaCheck.hasXRenderAndAlpha()) {
diff --git a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
index 1f7e7cf49b..117d5948cc 100644
--- a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
+++ b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
@@ -190,7 +190,7 @@ struct QX11InfoData {
};
template <class T>
-Q_DECL_RELAXED_CONSTEXPR inline int lowest_bit(T v) noexcept
+constexpr inline int lowest_bit(T v) noexcept
{
int result = qCountTrailingZeroBits(v);
return ((result >> 3) == sizeof(T)) ? -1 : result;
diff --git a/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp b/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp
index 1afa00cfc9..388f5aba76 100644
--- a/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp
@@ -725,7 +725,7 @@ void QTessellatorPrivate::cancelCoincidingEdges()
{
Vertex **vv = vertices.sorted;
- QCoincidingEdge *tl = 0;
+ QCoincidingEdge *tl = nullptr;
int tlSize = 0;
for (int i = 0; i < vertices.nPoints - 1; ++i) {
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 7330c3c9a3..bfcd1b2320 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -710,9 +710,10 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const
Q_ASSERT(!m_clientSideScroll);
ensureGC(dst);
- setClip(region);
if (hasShm()) {
+ setClip(region); // Clip in window local coordinates
+
// Copy scrolled area on server-side from pixmap to window
const QRegion scrolledRegion = m_scrolledRegion.translated(-offset);
for (const QRect &rect : scrolledRegion) {
@@ -733,7 +734,15 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const
const QRect bounds = region.boundingRect();
const QPoint target = bounds.topLeft();
const QRect source = bounds.translated(offset);
- flushPixmap(region);
+
+ // First clip in backingstore-local coordinates, and upload
+ // the changed parts of the backingstore to the server.
+ setClip(source);
+ flushPixmap(source);
+
+ // Then clip in window local coordinates, and copy the updated
+ // parts of the backingstore image server-side to the window.
+ setClip(region);
xcb_copy_area(xcb_connection(),
m_xcb_pixmap,
dst,
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 6d023035f2..56fe1a5b45 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -123,9 +123,9 @@ protected:
return list.contains(format);
}
- QVariant retrieveData_sys(const QString &fmt, QVariant::Type type) const override
+ QVariant retrieveData_sys(const QString &fmt, QMetaType type) const override
{
- auto requestedType = QMetaType::Type(type);
+ auto requestedType = type;
if (fmt.isEmpty() || isEmpty())
return QByteArray();
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 1478e58ccc..7435e124dc 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -459,7 +459,7 @@ static Qt::MouseButtons translateMouseButtons(int s)
if (s & XCB_BUTTON_MASK_1)
ret |= Qt::LeftButton;
if (s & XCB_BUTTON_MASK_2)
- ret |= Qt::MidButton;
+ ret |= Qt::MiddleButton;
if (s & XCB_BUTTON_MASK_3)
ret |= Qt::RightButton;
return ret;
@@ -475,7 +475,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s)
{
switch (s) {
case 1: return Qt::LeftButton;
- case 2: return Qt::MidButton;
+ case 2: return Qt::MiddleButton;
case 3: return Qt::RightButton;
// Button values 4-7 were already handled as Wheel events, and won't occur here.
case 8: return Qt::BackButton; // Also known as Qt::ExtraButton1
@@ -597,12 +597,16 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent);
}
case XCB_ENTER_NOTIFY:
- if (hasXInput2() && !xi2MouseEventsDisabled())
+ if (hasXInput2()) {
+ // Prefer XI2 enter (XCB_INPUT_ENTER) events over core events.
break;
+ }
HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent);
case XCB_LEAVE_NOTIFY:
- if (hasXInput2() && !xi2MouseEventsDisabled())
+ if (hasXInput2()) {
+ // Prefer XI2 leave (XCB_INPUT_LEAVE) events over core events.
break;
+ }
m_keyboard->updateXKBStateFromCore(reinterpret_cast<xcb_leave_notify_event_t *>(event)->state);
HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent);
case XCB_FOCUS_IN:
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index a097604643..77a9c9d934 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -225,9 +225,8 @@ public:
void xi2SelectStateEvents();
void xi2SelectDeviceEvents(xcb_window_t window);
- void xi2SelectDeviceEventsCompatibility(xcb_window_t window);
bool xi2SetMouseGrabEnabled(xcb_window_t w, bool grab);
- bool xi2MouseEventsDisabled() const;
+
Qt::MouseButton xiToQtMouseButton(uint32_t b);
void xi2UpdateScrollingDevices();
bool startSystemMoveResizeForTouch(xcb_window_t window, int edges);
diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp
index 18dee89adb..020412fc87 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp
@@ -43,7 +43,6 @@
#include <xcb/shm.h>
#include <xcb/sync.h>
#include <xcb/xfixes.h>
-#include <xcb/xinerama.h>
#include <xcb/render.h>
#include <xcb/xinput.h>
#define explicit dont_use_cxx_explicit
@@ -145,8 +144,6 @@ QXcbBasicConnection::QXcbBasicConnection(const char *displayName)
initializeShm();
if (!qEnvironmentVariableIsSet("QT_XCB_NO_XRANDR"))
initializeXRandr();
- if (!m_hasXRandr)
- initializeXinerama();
initializeXFixes();
initializeXRender();
if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2"))
@@ -307,17 +304,6 @@ void QXcbBasicConnection::initializeXRender()
m_xrenderVersion.second = xrenderQuery->minor_version;
}
-void QXcbBasicConnection::initializeXinerama()
-{
- const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_xinerama_id);
- if (!reply || !reply->present)
- return;
-
- auto xineramaActive = Q_XCB_REPLY(xcb_xinerama_is_active, m_xcbConnection);
- if (xineramaActive && xineramaActive->state)
- m_hasXinerama = true;
-}
-
void QXcbBasicConnection::initializeXFixes()
{
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_xfixes_id);
diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.h b/src/plugins/platforms/xcb/qxcbconnection_basic.h
index 109186f966..bda02ce9c2 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_basic.h
+++ b/src/plugins/platforms/xcb/qxcbconnection_basic.h
@@ -96,7 +96,6 @@ public:
bool hasShm() const { return m_hasShm; }
bool hasShmFd() const { return m_hasShmFd; }
bool hasXSync() const { return m_hasXSync; }
- bool hasXinerama() const { return m_hasXinerama; }
bool hasBigRequest() const;
bool isAtLeastXI21() const { return m_xi2Enabled && m_xi2Minor >= 1; }
@@ -113,7 +112,6 @@ protected:
void initializeXFixes();
void initializeXRender();
void initializeXRandr();
- void initializeXinerama();
void initializeXShape();
void initializeXKB();
void initializeXSync();
@@ -130,7 +128,6 @@ private:
QXcbAtom m_xcbAtom;
bool m_hasXFixes = false;
- bool m_hasXinerama = false;
bool m_hasXhape = false;
bool m_hasInputShape;
bool m_hasXRandr = false;
diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
index 9ba71ada37..82b0f65774 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
@@ -46,8 +46,6 @@
#include <qpa/qwindowsysteminterface.h>
-#include <xcb/xinerama.h>
-
void QXcbConnection::xrandrSelectEvents()
{
xcb_screen_iterator_t rootIter = xcb_setup_roots_iterator(setup());
@@ -358,21 +356,6 @@ void QXcbConnection::initializeScreens()
}
}
}
- } else if (hasXinerama()) {
- // Xinerama is available
- auto screens = Q_XCB_REPLY(xcb_xinerama_query_screens, xcb_connection());
- if (screens) {
- xcb_xinerama_screen_info_iterator_t it = xcb_xinerama_query_screens_screen_info_iterator(screens.get());
- while (it.rem) {
- xcb_xinerama_screen_info_t *screen_info = it.data;
- QXcbScreen *screen = new QXcbScreen(this, virtualDesktop,
- XCB_NONE, nullptr,
- screen_info, it.index);
- siblings << screen;
- m_screens << screen;
- xcb_xinerama_screen_info_next(&it);
- }
- }
}
if (siblings.isEmpty()) {
// If there are no XRandR outputs or XRandR extension is missing,
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index dc8a533388..b754476d61 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -500,108 +500,6 @@ void QXcbConnection::xi2SetupDevices()
qCDebug(lcQpaXInputDevices) << "multi-pointer X detected";
}
-/*! \internal
-
- Notes on QT_XCB_NO_XI2_MOUSE Handling:
-
- Here we don't select pointer button press/release and motion events on master devices, instead
- we select these events directly on slave devices. This means that a master device will fallback
- to sending core events for every XI_* event that is sent directly by a slave device. For more
- details see "Event processing for attached slave devices" in XInput2 specification. To prevent
- handling of the same event twice, we have checks for xi2MouseEventsDisabled() in XI2 event
- handlers (but this is somewhat inconsistent in some situations). If the purpose for
- QT_XCB_NO_XI2_MOUSE was so that an application using QAbstractNativeEventFilter would see core
- mouse events before they are handled by Qt then QT_XCB_NO_XI2_MOUSE won't always work as
- expected (e.g. we handle scroll event directly from a slave device event, before an application
- has seen the fallback core event from a master device).
-
- The commit introducing QT_XCB_NO_XI2_MOUSE also states that setting this envvar "restores the
- old behavior with broken grabbing". It did not elaborate why grabbing was not fixed for this
- code path. The issue that this envvar tries to solve seem to be less important than broken
- grabbing (broken apparently only for touch events). Thus, if you really want core mouse events
- in your application and do not care about broken touch, then use QT_XCB_NO_XI2 (more on this
- below) to disable the extension all together. The reason why grabbing might have not been fixed
- is that calling XIGrabDevice with this code path for some reason always returns AlreadyGrabbed
- (by debugging X server's code it appears that when we call XIGrabDevice, an X server first grabs
- pointer via core pointer and then fails to do XI2 grab with AlreadyGrabbed; disclaimer - I did
- not debug this in great detail). When we try supporting odd setups like QT_XCB_NO_XI2_MOUSE, we
- are asking for trouble anyways.
-
- In conclusion, introduction of QT_XCB_NO_XI2_MOUSE causes more issues than solves - the above
- mentioned inconsistencies, maintenance of this code path and that QT_XCB_NO_XI2_MOUSE replaces
- less important issue with somewhat more important issue. It also makes us to use less optimal
- code paths in certain situations (see xi2HandleHierarchyEvent). Using of QT_XCB_NO_XI2 has its
- drawbacks too - no tablet and touch events. So the only real fix in this case is at an
- application side (teach the application about xcb_ge_event_t events). Based on this,
- QT_XCB_NO_XI2_MOUSE will be removed in ### Qt 6. It should not have existed in the first place,
- native events seen by QAbstractNativeEventFilter is not really a public API, applications should
- expect changes at this level and do ifdefs if something changes between Qt version.
-*/
-void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
-{
- if (window == rootWindow())
- return;
-
- uint32_t mask = 0;
-
- if (isAtLeastXI22()) {
- mask |= XCB_INPUT_XI_EVENT_MASK_TOUCH_BEGIN;
- mask |= XCB_INPUT_XI_EVENT_MASK_TOUCH_UPDATE;
- mask |= XCB_INPUT_XI_EVENT_MASK_TOUCH_END;
-
- qt_xcb_input_event_mask_t xiMask;
- xiMask.header.deviceid = XCB_INPUT_DEVICE_ALL_MASTER;
- xiMask.header.mask_len = 1;
- xiMask.mask = mask;
-
- xcb_void_cookie_t cookie =
- xcb_input_xi_select_events_checked(xcb_connection(), window, 1, &xiMask.header);
- xcb_generic_error_t *error = xcb_request_check(xcb_connection(), cookie);
- if (error) {
- qCDebug(lcQpaXInput, "failed to select events, window %x, error code %d", window, error->error_code);
- free(error);
- } else {
- QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
- }
- }
-
- mask = XCB_INPUT_XI_EVENT_MASK_BUTTON_PRESS;
- mask |= XCB_INPUT_XI_EVENT_MASK_BUTTON_RELEASE;
- mask |= XCB_INPUT_XI_EVENT_MASK_MOTION;
-
-#if QT_CONFIG(tabletevent)
- QSet<int> tabletDevices;
- if (!m_tabletData.isEmpty()) {
- const int nrTablets = m_tabletData.count();
- QList<qt_xcb_input_event_mask_t> xiEventMask(nrTablets);
- for (int i = 0; i < nrTablets; ++i) {
- int deviceId = m_tabletData.at(i).deviceId;
- tabletDevices.insert(deviceId);
- xiEventMask[i].header.deviceid = deviceId;
- xiEventMask[i].header.mask_len = 1;
- xiEventMask[i].mask = mask;
- }
- xcb_input_xi_select_events(xcb_connection(), window, nrTablets, &(xiEventMask.data()->header));
- }
-#endif
-
- if (!m_scrollingDevices.isEmpty()) {
- QList<qt_xcb_input_event_mask_t> xiEventMask(m_scrollingDevices.size());
- int i = 0;
- for (const ScrollingDevice& scrollingDevice : qAsConst(m_scrollingDevices)) {
-#if QT_CONFIG(tabletevent)
- if (tabletDevices.contains(scrollingDevice.deviceId))
- continue; // All necessary events are already captured.
-#endif
- xiEventMask[i].header.deviceid = scrollingDevice.deviceId;
- xiEventMask[i].header.mask_len = 1;
- xiEventMask[i].mask = mask;
- i++;
- }
- xcb_input_xi_select_events(xcb_connection(), window, i, &(xiEventMask.data()->header));
- }
-}
-
QXcbConnection::TouchDeviceData *QXcbConnection::touchDeviceForId(int id)
{
TouchDeviceData *dev = nullptr;
@@ -769,8 +667,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
case XCB_INPUT_BUTTON_PRESS:
case XCB_INPUT_BUTTON_RELEASE:
case XCB_INPUT_MOTION:
- if (!xi2MouseEventsDisabled() && eventListener &&
- !(xiDeviceEvent->flags & XCB_INPUT_POINTER_EVENT_FLAGS_POINTER_EMULATED))
+ if (eventListener && !(xiDeviceEvent->flags & XCB_INPUT_POINTER_EVENT_FLAGS_POINTER_EMULATED))
eventListener->handleXIMouseEvent(event);
break;
@@ -786,7 +683,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
xi2ProcessTouch(xiDeviceEvent, platformWindow);
break;
}
- } else if (xiEnterEvent && !xi2MouseEventsDisabled() && eventListener) {
+ } else if (xiEnterEvent && eventListener) {
switch (xiEnterEvent->event_type) {
case XCB_INPUT_ENTER:
case XCB_INPUT_LEAVE:
@@ -796,14 +693,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
}
}
-bool QXcbConnection::xi2MouseEventsDisabled() const
-{
- static bool xi2MouseDisabled = qEnvironmentVariableIsSet("QT_XCB_NO_XI2_MOUSE");
- // FIXME: Don't use XInput2 mouse events when Xinerama extension
- // is enabled, because it causes problems with multi-monitor setup.
- return xi2MouseDisabled || hasXinerama();
-}
-
bool QXcbConnection::isTouchScreen(int id)
{
auto device = touchDeviceForId(id);
@@ -1064,15 +953,6 @@ void QXcbConnection::xi2HandleHierarchyEvent(void *event)
return;
xi2SetupDevices();
-
- if (xi2MouseEventsDisabled()) {
- // In compatibility mode (a.k.a xi2MouseEventsDisabled() mode) we select events for
- // each device separately. When a new device appears, we have to select events from
- // this device on all event-listening windows. This is not needed when events are
- // selected via XIAllDevices/XIAllMasterDevices (as in xi2SelectDeviceEvents()).
- for (auto it = m_mapper.cbegin(), end = m_mapper.cend(); it != end; ++it)
- xi2SelectDeviceEventsCompatibility(it.key());
- }
}
void QXcbConnection::xi2HandleDeviceChangedEvent(void *event)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 3e24027e51..d2143ce953 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -95,9 +95,9 @@ static xcb_window_t xdndProxy(QXcbConnection *c, xcb_window_t w)
if (reply && reply->type == XCB_ATOM_WINDOW) {
xcb_window_t p = *((xcb_window_t *)xcb_get_property_value(reply.get()));
if (proxy != p)
- proxy = 0;
+ proxy = XCB_NONE;
} else {
- proxy = 0;
+ proxy = XCB_NONE;
}
return proxy;
@@ -112,9 +112,9 @@ public:
protected:
bool hasFormat_sys(const QString &mimeType) const override;
QStringList formats_sys() const override;
- QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override;
+ QVariant retrieveData_sys(const QString &mimeType, QMetaType type) const override;
- QVariant xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const;
+ QVariant xdndObtainData(const QByteArray &format, QMetaType requestedType) const;
QXcbDrag *drag;
};
@@ -419,11 +419,12 @@ void QXcbDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardMod
auto reply = Q_XCB_REPLY(xcb_get_property, xcb_connection(),
false, proxy_target,
atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 1);
- if (!reply || reply->type == XCB_NONE)
+ if (!reply || reply->type == XCB_NONE) {
target = 0;
-
- target_version = *(uint32_t *)xcb_get_property_value(reply.get());
- target_version = qMin(xdnd_version, target_version ? target_version : 1);
+ } else {
+ target_version = *(uint32_t *)xcb_get_property_value(reply.get());
+ target_version = qMin(xdnd_version, target_version ? target_version : 1);
+ }
}
if (target != current_target) {
@@ -689,7 +690,7 @@ int QXcbDrag::findTransactionByTime(xcb_timestamp_t timestamp)
#if 0
// for embedding only
-static QWidget* current_embedding_widget = 0;
+static QWidget* current_embedding_widget = nullptr;
static xcb_client_message_event_t last_enter_event;
@@ -1065,7 +1066,7 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
setExecutedDropAction(response.acceptedAction());
- xcb_client_message_event_t finished;
+ xcb_client_message_event_t finished = {};
finished.response_type = XCB_CLIENT_MESSAGE;
finished.sequence = 0;
finished.window = xdnd_dragsource;
@@ -1341,14 +1342,14 @@ QXcbDropData::~QXcbDropData()
{
}
-QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const
+QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QMetaType requestedType) const
{
QByteArray mime = mimetype.toLatin1();
- QVariant data = xdndObtainData(mime, QMetaType::Type(requestedType));
+ QVariant data = xdndObtainData(mime, requestedType);
return data;
}
-QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const
+QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QMetaType requestedType) const
{
QByteArray result;
diff --git a/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp b/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
index 0545bdd5f1..5055057db9 100644
--- a/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
+++ b/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
@@ -63,18 +63,6 @@ bool QXcbUnixEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags
return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
}
-bool QXcbUnixEventDispatcher::hasPendingEvents()
-{
- extern uint qGlobalPostedEventsCount();
- return qGlobalPostedEventsCount() || QWindowSystemInterface::windowSystemEventsQueued();
-}
-
-void QXcbUnixEventDispatcher::flush()
-{
- if (qApp)
- qApp->sendPostedEvents();
-}
-
#if QT_CONFIG(glib)
struct XcbEventSource
{
diff --git a/src/plugins/platforms/xcb/qxcbeventdispatcher.h b/src/plugins/platforms/xcb/qxcbeventdispatcher.h
index ddf448cf87..8dffeef031 100644
--- a/src/plugins/platforms/xcb/qxcbeventdispatcher.h
+++ b/src/plugins/platforms/xcb/qxcbeventdispatcher.h
@@ -60,12 +60,6 @@ public:
~QXcbUnixEventDispatcher();
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
- // Maybe some user code depends on deprecated QUnixEventDispatcherQPA::
- // hasPendingEvents() / flush() implementation, so keep it around until
- // Qt 6. These methods are deprecated in QAbstractEventDispatcher.
- bool hasPendingEvents() override; // ### Qt 6 remove
- void flush() override; // ### Qt 6 remove
-
private:
QXcbConnection *m_connection;
};
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index c7b8fb86db..89395cb21d 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -142,8 +142,6 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
m_instance = this;
qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
- QWindowSystemInterface::setPlatformFiltersEvents(true);
-
qRegisterMetaType<QXcbWindow*>();
#if QT_CONFIG(xcb_xlib)
XInitThreads();
@@ -278,7 +276,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
QOpenGLContext *QXcbIntegration::createOpenGLContext(GLXContext context, void *visualInfo, QOpenGLContext *shareContext) const
{
- using namespace QPlatformInterface::Private;
+ using namespace QNativeInterface::Private;
if (auto *glxIntegration = dynamic_cast<QGLXIntegration*>(m_connection->glIntegration()))
return glxIntegration->createOpenGLContext(context, visualInfo, shareContext);
else
@@ -288,7 +286,7 @@ QOpenGLContext *QXcbIntegration::createOpenGLContext(GLXContext context, void *v
#if QT_CONFIG(egl)
QOpenGLContext *QXcbIntegration::createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const
{
- using namespace QPlatformInterface::Private;
+ using namespace QNativeInterface::Private;
if (auto *eglIntegration = dynamic_cast<QEGLIntegration*>(m_connection->glIntegration()))
return eglIntegration->createOpenGLContext(context, display, shareContext);
else
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 043dc13711..eb58433967 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -57,9 +57,9 @@ class QXcbNativeInterface;
class Q_XCB_EXPORT QXcbIntegration : public QPlatformIntegration
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QGLXIntegration
+ , public QNativeInterface::Private::QGLXIntegration
# if QT_CONFIG(egl)
- , public QPlatformInterface::Private::QEGLIntegration
+ , public QNativeInterface::Private::QEGLIntegration
# endif
#endif
{
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index bb168b9b00..738d0e3b91 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -158,14 +158,14 @@ QList<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, const
}
QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &d, const QString &format,
- QMetaType::Type requestedType, bool hasUtf8)
+ QMetaType requestedType, bool hasUtf8)
{
QByteArray data = d;
QString atomName = mimeAtomToString(connection, a);
// qDebug() << "mimeConvertDataToFormat" << format << atomName << data;
if (hasUtf8 && atomName == format + QLatin1String(";charset=utf-8")) {
- if (requestedType == QMetaType::QString)
+ if (requestedType.id() == QMetaType::QString)
return QString::fromUtf8(data);
return data;
}
@@ -255,7 +255,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
return QVariant();
}
-xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType,
+xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType requestedType,
const QList<xcb_atom_t> &atoms, bool *hasUtf8)
{
*hasUtf8 = false;
@@ -288,7 +288,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
// for string/text requests try to use a format with a well-defined charset
// first to avoid encoding problems
- if (requestedType == QMetaType::QString
+ if (requestedType.id() == QMetaType::QString
&& format.startsWith(QLatin1String("text/"))
&& !format.contains(QLatin1String("charset="))) {
diff --git a/src/plugins/platforms/xcb/qxcbmime.h b/src/plugins/platforms/xcb/qxcbmime.h
index d348bae77e..fe9b2249c9 100644
--- a/src/plugins/platforms/xcb/qxcbmime.h
+++ b/src/plugins/platforms/xcb/qxcbmime.h
@@ -60,8 +60,8 @@ public:
static bool mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeData *mimeData, QByteArray *data,
xcb_atom_t *atomFormat, int *dataFormat);
static QVariant mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format,
- QMetaType::Type requestedType, bool hasUtf8);
- static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType,
+ QMetaType requestedType, bool hasUtf8);
+ static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType requestedType,
const QList<xcb_atom_t> &atoms, bool *hasUtf8);
};
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 9dc7c97eab..e65418b077 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -112,11 +112,28 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
xcb_depth_next(&depth_iterator);
}
+
+ auto dpiChangedCallback = [](QXcbVirtualDesktop *desktop, const QByteArray &, const QVariant &property, void *) {
+ bool ok;
+ int dpiTimes1k = property.toInt(&ok);
+ if (!ok)
+ return;
+ int dpi = dpiTimes1k / 1024;
+ if (desktop->m_forcedDpi == dpi)
+ return;
+ desktop->m_forcedDpi = dpi;
+ for (QXcbScreen *screen : desktop->connection()->screens())
+ QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen->QPlatformScreen::screen(), dpi, dpi);
+ };
+ xSettings()->registerCallbackForProperty("Xft/DPI", dpiChangedCallback, nullptr);
}
QXcbVirtualDesktop::~QXcbVirtualDesktop()
{
delete m_xSettings;
+
+ for (auto cmap : qAsConst(m_visualColormaps))
+ xcb_free_colormap(xcb_connection(), cmap);
}
QDpi QXcbVirtualDesktop::dpi() const
@@ -479,9 +496,24 @@ quint8 QXcbVirtualDesktop::depthOfVisual(xcb_visualid_t visualid) const
return *it;
}
+xcb_colormap_t QXcbVirtualDesktop::colormapForVisual(xcb_visualid_t visualid) const
+{
+ auto it = m_visualColormaps.constFind(visualid);
+ if (it != m_visualColormaps.constEnd())
+ return *it;
+
+ auto cmap = xcb_generate_id(xcb_connection());
+ xcb_create_colormap(xcb_connection(),
+ XCB_COLORMAP_ALLOC_NONE,
+ cmap,
+ screen()->root,
+ visualid);
+ m_visualColormaps.insert(visualid, cmap);
+ return cmap;
+}
+
QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop,
- xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output,
- const xcb_xinerama_screen_info_t *xineramaScreenInfo, int xineramaScreenIdx)
+ xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output)
: QXcbObject(connection)
, m_virtualDesktop(virtualDesktop)
, m_output(outputId)
@@ -497,13 +529,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
updateGeometry(QRect(crtc->x, crtc->y, crtc->width, crtc->height), crtc->rotation);
updateRefreshRate(crtc->mode);
}
- } else if (xineramaScreenInfo) {
- m_geometry = QRect(xineramaScreenInfo->x_org, xineramaScreenInfo->y_org,
- xineramaScreenInfo->width, xineramaScreenInfo->height);
- m_availableGeometry = m_geometry & m_virtualDesktop->workArea();
- m_sizeMillimeters = sizeInMillimeters(m_geometry.size(), m_virtualDesktop->dpi());
- if (xineramaScreenIdx > -1)
- m_outputName += QLatin1Char('-') + QString::number(xineramaScreenIdx);
}
if (m_geometry.isEmpty())
@@ -684,7 +709,12 @@ QDpi QXcbScreen::logicalDpi() const
if (forcedDpi > 0)
return QDpi(forcedDpi, forcedDpi);
- return m_virtualDesktop->dpi();
+ // Fall back to 96 DPI in case no logical DPI is set. We don't want to
+ // return physical DPI here, since that is a differnt type of DPI: Logical
+ // DPI typically accounts for user preference and viewing distance, and is
+ // quantized into DPI classes (96, 144, 192, etc); pysical DPI is an exact
+ // physical measure.
+ return QDpi(96, 96);
}
QPlatformCursor *QXcbScreen::cursor() const
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 60ef82bae3..267c8b8911 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -47,7 +47,6 @@
#include <xcb/xcb.h>
#include <xcb/randr.h>
#include <xcb/xfixes.h>
-#include <xcb/xinerama.h>
#include "qxcbobject.h"
@@ -108,6 +107,7 @@ public:
const xcb_visualtype_t *visualForFormat(const QSurfaceFormat &format) const;
const xcb_visualtype_t *visualForId(xcb_visualid_t) const;
quint8 depthOfVisual(xcb_visualid_t) const;
+ xcb_colormap_t colormapForVisual(xcb_visualid_t) const;
private:
QRect getWorkArea() const;
@@ -134,16 +134,16 @@ private:
QString m_windowManagerName;
QMap<xcb_visualid_t, xcb_visualtype_t> m_visuals;
QMap<xcb_visualid_t, quint8> m_visualDepths;
+ mutable QMap<xcb_visualid_t, xcb_colormap_t> m_visualColormaps;
uint16_t m_rotation = 0;
};
class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen
- , public QPlatformInterface::Private::QXcbScreen
+ , public QNativeInterface::Private::QXcbScreen
{
public:
QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop,
- xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *outputInfo,
- const xcb_xinerama_screen_info_t *xineramaScreenInfo = nullptr, int xineramaScreenIdx = -1);
+ xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *outputInfo);
~QXcbScreen();
QString getOutputName(xcb_randr_get_output_info_reply_t *outputInfo);
@@ -192,6 +192,7 @@ public:
const xcb_visualtype_t *visualForFormat(const QSurfaceFormat &format) const { return m_virtualDesktop->visualForFormat(format); }
const xcb_visualtype_t *visualForId(xcb_visualid_t visualid) const;
+ xcb_colormap_t colormapForVisual(xcb_visualid_t visualid) const { return m_virtualDesktop->colormapForVisual(visualid); }
quint8 depthOfVisual(xcb_visualid_t visualid) const { return m_virtualDesktop->depthOfVisual(visualid); }
QString name() const override { return m_outputName; }
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 224f0bd4cb..359ee14488 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -356,23 +356,8 @@ void QXcbWindow::create()
| XCB_CW_BIT_GRAVITY
| XCB_CW_OVERRIDE_REDIRECT
| XCB_CW_SAVE_UNDER
- | XCB_CW_EVENT_MASK;
-
- static auto haveOpenGL = []() {
- static const bool result = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL);
- return result;
- };
-
- if ((window()->supportsOpenGL() && haveOpenGL()) || m_format.hasAlpha()) {
- m_cmap = xcb_generate_id(xcb_connection());
- xcb_create_colormap(xcb_connection(),
- XCB_COLORMAP_ALLOC_NONE,
- m_cmap,
- xcb_parent_id,
- m_visualId);
-
- mask |= XCB_CW_COLORMAP;
- }
+ | XCB_CW_EVENT_MASK
+ | XCB_CW_COLORMAP;
quint32 values[] = {
XCB_BACK_PIXMAP_NONE,
@@ -381,7 +366,7 @@ void QXcbWindow::create()
type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint),
type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer,
defaultEventMask,
- m_cmap
+ platformScreen->colormapForVisual(m_visualId)
};
m_window = xcb_generate_id(xcb_connection());
@@ -480,12 +465,8 @@ void QXcbWindow::create()
atom(QXcbAtom::_XEMBED_INFO),
32, 2, (void *)data);
- if (connection()->hasXInput2()) {
- if (connection()->xi2MouseEventsDisabled())
- connection()->xi2SelectDeviceEventsCompatibility(m_window);
- else
- connection()->xi2SelectDeviceEvents(m_window);
- }
+ if (connection()->hasXInput2())
+ connection()->xi2SelectDeviceEvents(m_window);
setWindowState(window()->windowStates());
setWindowFlags(window()->flags());
@@ -556,9 +537,7 @@ void QXcbWindow::destroy()
xcb_destroy_window(xcb_connection(), m_window);
m_window = 0;
}
- if (m_cmap) {
- xcb_free_colormap(xcb_connection(), m_cmap);
- }
+
m_mapped = false;
if (m_pendingSyncRequest)
@@ -1392,7 +1371,7 @@ void QXcbWindow::propagateSizeHints()
xcb_icccm_set_wm_normal_hints(xcb_connection(), m_window, &hints);
- m_sizeHintsScaleFactor = QHighDpiScaling::scaleAndOrigin(screen()).factor;
+ m_sizeHintsScaleFactor = QHighDpiScaling::factor(screen());
}
void QXcbWindow::requestActivateWindow()
@@ -1756,7 +1735,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
// will make the comparison later.
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
- if (!qFuzzyCompare(QHighDpiScaling::scaleAndOrigin(newScreen).factor, m_sizeHintsScaleFactor))
+ if (!qFuzzyCompare(QHighDpiScaling::factor(newScreen), m_sizeHintsScaleFactor))
propagateSizeHints();
// Send the synthetic expose event on resize only when the window is shrinked,
@@ -1915,7 +1894,7 @@ static inline bool doCheckUnGrabAncestor(QXcbConnection *conn)
*/
if (conn) {
const bool mouseButtonsPressed = (conn->buttonState() != Qt::NoButton);
- return mouseButtonsPressed || (conn->hasXInput2() && !conn->xi2MouseEventsDisabled());
+ return mouseButtonsPressed || conn->hasXInput2();
}
return true;
}
@@ -2266,7 +2245,7 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab)
if (grab && !connection()->canGrab())
return false;
- if (connection()->hasXInput2() && !connection()->xi2MouseEventsDisabled()) {
+ if (connection()->hasXInput2()) {
bool result = connection()->xi2SetMouseGrabEnabled(m_window, grab);
if (grab && result)
connection()->setMouseGrabber(this);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index b8e5159c7f..5e5aa96629 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -57,7 +57,7 @@ class QXcbSyncWindowRequest;
class QIcon;
class Q_XCB_EXPORT QXcbWindow : public QXcbObject, public QXcbWindowEventListener, public QPlatformWindow
- , public QPlatformInterface::Private::QXcbWindow
+ , public QNativeInterface::Private::QXcbWindow
{
public:
enum NetWmState {
@@ -233,7 +233,6 @@ protected:
quint8 mode, quint8 detail, xcb_timestamp_t timestamp);
xcb_window_t m_window = 0;
- xcb_colormap_t m_cmap = 0;
uint m_depth = 0;
QImage::Format m_imageFormat = QImage::Format_ARGB32_Premultiplied;
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index f44388cc6d..bb57e16ab5 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -85,7 +85,7 @@ qtConfig(vulkan) {
QMAKE_USE += \
xcb xcb_icccm xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil \
- xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb_xkb xkbcommon xkbcommon_x11
+ xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xkb xkbcommon xkbcommon_x11
qtConfig(system-xcb-xinput) {
QMAKE_USE += xcb_xinput