Merge remote-tracking branch 'origin/5.9' into 5.10

Conflicts:
	.qmake.conf
	mkspecs/win32-g++/qmake.conf
	src/corelib/global/qglobal_p.h
	src/corelib/global/qoperatingsystemversion_p.h
	src/corelib/io/qfilesystemengine_win.cpp
	src/network/bearer/qbearerengine.cpp
	src/platformsupport/input/libinput/qlibinputpointer.cpp
	src/sql/doc/snippets/code/doc_src_sql-driver.cpp
	src/widgets/kernel/qwidget_p.h
	src/widgets/kernel/qwidgetwindow.cpp
	src/widgets/styles/qfusionstyle.cpp
	tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp

Change-Id: I80e2722f481b12fff5d967c28f89208c0e9a1dd8
This commit is contained in:
Lars Knoll 2017-12-29 15:56:33 +01:00
commit db92f2f3aa
153 changed files with 2669 additions and 819 deletions

View File

@ -9,6 +9,12 @@ ICU_PREFIX=/opt/icu42 ICU_LIBS="-licui18n -licuuc -licudata".
It is also possible to manipulate any QMAKE_* variable, to amend the values It is also possible to manipulate any QMAKE_* variable, to amend the values
from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3. from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3.
Note that the *_LIBS* and QMAKE_* assignments manipulate lists, so items
containing meta characters (spaces in particular) need to be quoted according
to qmake rules. On top of that, the assignments as a whole need to be quoted
according to shell rules. It is recommended to use single quotes for the inner
quoting and double quotes for the outer quoting.
Top-level installation directories: Top-level installation directories:
-prefix <dir> ...... The deployment directory, as seen on the target device. -prefix <dir> ...... The deployment directory, as seen on the target device.
[/usr/local/Qt-$QT_VERSION, $PWD if -developer-build] [/usr/local/Qt-$QT_VERSION, $PWD if -developer-build]
@ -60,8 +66,10 @@ Configure meta:
-redo ................ Re-configure with previously used options. -redo ................ Re-configure with previously used options.
Additional options may be passed, but will not be Additional options may be passed, but will not be
saved for later use by -redo. saved for later use by -redo.
-recheck ............. Discard cached negative configure test results. -recheck [test,...] .. Discard cached negative configure test results.
Use this after installing missing dependencies. Use this after installing missing dependencies.
Alternatively, if tests are specified, only their
results are discarded.
-recheck-all ......... Discard all cached configure test results. -recheck-all ......... Discard all cached configure test results.
-feature-<feature> ... Enable <feature> -feature-<feature> ... Enable <feature>

View File

@ -557,7 +557,7 @@ defineTest(qtConfOutput_prepareOptions) {
else: \ else: \
qtConfFatalError("Cannot detect the Android host." \ qtConfFatalError("Cannot detect the Android host." \
"Please use -android-ndk-host option to specify one.") "Please use -android-ndk-host option to specify one.")
qtConfAddNotice("Available Android host does not match host architecture.") qtConfAddNote("Available Android host does not match host architecture.")
} }
} else { } else {
!exists($$ndk_tc_pfx/$$ndk_host/*): \ !exists($$ndk_tc_pfx/$$ndk_host/*): \

View File

@ -15,7 +15,7 @@
MAKEFILE_GENERATOR = MSVC.NET MAKEFILE_GENERATOR = MSVC.NET
QMAKE_PLATFORM = win32 QMAKE_PLATFORM = win32
QMAKE_COMPILER = msvc QMAKE_COMPILER = msvc
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe CONFIG += incremental flat debug_and_release debug_and_release_target precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe
DEFINES += UNICODE _UNICODE WIN32 DEFINES += UNICODE _UNICODE WIN32
QMAKE_COMPILER_DEFINES += _WIN32 QMAKE_COMPILER_DEFINES += _WIN32
contains(QMAKE_TARGET.arch, x86_64) { contains(QMAKE_TARGET.arch, x86_64) {
@ -35,7 +35,7 @@ QMAKE_CFLAGS = -nologo -Zc:wchar_t
QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_ON = -W3
QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_WARN_OFF = -W0
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MD QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -MD -Zi QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD
QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_DEBUG = -Zi -MDd
QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_LTCG = -GL QMAKE_CFLAGS_LTCG = -GL
@ -100,7 +100,6 @@ QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2 = gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2 = gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2_DEBUG = gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
QMAKE_LIBS_QT_ENTRY = -lqtmain QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_IDL = midl /NOLOGO QMAKE_IDL = midl /NOLOGO

View File

@ -0,0 +1,57 @@
#
# qmake configuration for INTEGRITY Qualcomm s820 Snapdragon MSM8996AU
#
load(device_config)
include(../../common/ghs-integrity-armv8.conf)
QT_QPA_DEFAULT_PLATFORM = eglfs
EGLFS_DEVICE_INTEGRATION = eglfs_openwfd
bsp_name = $$(INTEGRITY_BSP)
isEmpty(bsp_name): \
error("This qmakespec requires $INTEGRITY_BSP to be set")
os_directory = $$(INTEGRITY_DIR)
isEmpty(os_directory): \
error("This qmakespec requires $INTEGRITY_DIR to be set")
qclibs_directory = $$(QCLIBS_DIR)
isEmpty(qclibs_directory): \
error("This qmakespec requires $QCLIBS_DIR to be set")
qc_multimedia_inc_directory = $$(QC_MULTIMEDIA_INC_DIR)
isEmpty(qc_multimedia_inc_directory): \
error("This qmakespec requires $QC_MULTIMEDIA_INC_DIR to be set")
gl_inc_directory = $$(GL_INC_DIR)
isEmpty(gl_inc_directory): \
error("This qmakespec requires $GL_INC_DIR to be set")
gl_lib_directory = $$(GL_LIB_DIR)
isEmpty(gl_lib_directory): \
error("This qmakespec requires $GL_LIB_DIR to be set")
QMAKE_LIBDIR += $$(QCLIBS_DIR)/base
QMAKE_LIBDIR += $$(QCLIBS_DIR)/multimedia/display
QMAKE_INCDIR += $$(QC_MULTIMEDIA_INC_DIR)
QMAKE_LIBS_EGL += -lESXEGL_Adreno -lESXGLESv2_Adreno -ladreno_utils -lGSLUser -lOSUser -lpanel -livfs -lposix -lpmem -ltzbsp -lpaged_alloc -lglnext-llvm -lopenwfd
QMAKE_LIBS_OPENGL_ES2 += $${QMAKE_LIBS_EGL}
QMAKE_CFLAGS += -DINTEGRITY
QMAKE_CXXFLAGS += -DINTEGRITY
QMAKE_CFLAGS += -bigswitch
QMAKE_CXXFLAGS += -bigswitch
QMAKE_LFLAGS += -bigswitch
# OpenGL libraries have a dependency on libEGL
QMAKE_INCDIR_EGL = $$(GL_INC_DIR)
QMAKE_LIBDIR_EGL = $$(GL_LIB_DIR)
QMAKE_INCDIR_OPENGL_ES2 = $$(GL_INC_DIR)
QMAKE_LIBDIR_OPENGL_ES2 = $$(GL_LIB_DIR)
load(qt_config)

View File

@ -0,0 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QPLATFORMDEFS_H
#define QPLATFORMDEFS_H
#include "../../common/integrity/qplatformdefs.h"
#endif // QPLATFORMDEFS_H

View File

@ -9,7 +9,7 @@
"continue": "void", "continue": "void",
"recheck": { "type": "void", "name": "cache_use", "value": "positive" }, "recheck": { "type": "optionalString", "name": "cache_recheck" },
"recheck-all": { "type": "void", "name": "cache_use", "value": "none" }, "recheck-all": { "type": "void", "name": "cache_use", "value": "none" },
"redo": { "type": "redo" }, "redo": { "type": "redo" },

View File

@ -2,6 +2,9 @@
# Note that evaluating variable assignments from the command line # Note that evaluating variable assignments from the command line
# still happens in between these two steps. # still happens in between these two steps.
# In early configure setup; nothing useful to be done here.
isEmpty(QMAKE_CXX): return()
load(exclusive_builds) load(exclusive_builds)
CONFIG = \ CONFIG = \
lex yacc debug exceptions depend_includepath \ lex yacc debug exceptions depend_includepath \

View File

@ -499,30 +499,37 @@ defineTest(qtConfLibrary_inline) {
# to make them recognize the same input variables. # to make them recognize the same input variables.
input = $$eval($${2}.alias) input = $$eval($${2}.alias)
# direct libs. overwrites inline libs.
defined(config.input.$${input}.libs, var) {
$${1}.libs = $$eval(config.input.$${input}.libs)
export($${1}.libs)
}
# build-specific direct libs. overwrites inline libs. # build-specific direct libs. overwrites inline libs.
vars = vars =
any = false any = false
all = true all = true
for (b, $${1}.builds._KEYS_) { for (b, $$list(debug release)) {
iv = $${input}.libs.$${b} iv = $${input}.libs.$${b}
vars += $$eval(config.commandline.rev_assignments.$${iv}) vars += $$eval(config.commandline.rev_assignments.$${iv})
defined(config.input.$${iv}, var) { defined(config.input.$${iv}, var) {
$${1}.builds.$${b}.libs = $$eval(config.input.$${iv}) $${1}.builds.$${b} = $$eval(config.input.$${iv})
export($${1}.builds.$${b}.libs) export($${1}.builds.$${b})
$${1}.builds._KEYS_ *= $${b}
any = true any = true
} else { } else {
all = false all = false
} }
} }
$$any:!$$all { $$any {
qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.") !$$all {
return(false) qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.")
return(false)
}
export($${1}.builds._KEYS_)
# we also reset the generic libs, to avoid surprises.
$${1}.libs =
export($${1}.libs)
}
# direct libs. overwrites inline libs.
defined(config.input.$${input}.libs, var) {
$${1}.libs = $$eval(config.input.$${input}.libs)
export($${1}.libs)
} }
# prefix. prepends to (possibly overwritten) inline libs. # prefix. prepends to (possibly overwritten) inline libs.
@ -670,9 +677,10 @@ defineTest(qtConfExportLibrary) {
NAME = $$upper($$name) NAME = $$upper($$name)
# LIBS is emitted even if empty, as this allows the library to be "seen". # LIBS is emitted even if empty, as this allows the library to be "seen".
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs) qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
for (b, $${spfx}.builds._KEYS_): \ for (b, $${spfx}.builds._KEYS_) {
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \ eval(blibs = $$eval($${spfx}.builds.$${b}))
$$eval($${spfx}.builds.$${b})) qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), $$blibs)
}
!isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines) !isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines)
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes) !isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
!isEmpty($${currentConfig}.module): \ !isEmpty($${currentConfig}.module): \
@ -1044,8 +1052,13 @@ defineTest(qtConfSaveResult) {
return() return()
keys = result $$eval($${1}.cache) keys = result $$eval($${1}.cache)
cont = "cache.$${2}._KEYS_ = $$keys" cont = "cache.$${2}._KEYS_ = $$keys"
for (k, keys): \ cache.$${2}._KEYS_ = $$keys
export(cache.$${2}._KEYS_)
for (k, keys) {
cont += "cache.$${2}.$${k} = $$val_escape($${1}.$${k})" cont += "cache.$${2}.$${k} = $$val_escape($${1}.$${k})"
cache.$${2}.$${k} = $$eval($${1}.$${k})
export(cache.$${2}.$${k})
}
write_file($$QMAKE_CONFIG_CACHE, cont, append)|error() write_file($$QMAKE_CONFIG_CACHE, cont, append)|error()
} }
@ -2033,14 +2046,28 @@ qtConfCheckErrors()
QMAKE_CONFIG_CACHE = $$OUT_PWD/config.cache QMAKE_CONFIG_CACHE = $$OUT_PWD/config.cache
QMAKE_CONFIG_CACHE_USE = $$eval(config.input.cache_use) QMAKE_CONFIG_CACHE_USE = $$eval(config.input.cache_use)
cache_recheck = $$eval(config.input.cache_recheck)
equals(cache_recheck, yes) {
QMAKE_CONFIG_CACHE_USE = positive
cache_recheck =
}
isEmpty(QMAKE_CONFIG_CACHE_USE): \ isEmpty(QMAKE_CONFIG_CACHE_USE): \
QMAKE_CONFIG_CACHE_USE = all QMAKE_CONFIG_CACHE_USE = all
!equals(QMAKE_CONFIG_CACHE_USE, none) { !equals(QMAKE_CONFIG_CACHE_USE, none) {
include($$QMAKE_CONFIG_CACHE, , true) include($$QMAKE_CONFIG_CACHE, , true)
# this crudely determines when to discard the cache. this also catches the case # this crudely determines when to discard the cache. this also catches the case
# of no cache being there in the first place. # of no cache being there in the first place.
!equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]): \ !equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]) {
QMAKE_CONFIG_CACHE_USE = none QMAKE_CONFIG_CACHE_USE = none
} else: !isEmpty(cache_recheck) {
for (cr, $$list($$split(cache_recheck, ","))) {
!isEmpty(cache.$${cr}._KEYS_) {
cache.$${cr}._KEYS_ =
} else {
qtConfAddWarning("Attempting to discard non-cached result '$$cr'.")
}
}
}
} }
equals(QMAKE_CONFIG_CACHE_USE, none) { equals(QMAKE_CONFIG_CACHE_USE, none) {
cont = \ cont = \

View File

@ -48,7 +48,7 @@ CONFIG(static, static|shared)|prefix_build {
!build_pass { !build_pass {
qt_plugin_deps = $$QT $$QT_PRIVATE qt_plugin_deps = $$QT $$QT_PRIVATE
qt_plugin_deps = s,-private$,_private,g qt_plugin_deps ~= s,-private$,_private,g
MODULE_PRI_CONT = \ MODULE_PRI_CONT = \
"QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \ "QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \

View File

@ -1,7 +1,4 @@
# In early configure setup; nothing useful to be done here.
isEmpty(QMAKE_CXX): return()
defineReplace(qtMakeExpand) { defineReplace(qtMakeExpand) {
out = "$$1" out = "$$1"
for(ever) { for(ever) {
@ -19,7 +16,13 @@ defineTest(qtCompilerErrror) {
what = " host" what = " host"
else: \ else: \
what = " target" what = " target"
error("Cannot run$$what compiler '$$1'. Maybe you forgot to setup the environment?") msg = \
"Cannot run$$what compiler '$$1'. Output:" \
"===================" \
$$2 \
"===================" \
"Maybe you forgot to setup the environment?"
error($$join(msg, $$escape_expand(\\n)))
} }
cross_compile:host_build: \ cross_compile:host_build: \
@ -64,7 +67,7 @@ isEmpty($${target_prefix}.INCDIRS) {
cxx_flags += -E -v cxx_flags += -E -v
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec) output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
!equals(ec, 0): qtCompilerErrror($$QMAKE_CXX) !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output)
rim_qcc { rim_qcc {
for (line, output) { for (line, output) {
@ -124,7 +127,7 @@ isEmpty($${target_prefix}.INCDIRS) {
# What's more, -print-search-dirs can't be used on clang on Apple because it # What's more, -print-search-dirs can't be used on clang on Apple because it
# won't print all the library paths (only the clang-internal ones). # won't print all the library paths (only the clang-internal ones).
output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec) output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec)
!equals(ec, 0): qtCompilerErrror($$QMAKE_CXX) !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output)
for (line, output) { for (line, output) {
contains(line, "^libraries: .*") { contains(line, "^libraries: .*") {
@ -166,14 +169,14 @@ isEmpty($${target_prefix}.INCDIRS) {
defineReplace(qtVariablesFromMSVC) { defineReplace(qtVariablesFromMSVC) {
ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) <NUL 2>NUL", lines, ec) ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) <NUL 2>NUL", lines, ec)
!equals(ec, 0): qtCompilerErrror($$1) !equals(ec, 0): qtCompilerErrror($$1, $$ret)
return($$ret) return($$ret)
} }
defineReplace(qtVariablesFromGCC) { defineReplace(qtVariablesFromGCC) {
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) \ ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) \
<$$QMAKE_SYSTEM_NULL_DEVICE 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec) <$$QMAKE_SYSTEM_NULL_DEVICE 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec)
!equals(ec, 0): qtCompilerErrror($$1) !equals(ec, 0): qtCompilerErrror($$1, $$ret)
return($$ret) return($$ret)
} }

View File

@ -90,7 +90,7 @@ DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \
xcodebuild-%: xcodebuild-%:
@$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),) @$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),)
xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),) xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(DESTINATION_ID),, ENABLE_ONLY_ACTIVE_RESOURCES=NO) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@)) xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@))

View File

@ -0,0 +1,33 @@
#
# qmake configuration for INTEGRITY armv7 targets
#
# armv7 common includes work for armv8-A as well
include(../common/ghs-integrity-armv7.conf)
DEFINES += INTEGRITY
# This define is used because the RCar INTEGRITY EGL library expects same
# parameter types as Symbian. The parameter types are defined in eglplatform.h.
DEFINES += __WINSCW__
QTPLUGIN.platforms += qeglfs
QT_QPA_DEFAULT_PLATFORM = eglfs
QMAKE_LIBS_EGL += -lEGL -lIMGegl -lsrv_um -lsrv_init -lpvrWSEGL_WM -lncg_usr.a -lmmgr_usr -lwm_usr -lprr_usr
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lIMGegl -lglslcompiler -lusc -lsrv_um -lsrv_init -lpvrWSEGL_WM -lncg_usr.a -lmmgr_usr -lwm_usr -lprr_usr
QMAKE_LIBS_GUI = -lmmgr_usr -lwm_usr -lprr_usr
QMAKE_CFLAGS += -bigswitch
QMAKE_CXXFLAGS += -bigswitch
QMAKE_LFLAGS += -bigswitch
EGLFS_DEVICE_INTEGRATION = eglfs_rcar
# OpenGL libraries have a dependency on libEGL
dirs = $$(GL_INC_DIR)
QMAKE_INCDIR_EGL = $$split(dirs, $$QMAKE_DIRLIST_SEP)
QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_EGL
dirs = $$(GL_LIB_DIR)
QMAKE_LIBDIR_EGL = $$split(dirs, $$QMAKE_DIRLIST_SEP)
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_EGL

View File

@ -0,0 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2015 Green Hills Software. All rights reserved.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QPLATFORMDEFS_H
#define QPLATFORMDEFS_H
#include "../common/integrity/qplatformdefs.h"
#endif // QPLATFORMDEFS_H

View File

@ -8,18 +8,17 @@
# #
load(device_config) load(device_config)
include(../common/gcc-base.conf)
include(../common/g++-base.conf) include(../common/g++-base.conf)
# modifications to gcc-base.conf and g++-base.conf
MAKEFILE_GENERATOR = MINGW MAKEFILE_GENERATOR = MINGW
QMAKE_PLATFORM = win32 mingw QMAKE_PLATFORM = win32 mingw
CONFIG += debug_and_release debug_and_release_target precompile_header CONFIG += debug_and_release debug_and_release_target precompile_header
DEFINES += UNICODE _UNICODE DEFINES += UNICODE _UNICODE
QMAKE_COMPILER_DEFINES += __GNUC__ WIN32 QMAKE_COMPILER_DEFINES += __GNUC__ WIN32
QMAKE_EXT_OBJ = .o
QMAKE_EXT_RES = _res.o
QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CC = $${CROSS_COMPILE}gcc
QMAKE_LEX = flex QMAKE_LEX = flex
QMAKE_LEXFLAGS = QMAKE_LEXFLAGS =
@ -27,12 +26,12 @@ QMAKE_YACC = bison -y
QMAKE_YACCFLAGS = -d QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS += -fno-keep-inline-dllexport QMAKE_CFLAGS += -fno-keep-inline-dllexport
QMAKE_CFLAGS_WARN_ON += -Wextra QMAKE_CFLAGS_WARN_ON += -Wextra
QMAKE_CFLAGS_SSE2 += -mstackrealign QMAKE_CFLAGS_SSE2 += -mstackrealign
QMAKE_CFLAGS_AESNI = -maes QMAKE_CFLAGS_AESNI = -maes
QMAKE_CFLAGS_SHANI = -msha QMAKE_CFLAGS_SHANI = -msha
QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_CXX = $${CROSS_COMPILE}g++
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
QMAKE_CXXFLAGS_RTTI_ON = -frtti QMAKE_CXXFLAGS_RTTI_ON = -frtti
QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
@ -56,6 +55,8 @@ equals(QMAKE_HOST.os, Windows) {
QMAKE_LINK_OBJECT_MAX = 10 QMAKE_LINK_OBJECT_MAX = 10
QMAKE_LINK_OBJECT_SCRIPT = object_script QMAKE_LINK_OBJECT_SCRIPT = object_script
} }
QMAKE_EXT_OBJ = .o
QMAKE_EXT_RES = _res.o
QMAKE_PREFIX_SHLIB = QMAKE_PREFIX_SHLIB =
QMAKE_EXTENSION_SHLIB = dll QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB = lib QMAKE_PREFIX_STATICLIB = lib

View File

@ -17,9 +17,10 @@ QMAKE_CC = icl
QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373 QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373
QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673 QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673
QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673 QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673
QMAKE_CFLAGS_DEBUG = -Zi -MDd -Od QMAKE_CFLAGS_DEBUG = -Od -Zi -MDd
QMAKE_CFLAGS_LTCG = -Qipo QMAKE_CFLAGS_LTCG = -Qipo
QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo
QMAKE_CFLAGS_SSE2 = -QxSSE2 QMAKE_CFLAGS_SSE2 = -QxSSE2
QMAKE_CFLAGS_SSE3 = -QxSSE3 QMAKE_CFLAGS_SSE3 = -QxSSE3
QMAKE_CFLAGS_SSSE3 = -QxSSSE3 QMAKE_CFLAGS_SSSE3 = -QxSSSE3
@ -50,16 +51,10 @@ QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
QMAKE_LINK = xilink QMAKE_LINK = xilink
QMAKE_LFLAGS = /NOLOGO
QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO =
QMAKE_LFLAGS_DEBUG = /DEBUG
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_LIB = xilib /NOLOGO QMAKE_LIB = xilib /NOLOGO
DSP_EXTENSION = .dsp
include(../common/angle.conf) include(../common/angle.conf)
include(../common/windows-vulkan.conf) include(../common/windows-vulkan.conf)

View File

@ -9,7 +9,7 @@
# sh-compatible shell. This is not a problem, because configure.bat # sh-compatible shell. This is not a problem, because configure.bat
# will not do that. # will not do that.
ifeq ($(SHELL), sh.exe) ifeq ($(SHELL), sh.exe)
ifeq ($(wildcard $(CURDIR)/sh.exe), ) ifeq ($(wildcard ./sh.exe), )
SH = 0 SH = 0
else else
SH = 1 SH = 1

View File

@ -280,8 +280,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
QMap<QString, QString> settings; QMap<QString, QString> settings;
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO")); settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
if(as_release)
settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK")) if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString()); settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString());
{ {
@ -1499,7 +1497,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO"); settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO");
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0) // required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO"); settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES");
if(!as_release) if(!as_release)
settings.insert("GCC_OPTIMIZATION_LEVEL", "0"); settings.insert("GCC_OPTIMIZATION_LEVEL", "0");
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK")) if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))

View File

@ -707,15 +707,15 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData); d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
// Create a quad in homogeneous coordinates // Create a quad in homogeneous coordinates
float x1 = (x / float(mWidth)) * 2.0f - 1.0f; float x1 = (x / float(width)) * 2.0f - 1.0f;
float y1 = (y / float(mHeight)) * 2.0f - 1.0f; float y1 = (y / float(height)) * 2.0f - 1.0f;
float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f; float x2 = ((x + width) / float(width)) * 2.0f - 1.0f;
float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f; float y2 = ((y + height) / float(height)) * 2.0f - 1.0f;
float u1 = x / float(mWidth); float u1 = x / float(width);
float v1 = y / float(mHeight); float v1 = y / float(height);
float u2 = (x + width) / float(mWidth); float u2 = (x + width) / float(width);
float v2 = (y + height) / float(mHeight); float v2 = (y + height) / float(height);
// Invert the quad vertices depending on the surface orientation. // Invert the quad vertices depending on the surface orientation.
if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0) if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
@ -760,8 +760,8 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
D3D11_VIEWPORT viewport; D3D11_VIEWPORT viewport;
viewport.TopLeftX = 0; viewport.TopLeftX = 0;
viewport.TopLeftY = 0; viewport.TopLeftY = 0;
viewport.Width = static_cast<FLOAT>(mWidth); viewport.Width = static_cast<FLOAT>(width);
viewport.Height = static_cast<FLOAT>(mHeight); viewport.Height = static_cast<FLOAT>(height);
viewport.MinDepth = 0.0f; viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f; viewport.MaxDepth = 1.0f;
deviceContext->RSSetViewports(1, &viewport); deviceContext->RSSetViewports(1, &viewport);

View File

@ -9,7 +9,7 @@
"Homepage": "http://www.freetype.org", "Homepage": "http://www.freetype.org",
"License": "Freetype Project License or GNU General Public License v2.0 only", "License": "Freetype Project License or GNU General Public License v2.0 only",
"LicenseId": "FTL OR GPL-2.0", "LicenseId": "FTL OR GPL-2.0",
"LicenseFile": "LICENSE.TXT", "LicenseFile": "LICENSE.txt",
"Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg." "Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
}, },
{ {
@ -22,7 +22,7 @@
"Homepage": "http://www.freetype.org", "Homepage": "http://www.freetype.org",
"License": "zlib License", "License": "zlib License",
"LicenseId": "Zlib", "LicenseId": "Zlib",
"LicenseFile": "ZLIB-LICENSE.TXT", "LicenseFile": "ZLIB-LICENSE.txt",
"Copyright": "Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler" "Copyright": "Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler"
}, },
{ {
@ -35,7 +35,7 @@
"Homepage": "http://www.freetype.org", "Homepage": "http://www.freetype.org",
"License": "MIT License", "License": "MIT License",
"LicenseId": "MIT", "LicenseId": "MIT",
"LicenseFile": "BDF-LICENSE.TXT", "LicenseFile": "BDF-LICENSE.txt",
"Copyright": "Copyright (C) 2001-2002 by Francesco Zappa Nardelli "Copyright": "Copyright (C) 2001-2002 by Francesco Zappa Nardelli
Copyright 2000 Computing Research Labs, New Mexico State University Copyright 2000 Computing Research Labs, New Mexico State University
Copyright 2001-2002, 2011 Francesco Zappa Nardelli" Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
@ -50,7 +50,7 @@ Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
"Homepage": "http://www.freetype.org", "Homepage": "http://www.freetype.org",
"License": "MIT License", "License": "MIT License",
"LicenseId": "MIT", "LicenseId": "MIT",
"LicenseFile": "PCF-LICENSE.TXT", "LicenseFile": "PCF-LICENSE.txt",
"Copyright": "Copyright (C) 2000 by Francesco Zappa Nardelli" "Copyright": "Copyright (C) 2000 by Francesco Zappa Nardelli"
} }
] ]

View File

@ -1156,7 +1156,7 @@ public class QtActivityDelegate
return false; return false;
m_metaState = MetaKeyKeyListener.handleKeyDown(m_metaState, keyCode, event); m_metaState = MetaKeyKeyListener.handleKeyDown(m_metaState, keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(m_metaState)); int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(m_metaState) | event.getMetaState());
int lc = c; int lc = c;
m_metaState = MetaKeyKeyListener.adjustMetaAfterKeypress(m_metaState); m_metaState = MetaKeyKeyListener.adjustMetaAfterKeypress(m_metaState);

View File

@ -0,0 +1,57 @@
From 55821d34b2208e7858dbba5648760b83c66b58a5 Mon Sep 17 00:00:00 2001
From: Oliver Wolff <oliver.wolff@qt.io>
Date: Mon, 29 Aug 2016 09:48:28 +0200
Subject: [PATCH] ANGLE: Fix resizing of windows
Use the correct height/width values when calculating
the vector for resizing the window content and the
new size as viewport size.
Task-number: QTBUG-62475
Change-Id: I33a8dc1379a908e991b04bc31dfc6254a6d005c9
---
.../libANGLE/renderer/d3d/d3d11/SwapChain11.cpp | 35 +++++++++++-----------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
index 785a83cd77..fe72bc935d 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
@@ -707,15 +706,15 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
// Create a quad in homogeneous coordinates
- float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
- float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
- float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
- float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
+ float x1 = (x / float(width)) * 2.0f - 1.0f;
+ float y1 = (y / float(height)) * 2.0f - 1.0f;
+ float x2 = ((x + width) / float(width)) * 2.0f - 1.0f;
+ float y2 = ((y + height) / float(height)) * 2.0f - 1.0f;
- float u1 = x / float(mWidth);
- float v1 = y / float(mHeight);
- float u2 = (x + width) / float(mWidth);
- float v2 = (y + height) / float(mHeight);
+ float u1 = x / float(width);
+ float v1 = y / float(height);
+ float u2 = (x + width) / float(width);
+ float v2 = (y + height) / float(height);
// Invert the quad vertices depending on the surface orientation.
if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
@@ -760,8 +759,8 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
D3D11_VIEWPORT viewport;
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
- viewport.Width = static_cast<FLOAT>(mWidth);
- viewport.Height = static_cast<FLOAT>(mHeight);
+ viewport.Width = static_cast<FLOAT>(width);
+ viewport.Height = static_cast<FLOAT>(height);
viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f;
deviceContext->RSSetViewports(1, &viewport);
--
2.15.0.windows.1

View File

@ -299,13 +299,13 @@ void QUnifiedTimer::stopAnimationDriver()
driver->stop(); driver->stop();
} }
void QUnifiedTimer::updateAnimationTimers(qint64) void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
{ {
//setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations //setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
if(insideTick) if(insideTick)
return; return;
qint64 totalElapsed = elapsed(); qint64 totalElapsed = currentTick > 0 ? currentTick : elapsed();
// ignore consistentTiming in case the pause timer is active // ignore consistentTiming in case the pause timer is active
qint64 delta = (consistentTiming && !pauseTimer.isActive()) ? qint64 delta = (consistentTiming && !pauseTimer.isActive()) ?

View File

@ -178,7 +178,7 @@
"slog2": { "slog2": {
"label": "slog2", "label": "slog2",
"test": { "test": {
"include": "slog2.h", "include": "sys/slog2.h",
"main": "slog2_set_default_buffer((slog2_buffer_t)-1);" "main": "slog2_set_default_buffer((slog2_buffer_t)-1);"
}, },
"export": "", "export": "",
@ -608,7 +608,7 @@
"label": "PPS", "label": "PPS",
"emitIf": "config.qnx", "emitIf": "config.qnx",
"condition": "libs.pps", "condition": "libs.pps",
"output": [ "privateConfig" ] "output": [ "privateFeature" ]
}, },
"qeventtransition": { "qeventtransition": {
"label": "QEventTransition class", "label": "QEventTransition class",

View File

@ -750,7 +750,6 @@ void Widget::sizeFunction()
int n = str.size(); // n == 5 int n = str.size(); // n == 5
str.data()[0]; // returns 'W' str.data()[0]; // returns 'W'
str.data()[4]; // returns 'd' str.data()[4]; // returns 'd'
str.data()[5]; // returns '\0'
//! [58] //! [58]
} }

View File

@ -42,7 +42,10 @@ SOURCES += \
VERSIONTAGGING_SOURCES = global/qversiontagging.cpp VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
darwin: SOURCES += global/qoperatingsystemversion_darwin.mm darwin: SOURCES += global/qoperatingsystemversion_darwin.mm
win32: SOURCES += global/qoperatingsystemversion_win.cpp win32 {
SOURCES += global/qoperatingsystemversion_win.cpp
HEADERS += global/qoperatingsystemversion_win_p.h
}
# qlibraryinfo.cpp includes qconfig.cpp # qlibraryinfo.cpp includes qconfig.cpp
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global

View File

@ -61,9 +61,9 @@ static inline bool qt_is_inf(qfloat16 d) Q_DECL_NOTHROW
bool is_inf; bool is_inf;
uchar *ch = (uchar *)&d; uchar *ch = (uchar *)&d;
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
is_inf = (ch[0] & 0x7c) == 0x7c; is_inf = (ch[0] & 0x7c) == 0x7c && (ch[0] & 0x02) == 0;
else else
is_inf = (ch[1] & 0x7c) == 0x7c; is_inf = (ch[1] & 0x7c) == 0x7c && (ch[1] & 0x02) == 0;
return is_inf; return is_inf;
} }

View File

@ -46,6 +46,9 @@
#include "qdatetime.h" #include "qdatetime.h"
#include "qoperatingsystemversion.h" #include "qoperatingsystemversion.h"
#include "qoperatingsystemversion_p.h" #include "qoperatingsystemversion_p.h"
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT)
#include "qoperatingsystemversion_win_p.h"
#endif
#include <private/qlocale_tools_p.h> #include <private/qlocale_tools_p.h>
#include <qmutex.h> #include <qmutex.h>

View File

@ -61,7 +61,7 @@
#include <qt_windows.h> #include <qt_windows.h>
#endif #endif
#if QT_CONFIG(slog2) #if QT_CONFIG(slog2)
#include <slog2.h> #include <sys/slog2.h>
#endif #endif
#if QT_HAS_INCLUDE(<paths.h>) #if QT_HAS_INCLUDE(<paths.h>)
#include <paths.h> #include <paths.h>

View File

@ -477,6 +477,8 @@ public:
WA_TabletTracking = 129, WA_TabletTracking = 129,
WA_ContentsMarginsRespectsSafeArea = 130,
// Add new attributes before this line // Add new attributes before this line
WA_AttributeCount WA_AttributeCount
}; };

View File

@ -37,7 +37,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qoperatingsystemversion_win_p.h"
#include "qoperatingsystemversion_p.h" #include "qoperatingsystemversion_p.h"
#include <qt_windows.h> #include <qt_windows.h>
#include <qbytearray.h> #include <qbytearray.h>

View File

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QOPERATINGSYSTEMVERSION_WIN_P_H
#define QOPERATINGSYSTEMVERSION_WIN_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qglobal.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
OSVERSIONINFOEX qWindowsVersionInfo();
QT_END_NAMESPACE
#endif // QOPERATINGSYSTEMVERSION_WIN_P_H

64
src/corelib/io/qfilesystemengine_win.cpp Normal file → Executable file
View File

@ -160,6 +160,7 @@ static TRUSTEE_W currentUserTrusteeW;
static TRUSTEE_W worldTrusteeW; static TRUSTEE_W worldTrusteeW;
static PSID currentUserSID = 0; static PSID currentUserSID = 0;
static PSID worldSID = 0; static PSID worldSID = 0;
static HANDLE currentUserImpersonatedToken = nullptr;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -180,6 +181,11 @@ GlobalSid::~GlobalSid()
::FreeSid(worldSID); ::FreeSid(worldSID);
worldSID = 0; worldSID = 0;
} }
if (currentUserImpersonatedToken) {
::CloseHandle(currentUserImpersonatedToken);
currentUserImpersonatedToken = nullptr;
}
} }
GlobalSid::GlobalSid() GlobalSid::GlobalSid()
@ -210,6 +216,12 @@ GlobalSid::GlobalSid()
::CloseHandle(token); ::CloseHandle(token);
} }
token = nullptr;
if (::OpenProcessToken(hnd, TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_DUPLICATE | STANDARD_RIGHTS_READ, &token)) {
::DuplicateToken(token, SecurityImpersonation, &currentUserImpersonatedToken);
::CloseHandle(token);
}
{ {
// Create TRUSTEE for Everyone (World) // Create TRUSTEE for Everyone (World)
SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY }; SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY };
@ -724,15 +736,49 @@ bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSyst
ACCESS_MASK access_mask; ACCESS_MASK access_mask;
TRUSTEE_W trustee; TRUSTEE_W trustee;
if (what & QFileSystemMetaData::UserPermissions) { // user if (what & QFileSystemMetaData::UserPermissions) { // user
data.knownFlagsMask |= QFileSystemMetaData::UserPermissions; // Using AccessCheck because GetEffectiveRightsFromAcl doesn't account for elevation
if (GetEffectiveRightsFromAcl(pDacl, &currentUserTrusteeW, &access_mask) != ERROR_SUCCESS) if (currentUserImpersonatedToken) {
access_mask = (ACCESS_MASK)-1; GENERIC_MAPPING mapping = {FILE_GENERIC_READ, FILE_GENERIC_WRITE, FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS};
if(access_mask & ReadMask) PRIVILEGE_SET privileges;
data.entryFlags |= QFileSystemMetaData::UserReadPermission; DWORD grantedAccess;
if(access_mask & WriteMask) BOOL result;
data.entryFlags|= QFileSystemMetaData::UserWritePermission;
if(access_mask & ExecMask) data.knownFlagsMask |= QFileSystemMetaData::UserPermissions;
data.entryFlags|= QFileSystemMetaData::UserExecutePermission; DWORD genericAccessRights = GENERIC_READ;
::MapGenericMask(&genericAccessRights, &mapping);
DWORD privilegesLength = sizeof(privileges);
if (::AccessCheck(pSD, currentUserImpersonatedToken, genericAccessRights,
&mapping, &privileges, &privilegesLength, &grantedAccess, &result) && result) {
data.entryFlags |= QFileSystemMetaData::UserReadPermission;
}
privilegesLength = sizeof(privileges);
genericAccessRights = GENERIC_WRITE;
::MapGenericMask(&genericAccessRights, &mapping);
if (::AccessCheck(pSD, currentUserImpersonatedToken, genericAccessRights,
&mapping, &privileges, &privilegesLength, &grantedAccess, &result) && result) {
data.entryFlags |= QFileSystemMetaData::UserWritePermission;
}
privilegesLength = sizeof(privileges);
genericAccessRights = GENERIC_EXECUTE;
::MapGenericMask(&genericAccessRights, &mapping);
if (::AccessCheck(pSD, currentUserImpersonatedToken, genericAccessRights,
&mapping, &privileges, &privilegesLength, &grantedAccess, &result) && result) {
data.entryFlags |= QFileSystemMetaData::UserExecutePermission;
}
} else { // fallback to GetEffectiveRightsFromAcl
data.knownFlagsMask |= QFileSystemMetaData::UserPermissions;
if (GetEffectiveRightsFromAclW(pDacl, &currentUserTrusteeW, &access_mask) != ERROR_SUCCESS)
access_mask = ACCESS_MASK(-1);
if (access_mask & ReadMask)
data.entryFlags |= QFileSystemMetaData::UserReadPermission;
if (access_mask & WriteMask)
data.entryFlags|= QFileSystemMetaData::UserWritePermission;
if (access_mask & ExecMask)
data.entryFlags|= QFileSystemMetaData::UserExecutePermission;
}
} }
if (what & QFileSystemMetaData::OwnerPermissions) { // owner if (what & QFileSystemMetaData::OwnerPermissions) { // owner
data.knownFlagsMask |= QFileSystemMetaData::OwnerPermissions; data.knownFlagsMask |= QFileSystemMetaData::OwnerPermissions;

View File

@ -255,7 +255,7 @@ void QLoggingSettingsParser::parseNextLine(QStringRef line)
QLoggingRegistry::QLoggingRegistry() QLoggingRegistry::QLoggingRegistry()
: categoryFilter(defaultCategoryFilter) : categoryFilter(defaultCategoryFilter)
{ {
initalizeRules(); // Init on first use initializeRules(); // Init on first use
} }
static bool qtLoggingDebug() static bool qtLoggingDebug()
@ -284,7 +284,7 @@ static QVector<QLoggingRule> loadRulesFromFile(const QString &filePath)
Initializes the rules database by loading Initializes the rules database by loading
$QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini. $QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini.
*/ */
void QLoggingRegistry::initalizeRules() void QLoggingRegistry::initializeRules()
{ {
QVector<QLoggingRule> er, qr, cr; QVector<QLoggingRule> er, qr, cr;
// get rules from environment // get rules from environment

View File

@ -113,7 +113,7 @@ class Q_AUTOTEST_EXPORT QLoggingRegistry
public: public:
QLoggingRegistry(); QLoggingRegistry();
void initalizeRules(); void initializeRules();
void registerCategory(QLoggingCategory *category, QtMsgType enableForLevel); void registerCategory(QLoggingCategory *category, QtMsgType enableForLevel);
void unregisterCategory(QLoggingCategory *category); void unregisterCategory(QLoggingCategory *category);

View File

@ -90,11 +90,6 @@
fromPercentEncoding() and toPercentEncoding() which deal with fromPercentEncoding() and toPercentEncoding() which deal with
percent encoding and decoding of QString objects. percent encoding and decoding of QString objects.
Calling isRelative() will tell whether or not the URL is
relative. A relative URL can be resolved by passing it as argument
to resolved(), which returns an absolute URL. isParentOf() is used
for determining whether one URL is a parent of another.
fromLocalFile() constructs a QUrl by parsing a local fromLocalFile() constructs a QUrl by parsing a local
file path. toLocalFile() converts a URL to a local file path. file path. toLocalFile() converts a URL to a local file path.
@ -116,6 +111,37 @@
from freedesktop.org, provided that the locale encodes file names using from freedesktop.org, provided that the locale encodes file names using
UTF-8 (required by IDN). UTF-8 (required by IDN).
\section2 Relative URLs vs Relative Paths
Calling isRelative() will return whether or not the URL is relative.
A relative URL has no \l {scheme}. For example:
\code
qDebug() << QUrl("main.qml").isRelative(); // true: no scheme
qDebug() << QUrl("qml/main.qml").isRelative(); // true: no scheme
qDebug() << QUrl("file:main.qml").isRelative(); // false: has "file" scheme
qDebug() << QUrl("file:qml/main.qml").isRelative(); // false: has "file" scheme
\endcode
Notice that a URL can be absolute while containing a relative path, and
vice versa:
\code
// Absolute URL, relative path
QUrl url("file:file.txt");
qDebug() << url.isRelative(); // false: has "file" scheme
qDebug() << QDir::isAbsolutePath(url.path()); // false: relative path
// Relative URL, absolute path
url = QUrl("/home/user/file.txt");
qDebug() << url.isRelative(); // true: has no scheme
qDebug() << QDir::isAbsolutePath(url.path()); // true: absolute path
\endcode
A relative URL can be resolved by passing it as an argument to resolved(),
which returns an absolute URL. isParentOf() is used for determining whether
one URL is a parent of another.
\section2 Error checking \section2 Error checking
QUrl is capable of detecting many errors in URLs while parsing it or when QUrl is capable of detecting many errors in URLs while parsing it or when
@ -2539,6 +2565,12 @@ void QUrl::setPath(const QString &path, ParsingMode mode)
/*! /*!
Returns the path of the URL. Returns the path of the URL.
\code
qDebug() << QUrl("file:file.txt").path(); // "file.txt"
qDebug() << QUrl("/home/user/file.txt").path(); // "/home/user/file.txt"
qDebug() << QUrl("http://www.example.com/test/123").path(); // "/test/123"
\endcode
The \a options argument controls how to format the path component. All The \a options argument controls how to format the path component. All
values produce an unambiguous result. With QUrl::FullyDecoded, all values produce an unambiguous result. With QUrl::FullyDecoded, all
percent-encoded sequences are decoded; otherwise, the returned value may percent-encoded sequences are decoded; otherwise, the returned value may
@ -2549,6 +2581,31 @@ void QUrl::setPath(const QString &path, ParsingMode mode)
sequences are present. It is recommended to use that value when the result sequences are present. It is recommended to use that value when the result
will be used in a non-URL context, such as sending to an FTP server. will be used in a non-URL context, such as sending to an FTP server.
An example of data loss is when you have non-Unicode percent-encoded sequences
and use FullyDecoded (the default):
\code
qDebug() << QUrl("/foo%FFbar").path();
\endcode
In this example, there will be some level of data loss because the \c %FF cannot
be converted.
Data loss can also occur when the path contains sub-delimiters (such as \c +):
\code
qDebug() << QUrl("/foo+bar%2B").path(); // "/foo+bar+"
\endcode
Other decoding examples:
\code
const QUrl url("/tmp/Mambo %235%3F.mp3");
qDebug() << url.path(QUrl::FullyDecoded); // "/tmp/Mambo #5?.mp3"
qDebug() << url.path(QUrl::PrettyDecoded); // "/tmp/Mambo #5?.mp3"
qDebug() << url.path(QUrl::FullyEncoded); // "/tmp/Mambo%20%235%3F.mp3"
\endcode
\sa setPath() \sa setPath()
*/ */
QString QUrl::path(ComponentFormattingOptions options) const QString QUrl::path(ComponentFormattingOptions options) const
@ -3257,6 +3314,8 @@ QUrl QUrl::resolved(const QUrl &relative) const
equivalent to calling scheme().isEmpty(). equivalent to calling scheme().isEmpty().
Relative references are defined in RFC 3986 section 4.2. Relative references are defined in RFC 3986 section 4.2.
\sa {Relative URLs vs Relative Paths}
*/ */
bool QUrl::isRelative() const bool QUrl::isRelative() const
{ {
@ -3796,6 +3855,41 @@ bool QUrl::isDetached() const
An empty \a localFile leads to an empty URL (since Qt 5.4). An empty \a localFile leads to an empty URL (since Qt 5.4).
\code
qDebug() << QUrl::fromLocalFile("file.txt"); // QUrl("file:file.txt")
qDebug() << QUrl::fromLocalFile("/home/user/file.txt"); // QUrl("file:///home/user/file.txt")
qDebug() << QUrl::fromLocalFile("file:file.txt"); // doesn't make sense; expects path, not url with scheme
\endcode
In the first line in snippet above, a file URL is constructed from a
local, relative path. A file URL with a relative path only makes sense
if there is a base URL to resolve it against. For example:
\code
QUrl url = QUrl::fromLocalFile("file.txt");
QUrl baseUrl = QUrl("file:/home/user/");
// wrong: prints QUrl("file:file.txt"), as url already has a scheme
qDebug() << baseUrl.resolved(url);
\endcode
To resolve such a URL, it's necessary to remove the scheme beforehand:
\code
// correct: prints QUrl("file:///home/user/file.txt")
url.setScheme(QString());
qDebug() << baseUrl.resolved(url);
\endcode
For this reason, it is better to use a relative URL (that is, no scheme)
for relative file paths:
\code
QUrl url = QUrl("file.txt");
QUrl baseUrl = QUrl("file:/home/user/");
// prints QUrl("file:///home/user/file.txt")
qDebug() << baseUrl.resolved(url);
\endcode
\sa toLocalFile(), isLocalFile(), QDir::toNativeSeparators() \sa toLocalFile(), isLocalFile(), QDir::toNativeSeparators()
*/ */
QUrl QUrl::fromLocalFile(const QString &localFile) QUrl QUrl::fromLocalFile(const QString &localFile)
@ -3840,6 +3934,12 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
returned value in the form found on SMB networks (for example, returned value in the form found on SMB networks (for example,
"//servername/path/to/file.txt"). "//servername/path/to/file.txt").
\code
qDebug() << QUrl("file:file.txt").toLocalFile(); // "file:file.txt"
qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "file:///home/user/file.txt"
qDebug() << QUrl("file.txt").toLocalFile(); // ""; wasn't a local file as it had no scheme
\endcode
Note: if the path component of this URL contains a non-UTF-8 binary Note: if the path component of this URL contains a non-UTF-8 binary
sequence (such as %80), the behaviour of this function is undefined. sequence (such as %80), the behaviour of this function is undefined.

View File

@ -188,7 +188,7 @@ vxworks {
kernel/qfunctions_vxworks.h kernel/qfunctions_vxworks.h
} }
qqnx_pps { qnx:qtConfig(qqnx_pps) {
QMAKE_USE_PRIVATE += pps QMAKE_USE_PRIVATE += pps
SOURCES += \ SOURCES += \
kernel/qppsattribute.cpp \ kernel/qppsattribute.cpp \

View File

@ -2196,11 +2196,11 @@ QString QCoreApplication::applicationFilePath()
QCoreApplicationPrivate *d = self->d_func(); QCoreApplicationPrivate *d = self->d_func();
if (d->argc) { if (d->argc) {
static const char *procName = d->argv[0]; static QByteArray procName = QByteArray(d->argv[0]);
if (qstrcmp(procName, d->argv[0]) != 0) { if (procName != d->argv[0]) {
// clear the cache if the procname changes, so we reprocess it. // clear the cache if the procname changes, so we reprocess it.
QCoreApplicationPrivate::clearApplicationFilePath(); QCoreApplicationPrivate::clearApplicationFilePath();
procName = d->argv[0]; procName = QByteArray(d->argv[0]);
} }
} }

View File

@ -4796,7 +4796,7 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type,
const int *types, const QMetaObject *senderMetaObject) const int *types, const QMetaObject *senderMetaObject)
{ {
if (!sender || !slotObj || !senderMetaObject) { if (!sender || !receiver || !slotObj || !senderMetaObject) {
qWarning("QObject::connect: invalid null parameter"); qWarning("QObject::connect: invalid null parameter");
if (slotObj) if (slotObj)
slotObj->destroyIfLastRef(); slotObj->destroyIfLastRef();

View File

@ -57,13 +57,15 @@
#include <QDebug> #include <QDebug>
#include <sys/pps.h> #include <sys/pps.h>
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QSocketNotifier; class QSocketNotifier;
class QPpsObjectPrivate class QPpsObjectPrivate : public QObjectPrivate
{ {
Q_DECLARE_PUBLIC(QPpsObject)
public: public:
explicit QPpsObjectPrivate(const QString &path); explicit QPpsObjectPrivate(const QString &path);

View File

@ -3096,10 +3096,12 @@ int QSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
void QSignalEventGenerator::execute(void **_a) void QSignalEventGenerator::execute(void **_a)
{ {
auto machinePrivate = QStateMachinePrivate::get(qobject_cast<QStateMachine*>(parent()));
if (machinePrivate->state != QStateMachinePrivate::Running)
return;
int signalIndex = senderSignalIndex(); int signalIndex = senderSignalIndex();
Q_ASSERT(signalIndex != -1); Q_ASSERT(signalIndex != -1);
QStateMachine *machine = qobject_cast<QStateMachine*>(parent()); machinePrivate->handleTransitionSignal(sender(), signalIndex, _a);
QStateMachinePrivate::get(machine)->handleTransitionSignal(sender(), signalIndex, _a);
} }
QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent) QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent)

View File

@ -115,7 +115,7 @@ template <typename T>
class QFutureWatcher : public QFutureWatcherBase class QFutureWatcher : public QFutureWatcherBase
{ {
public: public:
explicit QFutureWatcher(QObject *_parent = 0) explicit QFutureWatcher(QObject *_parent = nullptr)
: QFutureWatcherBase(_parent) : QFutureWatcherBase(_parent)
{ } { }
~QFutureWatcher() ~QFutureWatcher()

View File

@ -115,9 +115,9 @@ struct QMapNode : public QMapNodeBase
inline QMapNode *leftNode() const { return static_cast<QMapNode *>(left); } inline QMapNode *leftNode() const { return static_cast<QMapNode *>(left); }
inline QMapNode *rightNode() const { return static_cast<QMapNode *>(right); } inline QMapNode *rightNode() const { return static_cast<QMapNode *>(right); }
inline const QMapNode *nextNode() const { return static_cast<const QMapNode *>(QMapNodeBase::nextNode()); } inline const QMapNode *nextNode() const { return reinterpret_cast<const QMapNode *>(QMapNodeBase::nextNode()); }
inline const QMapNode *previousNode() const { return static_cast<const QMapNode *>(QMapNodeBase::previousNode()); } inline const QMapNode *previousNode() const { return static_cast<const QMapNode *>(QMapNodeBase::previousNode()); }
inline QMapNode *nextNode() { return static_cast<QMapNode *>(QMapNodeBase::nextNode()); } inline QMapNode *nextNode() { return reinterpret_cast<QMapNode *>(QMapNodeBase::nextNode()); }
inline QMapNode *previousNode() { return static_cast<QMapNode *>(QMapNodeBase::previousNode()); } inline QMapNode *previousNode() { return static_cast<QMapNode *>(QMapNodeBase::previousNode()); }
QMapNode<Key, T> *copy(QMapData<Key, T> *d) const; QMapNode<Key, T> *copy(QMapData<Key, T> *d) const;

View File

@ -5517,14 +5517,9 @@ QString& QString::fill(QChar ch, int size)
Returns the number of characters in this string. Returns the number of characters in this string.
The last character in the string is at position size() - 1. In The last character in the string is at position size() - 1.
addition, QString ensures that the character at position size()
is always '\\0', so that you can use the return value of data()
and constData() as arguments to functions that expect
'\\0'-terminated strings.
Example: Example:
\snippet qstring/main.cpp 58 \snippet qstring/main.cpp 58
\sa isEmpty(), resize() \sa isEmpty(), resize()
@ -6042,10 +6037,13 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
/*! /*!
\fn const QChar *QString::unicode() const \fn const QChar *QString::unicode() const
Returns a '\\0'-terminated Unicode representation of the string. Returns a Unicode representation of the string.
The result remains valid until the string is modified. The result remains valid until the string is modified.
\sa utf16() \note The returned string may not be '\\0'-terminated.
Use size() to determine the length of the array.
\sa utf16(), fromRawData()
*/ */
/*! /*!
@ -8515,7 +8513,10 @@ bool QString::isRightToLeft() const
Returns a pointer to the data stored in the QString. The pointer Returns a pointer to the data stored in the QString. The pointer
can be used to access and modify the characters that compose the can be used to access and modify the characters that compose the
string. For convenience, the data is '\\0'-terminated. string.
Unlike constData() and unicode(), the returned data is always
'\\0'-terminated.
Example: Example:
@ -8531,18 +8532,25 @@ bool QString::isRightToLeft() const
/*! \fn const QChar *QString::data() const /*! \fn const QChar *QString::data() const
\overload \overload
\note The returned string may not be '\\0'-terminated.
Use size() to determine the length of the array.
\sa fromRawData()
*/ */
/*! \fn const QChar *QString::constData() const /*! \fn const QChar *QString::constData() const
Returns a pointer to the data stored in the QString. The pointer Returns a pointer to the data stored in the QString. The pointer
can be used to access the characters that compose the string. For can be used to access the characters that compose the string.
convenience, the data is '\\0'-terminated.
Note that the pointer remains valid only as long as the string is Note that the pointer remains valid only as long as the string is
not modified. not modified.
\sa data(), operator[]() \note The returned string may not be '\\0'-terminated.
Use size() to determine the length of the array.
\sa data(), operator[](), fromRawData()
*/ */
/*! \fn void QString::push_front(const QString &other) /*! \fn void QString::push_front(const QString &other)

View File

@ -6083,9 +6083,9 @@ static const Properties uc_properties[] = {
{ 18, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7, 8, 13, 7 }, { 18, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7, 8, 13, 7 },
{ 25, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 12, 7 }, { 25, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 12, 7 },
{ 25, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 12, 0, 12, 7 }, { 25, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 12, 0, 12, 7 },
{ 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 3, 4, 4, 12, 8 }, { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 3, 4, 4, 12, 8 },
{ 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 3, 4, 4, 12, 8 }, { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 3, 4, 4, 12, 8 },
{ 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 3, 4, 4, 12, 2 }, { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 3, 4, 4, 12, 2 },
{ 26, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 12, 8 }, { 26, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 12, 8 },
{ 26, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 12, 8 }, { 26, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 12, 8 },
{ 25, 4, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 8 }, { 25, 4, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 8 },
@ -6146,7 +6146,7 @@ static const Properties uc_properties[] = {
{ 18, 13, 0, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 8, 8, 12, 8 }, { 18, 13, 0, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 8, 8, 12, 8 },
{ 25, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 6, 8 }, { 25, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 6, 8 },
{ 0, 17, 230, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 8 }, { 0, 17, 230, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 8 },
{ 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 12, 2 }, { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 12, 2 },
{ 29, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 12, 8 }, { 29, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 12, 8 },
{ 0, 17, 220, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 8 }, { 0, 17, 220, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 8 },
{ 17, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 12, 8 }, { 17, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 12, 8 },
@ -6749,7 +6749,7 @@ static const Properties uc_properties[] = {
{ 25, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 12, 6, 33 }, { 25, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 12, 6, 33 },
{ 25, 10, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 12, 33 }, { 25, 10, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 12, 33 },
{ 0, 17, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 4, 4, 21, 33 }, { 0, 17, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 4, 4, 21, 33 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 3, 4, 4, 4, 33 }, { 10, 18, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 3, 4, 4, 4, 33 },
{ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 }, { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 },
{ 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 }, { 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 },
{ 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 }, { 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 },
@ -7058,7 +7058,7 @@ static const Properties uc_properties[] = {
{ 6, 9, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 5, 17, 2 }, { 6, 9, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 5, 17, 2 },
{ 6, 9, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 5, 4, 2 }, { 6, 9, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 5, 4, 2 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 4, 20, 2 }, { 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 4, 20, 2 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 1 }, { 10, 18, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 1 },
{ 10, 18, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 1 }, { 10, 18, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 1 },
{ 10, 0, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 }, { 10, 0, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 },
{ 10, 1, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 }, { 10, 1, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 },
@ -7108,10 +7108,10 @@ static const Properties uc_properties[] = {
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 4, 4, 12, 2 }, { 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 4, 4, 12, 2 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 3, 4, 4, 12, 2 }, { 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 3, 4, 4, 12, 2 },
{ 13, 18, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 12, 0 }, { 13, 18, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 12, 0 },
{ 10, 19, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 }, { 10, 19, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
{ 10, 20, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 }, { 10, 20, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
{ 10, 21, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 }, { 10, 21, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
{ 10, 22, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 }, { 10, 22, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 }, { 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 },
{ 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 0, 12, 2 }, { 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 0, 12, 2 },
{ 17, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 80, 0, 8, 6, 12, 3 }, { 17, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 80, 0, 8, 6, 12, 3 },

View File

@ -50,11 +50,11 @@
// We mean it. // We mean it.
// //
#include <QtCore/private/qglobal_p.h>
#ifndef QUNICODETABLES_P_H #ifndef QUNICODETABLES_P_H
#define QUNICODETABLES_P_H #define QUNICODETABLES_P_H
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qchar.h> #include <QtCore/qchar.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -3706,7 +3706,6 @@ void QXmlStreamWriter::writeEntityReference(const QString &name)
void QXmlStreamWriter::writeNamespace(const QString &namespaceUri, const QString &prefix) void QXmlStreamWriter::writeNamespace(const QString &namespaceUri, const QString &prefix)
{ {
Q_D(QXmlStreamWriter); Q_D(QXmlStreamWriter);
Q_ASSERT(!namespaceUri.isEmpty());
Q_ASSERT(prefix != QLatin1String("xmlns")); Q_ASSERT(prefix != QLatin1String("xmlns"));
if (prefix.isEmpty()) { if (prefix.isEmpty()) {
d->findNamespace(namespaceUri, d->inStartElement); d->findNamespace(namespaceUri, d->inStartElement);

View File

@ -722,6 +722,33 @@
}, },
"use": "egl" "use": "egl"
}, },
"egl-openwfd": {
"label": "OpenWFD EGL",
"type": "compile",
"test": {
"include": [ "wfd.h" ],
"main": [
"wfdEnumerateDevices(nullptr, 0, nullptr);"
]
},
"use": "egl"
},
"egl-rcar": {
"label": "RCAR EGL",
"type": "compile",
"test": {
"include": [ "EGL/egl.h" ],
"tail": [
"extern \"C\" {",
"extern unsigned long PVRGrfxServerInit(void);",
"}"
],
"main": [
"PVRGrfxServerInit();"
]
},
"use": "egl opengl_es2"
},
"evdev": { "evdev": {
"label": "evdev", "label": "evdev",
"type": "compile", "type": "compile",
@ -952,7 +979,7 @@
"label": "IMF", "label": "IMF",
"emitIf": "config.qnx", "emitIf": "config.qnx",
"condition": "libs.imf", "condition": "libs.imf",
"output": [ "privateConfig" ] "output": [ "privateFeature" ]
}, },
"integrityfb": { "integrityfb": {
"label": "INTEGRITY framebuffer", "label": "INTEGRITY framebuffer",
@ -1119,11 +1146,21 @@
"condition": "features.eglfs && tests.egl-viv", "condition": "features.eglfs && tests.egl-viv",
"output": [ "privateFeature" ] "output": [ "privateFeature" ]
}, },
"eglfs_rcar": {
"label": "EGLFS RCAR",
"condition": "config.integrity && features.eglfs && tests.egl-rcar",
"output": [ "privateFeature" ]
},
"eglfs_viv_wl": { "eglfs_viv_wl": {
"label": "EGLFS i.Mx6 Wayland", "label": "EGLFS i.Mx6 Wayland",
"condition": "features.eglfs_viv && libs.wayland_server", "condition": "features.eglfs_viv && libs.wayland_server",
"output": [ "privateFeature" ] "output": [ "privateFeature" ]
}, },
"eglfs_openwfd": {
"label": "EGLFS OpenWFD",
"condition": "config.integrity && features.eglfs && tests.egl-openwfd",
"output": [ "privateFeature" ]
},
"gif": { "gif": {
"label": "GIF", "label": "GIF",
"condition": "features.imageformatplugin", "condition": "features.imageformatplugin",
@ -1610,7 +1647,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"section": "EGLFS details", "section": "EGLFS details",
"condition": "features.eglfs", "condition": "features.eglfs",
"entries": [ "entries": [
"eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11" "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
] ]
}, },
"linuxfb", "vnc", "mirclient", "linuxfb", "vnc", "mirclient",

View File

@ -1767,6 +1767,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
case QWindowSystemInterfacePrivate::WindowScreenChanged: case QWindowSystemInterfacePrivate::WindowScreenChanged:
QGuiApplicationPrivate::processWindowScreenChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowScreenChangedEvent *>(e)); QGuiApplicationPrivate::processWindowScreenChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowScreenChangedEvent *>(e));
break; break;
case QWindowSystemInterfacePrivate::SafeAreaMarginsChanged:
QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(static_cast<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *>(e));
break;
case QWindowSystemInterfacePrivate::ApplicationStateChanged: { case QWindowSystemInterfacePrivate::ApplicationStateChanged: {
QWindowSystemInterfacePrivate::ApplicationStateChangedEvent * changeEvent = static_cast<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *>(e); QWindowSystemInterfacePrivate::ApplicationStateChangedEvent * changeEvent = static_cast<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *>(e);
QGuiApplicationPrivate::setApplicationState(changeEvent->newState, changeEvent->forcePropagate); } QGuiApplicationPrivate::setApplicationState(changeEvent->newState, changeEvent->forcePropagate); }
@ -2220,6 +2223,17 @@ void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterf
} }
} }
void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *wse)
{
if (wse->window.isNull())
return;
// Handle by forwarding directly to QWindowPrivate, instead of sending spontaneous
// QEvent like most other functions, as there's no QEvent type for the safe area
// change, and we don't want to add one until we know that this is a good API.
qt_window_private(wse->window)->processSafeAreaMarginsChanged();
}
void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce) void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce)
{ {
if (self) if (self)
@ -2887,7 +2901,7 @@ QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QM
static QPointer<QWindow> currentDragWindow; static QPointer<QWindow> currentDragWindow;
static Qt::DropAction lastAcceptedDropAction = Qt::IgnoreAction; static Qt::DropAction lastAcceptedDropAction = Qt::IgnoreAction;
QPlatformDrag *platformDrag = platformIntegration()->drag(); QPlatformDrag *platformDrag = platformIntegration()->drag();
if (!platformDrag) { if (!platformDrag || (w && w->d_func()->blockedByModalWindow)) {
lastAcceptedDropAction = Qt::IgnoreAction; lastAcceptedDropAction = Qt::IgnoreAction;
return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect()); return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect());
} }

View File

@ -133,6 +133,8 @@ public:
static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e); static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e);
static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e); static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e);
static void processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e);
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e); static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
static void updateFilteredScreenOrientation(QScreen *screen); static void updateFilteredScreenOrientation(QScreen *screen);

View File

@ -92,4 +92,48 @@ void QInputDeviceManager::setCursorPos(const QPoint &pos)
emit cursorPositionChangeRequested(pos); emit cursorPositionChangeRequested(pos);
} }
/*!
\return the keyboard modifier state stored in the QInputDeviceManager object.
Keyboard input handlers are expected to keep this up-to-date via
setKeyboardModifiers().
Querying the state via this function (e.g. from a mouse handler that needs
to include the modifier state in mouse events) is the preferred alternative
over QGuiApplication::keyboardModifiers() since the latter may not report
the current state due to asynchronous QPA event processing.
*/
Qt::KeyboardModifiers QInputDeviceManager::keyboardModifiers() const
{
Q_D(const QInputDeviceManager);
return d->keyboardModifiers;
}
void QInputDeviceManager::setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key)
{
Q_D(QInputDeviceManager);
Qt::KeyboardModifiers mods;
switch (key) {
case Qt::Key_Shift:
mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ShiftModifier);
break;
case Qt::Key_Control:
mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ControlModifier);
break;
case Qt::Key_Alt:
mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::AltModifier);
break;
case Qt::Key_Meta:
mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::MetaModifier);
break;
case Qt::Key_AltGr:
mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::GroupSwitchModifier);
break;
default:
mods = modsBeforeEvent;
break;
}
d->keyboardModifiers = mods;
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -78,6 +78,9 @@ public:
void setCursorPos(const QPoint &pos); void setCursorPos(const QPoint &pos);
Qt::KeyboardModifiers keyboardModifiers() const;
void setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key);
signals: signals:
void deviceListChanged(QInputDeviceManager::DeviceType type); void deviceListChanged(QInputDeviceManager::DeviceType type);
void cursorPositionChangeRequested(const QPoint &pos); void cursorPositionChangeRequested(const QPoint &pos);

View File

@ -69,6 +69,8 @@ public:
void setDeviceCount(QInputDeviceManager::DeviceType type, int count); void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
QMap<QInputDeviceManager::DeviceType, int> m_deviceCount; QMap<QInputDeviceManager::DeviceType, int> m_deviceCount;
Qt::KeyboardModifiers keyboardModifiers;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -937,7 +937,9 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
/*! /*!
Makes the context current in the current thread, against the given Makes the context current in the current thread, against the given
\a surface. Returns \c true if successful. \a surface. Returns \c true if successful; otherwise returns \c false.
The latter may happen if the surface is not exposed, or the graphics
hardware is not available due to e.g. the application being suspended.
If \a surface is 0 this is equivalent to calling doneCurrent(). If \a surface is 0 this is equivalent to calling doneCurrent().

View File

@ -165,6 +165,16 @@ QMargins QPlatformWindow::frameMargins() const
return QMargins(); return QMargins();
} }
/*!
The safe area margins of a window represent the area that is safe to
place content within, without intersecting areas of the screen where
system UI is placed, or where a screen bezel may cover the content.
*/
QMargins QPlatformWindow::safeAreaMargins() const
{
return QMargins();
}
/*! /*!
Reimplemented in subclasses to show the surface Reimplemented in subclasses to show the surface
if \a visible is \c true, and hide it if \a visible is \c false. if \a visible is \c true, and hide it if \a visible is \c false.

View File

@ -88,6 +88,7 @@ public:
virtual QRect normalGeometry() const; virtual QRect normalGeometry() const;
virtual QMargins frameMargins() const; virtual QMargins frameMargins() const;
virtual QMargins safeAreaMargins() const;
virtual void setVisible(bool visible); virtual void setVisible(bool visible);
virtual void setWindowFlags(Qt::WindowFlags flags); virtual void setWindowFlags(Qt::WindowFlags flags);

View File

@ -155,6 +155,8 @@ public:
virtual void clearFocusObject(); virtual void clearFocusObject();
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const; virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
virtual void processSafeAreaMarginsChanged() {};
bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; } bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; }
static QWindowPrivate *get(QWindow *window) { return window->d_func(); } static QWindowPrivate *get(QWindow *window) { return window->d_func(); }

View File

@ -265,6 +265,13 @@ void QWindowSystemInterface::handleWindowScreenChanged(QWindow *window, QScreen
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window)
{
QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e =
new QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent(window);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate) QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
{ {
Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)); Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState));

View File

@ -180,6 +180,9 @@ public:
static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState = -1); static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState = -1);
static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen); static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleSafeAreaMarginsChanged(QWindow *window);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false); static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false);

View File

@ -98,7 +98,8 @@ public:
#endif #endif
ApplicationStateChanged = 0x19, ApplicationStateChanged = 0x19,
FlushEvents = 0x20, FlushEvents = 0x20,
WindowScreenChanged = 0x21 WindowScreenChanged = 0x21,
SafeAreaMarginsChanged = 0x22
}; };
class WindowSystemEvent { class WindowSystemEvent {
@ -185,6 +186,15 @@ public:
QPointer<QScreen> screen; QPointer<QScreen> screen;
}; };
class SafeAreaMarginsChangedEvent : public WindowSystemEvent {
public:
SafeAreaMarginsChangedEvent(QWindow *w)
: WindowSystemEvent(SafeAreaMarginsChanged), window(w)
{ }
QPointer<QWindow> window;
};
class ApplicationStateChangedEvent : public WindowSystemEvent { class ApplicationStateChangedEvent : public WindowSystemEvent {
public: public:
ApplicationStateChangedEvent(Qt::ApplicationState newState, bool forcePropagate = false) ApplicationStateChangedEvent(Qt::ApplicationState newState, bool forcePropagate = false)

View File

@ -853,7 +853,7 @@ QString QColor::name(NameFormat format) const
return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6); return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
case HexArgb: case HexArgb:
// it's called rgba() but it does return AARRGGBB // it's called rgba() but it does return AARRGGBB
return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8); return QLatin1Char('#') + QString::number(rgba() | Q_INT64_C(0x100000000), 16).rightRef(8);
} }
return QString(); return QString();
} }

View File

@ -56,13 +56,15 @@
#include <QtGui/qpalette.h> #include <QtGui/qpalette.h>
#include <CoreGraphics/CoreGraphics.h> #include <CoreGraphics/CoreGraphics.h>
#ifdef Q_OS_MACOS
#if defined(__OBJC__) && defined(Q_OS_MACOS)
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#define HAVE_APPKIT
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifdef Q_OS_MACOS #ifdef HAVE_APPKIT
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm); Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0); Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size); Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
@ -78,7 +80,7 @@ Q_GUI_EXPORT CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *
Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform); Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
#ifdef Q_OS_MACOS #ifdef HAVE_APPKIT
Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color); Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal); Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
#endif #endif
@ -124,4 +126,6 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#undef HAVE_APPKIT
#endif // QCOREGRAPHICS_P_H #endif // QCOREGRAPHICS_P_H

View File

@ -1881,7 +1881,8 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
emit q->networkSessionConnected(); emit q->networkSessionConnected();
lastSessionState = state; lastSessionState = state;
if (online && state == QNetworkSession::Disconnected) { if (online && (state == QNetworkSession::Disconnected
|| state == QNetworkSession::NotAvailable)) {
const auto cfgs = networkConfigurationManager.allConfigurations(); const auto cfgs = networkConfigurationManager.allConfigurations();
for (const QNetworkConfiguration &cfg : cfgs) { for (const QNetworkConfiguration &cfg : cfgs) {
if (cfg.state().testFlag(QNetworkConfiguration::Active)) { if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
@ -1923,9 +1924,9 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
online = (networkConfiguration.state() & QNetworkConfiguration::Active); online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else { } else {
if (online != isOnline) { if (online != isOnline) {
online = isOnline;
_q_networkSessionClosed(); _q_networkSessionClosed();
createSession(q->configuration()); createSession(q->configuration());
online = isOnline;
} }
} }
if (online) { if (online) {

View File

@ -93,7 +93,8 @@ bool QBearerEngine::configurationsInUse() const
|| hasUsedConfiguration(userChoiceConfigurations); || hasUsedConfiguration(userChoiceConfigurations);
} }
QT_END_NAMESPACE
#include "moc_qbearerengine_p.cpp" #include "moc_qbearerengine_p.cpp"
QT_END_NAMESPACE
#endif // QT_NO_BEARERMANAGEMENT #endif // QT_NO_BEARERMANAGEMENT

View File

@ -378,8 +378,8 @@ void QNetworkConfigurationManager::updateConfigurations()
priv->performAsyncConfigurationUpdate(); priv->performAsyncConfigurationUpdate();
} }
#include "moc_qnetworkconfigmanager.cpp"
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qnetworkconfigmanager.cpp"
#endif // QT_NO_BEARERMANAGEMENT #endif // QT_NO_BEARERMANAGEMENT

View File

@ -749,8 +749,8 @@ void QNetworkSession::disconnectNotify(const QMetaMethod &signal)
d->setALREnabled(false); d->setALREnabled(false);
} }
#include "moc_qnetworksession.cpp"
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qnetworksession.cpp"
#endif // QT_NO_BEARERMANAGEMENT #endif // QT_NO_BEARERMANAGEMENT

View File

@ -69,18 +69,10 @@
{ {
"comment": "placeholder for OPENSSL_{PATH,LIBS{,_{DEBUG,RELEASE}}}", "comment": "placeholder for OPENSSL_{PATH,LIBS{,_{DEBUG,RELEASE}}}",
"libs": "", "libs": "",
"builds": {
"debug": "",
"release": ""
},
"condition": "config.win32 && !features.shared" "condition": "config.win32 && !features.shared"
}, },
{ {
"libs": "-lssleay32 -llibeay32", "libs": "-lssleay32 -llibeay32",
"builds": {
"debug": "",
"release": ""
},
"condition": "config.win32 && features.shared" "condition": "config.win32 && features.shared"
}, },
{ "libs": "-lssl -lcrypto", "condition": "!config.win32" } { "libs": "-lssl -lcrypto", "condition": "!config.win32" }

View File

@ -42,6 +42,7 @@
#if QT_CONFIG(library) #if QT_CONFIG(library)
#include <qlibrary.h> #include <qlibrary.h>
#endif #endif
#include <qvarlengtharray.h>
#include <qscopedpointer.h> #include <qscopedpointer.h>
#include <qurl.h> #include <qurl.h>
#include <private/qnativesocketengine_p.h> #include <private/qnativesocketengine_p.h>
@ -58,6 +59,8 @@
# include <gnu/lib-names.h> # include <gnu/lib-names.h>
#endif #endif
#include <cstring>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if QT_CONFIG(library) #if QT_CONFIG(library)
@ -137,7 +140,7 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
// Initialize state. // Initialize state.
struct __res_state state; struct __res_state state;
memset(&state, 0, sizeof(state)); std::memset(&state, 0, sizeof(state));
if (local_res_ninit(&state) < 0) { if (local_res_ninit(&state) < 0) {
reply->error = QDnsLookup::ResolverError; reply->error = QDnsLookup::ResolverError;
reply->errorString = tr("Resolver initialization failed"); reply->errorString = tr("Resolver initialization failed");
@ -189,11 +192,25 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
QScopedPointer<struct __res_state, QDnsLookupStateDeleter> state_ptr(&state); QScopedPointer<struct __res_state, QDnsLookupStateDeleter> state_ptr(&state);
// Perform DNS query. // Perform DNS query.
unsigned char response[PACKETSZ]; QVarLengthArray<unsigned char, PACKETSZ> buffer(PACKETSZ);
memset(response, 0, sizeof(response)); std::memset(buffer.data(), 0, buffer.size());
const int responseLength = local_res_nquery(&state, requestName, C_IN, requestType, response, sizeof(response)); int responseLength = local_res_nquery(&state, requestName, C_IN, requestType, buffer.data(), buffer.size());
if (Q_UNLIKELY(responseLength > PACKETSZ)) {
buffer.resize(responseLength);
std::memset(buffer.data(), 0, buffer.size());
responseLength = local_res_nquery(&state, requestName, C_IN, requestType, buffer.data(), buffer.size());
if (Q_UNLIKELY(responseLength > buffer.size())) {
// Ok, we give up.
reply->error = QDnsLookup::ResolverError;
reply->errorString.clear(); // We cannot be more specific, alas.
return;
}
}
// Check the response header. unsigned char *response = buffer.data();
// Check the response header. Though res_nquery returns -1 as a
// responseLength in case of error, we still can extract the
// exact error code from the response.
HEADER *header = (HEADER*)response; HEADER *header = (HEADER*)response;
const int answerCount = ntohs(header->ancount); const int answerCount = ntohs(header->ancount);
switch (header->rcode) { switch (header->rcode) {

View File

@ -94,7 +94,7 @@ static OidLengthMap createOidMap()
oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.8"), 160); // secp160r1 oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.8"), 160); // secp160r1
oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.9"), 160); // secp160k1 oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.9"), 160); // secp160k1
oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.11"), 384); // brainpoolP384r1 oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.11"), 384); // brainpoolP384r1
oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.13"), 521); // brainpoolP512r1 oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.13"), 512); // brainpoolP512r1
oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.7"), 256); // brainpoolP256r1 oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.7"), 256); // brainpoolP256r1
return oids; return oids;
} }

View File

@ -47,6 +47,7 @@
#include "qsslkey_p.h" #include "qsslkey_p.h"
#include <QtCore/qmessageauthenticationcode.h> #include <QtCore/qmessageauthenticationcode.h>
#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qcryptographichash.h> #include <QtCore/qcryptographichash.h>
#include <QtCore/qdatastream.h> #include <QtCore/qdatastream.h>
#include <QtCore/qsysinfo.h> #include <QtCore/qsysinfo.h>
@ -1245,13 +1246,17 @@ bool QSslSocketBackendPrivate::verifyPeerTrust()
// actual system CA certificate list (which most use-cases need) other than // actual system CA certificate list (which most use-cases need) other than
// by letting SecTrustEvaluate fall through to the system list; so, in this case // by letting SecTrustEvaluate fall through to the system list; so, in this case
// (even though the client code may have provided its own certs), we retain // (even though the client code may have provided its own certs), we retain
// the default behavior. // the default behavior. Note, with macOS SDK below 10.12 using 'trust my
// anchors only' may result in some valid chains rejected, apparently the
// ones containing intermediated certificates; so we use this functionality
// on more recent versions only.
bool anchorsFromConfigurationOnly = false;
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
const bool anchorsFromConfigurationOnly = true; if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSSierra)
#else anchorsFromConfigurationOnly = true;
const bool anchorsFromConfigurationOnly = false; #endif // Q_OS_MACOS
#endif
SecTrustSetAnchorCertificatesOnly(trust, anchorsFromConfigurationOnly); SecTrustSetAnchorCertificatesOnly(trust, anchorsFromConfigurationOnly);

View File

@ -47,6 +47,7 @@
#include <QtCore/QSysInfo> #include <QtCore/QSysInfo>
#include <QtCore/qfunctions_winrt.h> #include <QtCore/qfunctions_winrt.h>
#include <private/qnativesocketengine_winrt_p.h> #include <private/qnativesocketengine_winrt_p.h>
#include <private/qeventdispatcher_winrt_p.h>
#include <windows.networking.h> #include <windows.networking.h>
#include <windows.networking.sockets.h> #include <windows.networking.sockets.h>
@ -443,8 +444,11 @@ void QSslSocketBackendPrivate::continueHandshake()
return; return;
} }
hr = op->put_Completed(Callback<IAsyncActionCompletedHandler>( hr = QEventDispatcherWinRT::runOnXamlThread([this, op]() {
this, &QSslSocketBackendPrivate::onSslUpgrade).Get()); HRESULT hr = op->put_Completed(Callback<IAsyncActionCompletedHandler>(
this, &QSslSocketBackendPrivate::onSslUpgrade).Get());
return hr;
});
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
} }

View File

@ -62,7 +62,7 @@ QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffs
, m_display(display) , m_display(display)
, m_pbuffer(EGL_NO_SURFACE) , m_pbuffer(EGL_NO_SURFACE)
{ {
bool hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless) m_hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless)
&& q_hasEglExtension(display, "EGL_KHR_surfaceless_context"); && q_hasEglExtension(display, "EGL_KHR_surfaceless_context");
// Disable surfaceless contexts on Mesa for now. As of 10.6.0 and Intel at least, some // Disable surfaceless contexts on Mesa for now. As of 10.6.0 and Intel at least, some
@ -72,9 +72,9 @@ QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffs
// read/draw surface in the Intel backend. // read/draw surface in the Intel backend.
const char *vendor = eglQueryString(display, EGL_VENDOR); // hard to check for GL_ strings here, so blacklist all Mesa const char *vendor = eglQueryString(display, EGL_VENDOR); // hard to check for GL_ strings here, so blacklist all Mesa
if (vendor && strstr(vendor, "Mesa")) if (vendor && strstr(vendor, "Mesa"))
hasSurfaceless = false; m_hasSurfaceless = false;
if (hasSurfaceless) if (m_hasSurfaceless)
return; return;
EGLConfig config = q_configFromGLFormat(m_display, m_format, false, EGL_PBUFFER_BIT); EGLConfig config = q_configFromGLFormat(m_display, m_format, false, EGL_PBUFFER_BIT);
@ -100,4 +100,9 @@ QEGLPbuffer::~QEGLPbuffer()
eglDestroySurface(m_display, m_pbuffer); eglDestroySurface(m_display, m_pbuffer);
} }
bool QEGLPbuffer::isValid() const
{
return m_pbuffer != EGL_NO_SURFACE || m_hasSurfaceless;
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -64,7 +64,7 @@ public:
~QEGLPbuffer(); ~QEGLPbuffer();
QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; } QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
bool isValid() const Q_DECL_OVERRIDE { return m_pbuffer != EGL_NO_SURFACE; } bool isValid() const Q_DECL_OVERRIDE;
EGLSurface pbuffer() const { return m_pbuffer; } EGLSurface pbuffer() const { return m_pbuffer; }
@ -72,6 +72,7 @@ private:
QSurfaceFormat m_format; QSurfaceFormat m_format;
EGLDisplay m_display; EGLDisplay m_display;
EGLSurface m_pbuffer; EGLSurface m_pbuffer;
bool m_hasSurfaceless;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -416,7 +416,19 @@ extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
template <> template <>
QFontEngine *QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>::fontEngine(const QFontDef &fontDef, void *usrPtr) QFontEngine *QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>::fontEngine(const QFontDef &fontDef, void *usrPtr)
{ {
CTFontDescriptorRef descriptor = static_cast<CTFontDescriptorRef>(usrPtr); QCFType<CTFontDescriptorRef> descriptor = QCFType<CTFontDescriptorRef>::constructFromGet(
static_cast<CTFontDescriptorRef>(usrPtr));
// CoreText will sometimes invalidate information in font descriptors that refer
// to system fonts in certain function calls or application states. While the descriptor
// looks the same from the outside, some internal plumbing is different, causing the results
// of creating CTFonts from those descriptors unreliable. The work-around for this
// is to copy the attributes of those descriptors each time we make a new CTFont
// from them instead of referring to the original, as that may trigger the CoreText bug.
if (m_systemFontDescriptors.contains(descriptor)) {
QCFType<CFDictionaryRef> attributes = CTFontDescriptorCopyAttributes(descriptor);
descriptor = CTFontDescriptorCreateWithAttributes(attributes);
}
// Since we do not pass in the destination DPI to CoreText when making // Since we do not pass in the destination DPI to CoreText when making
// the font, we need to pass in a point size which is scaled to include // the font, we need to pass in a point size which is scaled to include
@ -427,14 +439,10 @@ QFontEngine *QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>::fontEngine
qreal scaledPointSize = fontDef.pixelSize; qreal scaledPointSize = fontDef.pixelSize;
CGAffineTransform matrix = qt_transform_from_fontdef(fontDef); CGAffineTransform matrix = qt_transform_from_fontdef(fontDef);
CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix); if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix))
if (font) { return new QCoreTextFontEngine(font, fontDef);
QFontEngine *engine = new QCoreTextFontEngine(font, fontDef);
CFRelease(font);
return engine;
}
return NULL; return nullptr;
} }
#ifndef QT_NO_FREETYPE #ifndef QT_NO_FREETYPE

View File

@ -87,12 +87,14 @@ public:
QFont *themeFont(QPlatformTheme::Font) const; QFont *themeFont(QPlatformTheme::Font) const;
const QHash<QPlatformTheme::Font, QFont *> &themeFonts() const; const QHash<QPlatformTheme::Font, QFont *> &themeFonts() const;
protected:
mutable QSet<CTFontDescriptorRef> m_systemFontDescriptors;
private: private:
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString()); void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
mutable QString defaultFontName; mutable QString defaultFontName;
mutable QSet<CTFontDescriptorRef> m_systemFontDescriptors;
mutable QHash<QPlatformTheme::Font, QFont *> m_themeFonts; mutable QHash<QPlatformTheme::Font, QFont *> m_themeFonts;
bool m_hasPopulatedAliases; bool m_hasPopulatedAliases;
}; };

View File

@ -49,6 +49,9 @@
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <private/qcore_unix_p.h> #include <private/qcore_unix_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qinputdevicemanager_p.h>
#ifdef Q_OS_FREEBSD #ifdef Q_OS_FREEBSD
#include <dev/evdev/input.h> #include <dev/evdev/input.h>
#else #else
@ -222,6 +225,8 @@ void QEvdevKeyboardHandler::readKeycode()
void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtcode, void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtcode,
Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat) Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
{ {
QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(modifiers, qtcode);
QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease), QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease),
qtcode, modifiers, nativecode + 8, 0, int(modifiers), qtcode, modifiers, nativecode + 8, 0, int(modifiers),
(unicode != 0xffff ) ? QString(unicode) : QString(), autoRepeat); (unicode != 0xffff ) ? QString(unicode) : QString(), autoRepeat);
@ -403,6 +408,8 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
Qt::KeyboardModifiers qtmods = Qt::KeyboardModifiers(qtcode & modmask); Qt::KeyboardModifiers qtmods = Qt::KeyboardModifiers(qtcode & modmask);
qtcode &= ~modmask; qtcode &= ~modmask;
// qtmods here is the modifier state before the event, i.e. not
// including the current key in case it is a modifier.
qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode, int(qtmods)); qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode, int(qtmods));
// If NumLockOff and keypad key pressed remap event sent // If NumLockOff and keypad key pressed remap event sent

View File

@ -40,6 +40,8 @@
#include "qlibinputkeyboard_p.h" #include "qlibinputkeyboard_p.h"
#include <QtCore/QTextCodec> #include <QtCore/QTextCodec>
#include <QtCore/QLoggingCategory> #include <QtCore/QLoggingCategory>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qinputdevicemanager_p.h>
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <libinput.h> #include <libinput.h>
#ifndef QT_NO_XKBCOMMON_EVDEV #ifndef QT_NO_XKBCOMMON_EVDEV
@ -196,6 +198,8 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
const xkb_keysym_t sym = xkb_state_key_get_one_sym(m_state, k); const xkb_keysym_t sym = xkb_state_key_get_one_sym(m_state, k);
// mods here is the modifier state before the event, i.e. not
// including the current key in case it is a modifier.
Qt::KeyboardModifiers mods = Qt::NoModifier; Qt::KeyboardModifiers mods = Qt::NoModifier;
const int qtkey = keysymToQtKey(sym, &mods, text); const int qtkey = keysymToQtKey(sym, &mods, text);
@ -211,6 +215,8 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
xkb_state_update_key(m_state, k, pressed ? XKB_KEY_DOWN : XKB_KEY_UP); xkb_state_update_key(m_state, k, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(mods, qtkey);
QWindowSystemInterface::handleExtendedKeyEvent(Q_NULLPTR, QWindowSystemInterface::handleExtendedKeyEvent(Q_NULLPTR,
pressed ? QEvent::KeyPress : QEvent::KeyRelease, pressed ? QEvent::KeyPress : QEvent::KeyRelease,
qtkey, mods, k, sym, mods, text); qtkey, mods, k, sym, mods, text);

View File

@ -41,6 +41,8 @@
#include <libinput.h> #include <libinput.h>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QScreen> #include <QtGui/QScreen>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qinputdevicemanager_p.h>
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <private/qhighdpiscaling_p.h> #include <private/qhighdpiscaling_p.h>
@ -78,7 +80,8 @@ void QLibInputPointer::processButton(libinput_event_pointer *e)
m_buttons.setFlag(button, pressed); m_buttons.setFlag(button, pressed);
QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons, QGuiApplication::keyboardModifiers()); QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons,
QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers());
} }
void QLibInputPointer::processMotion(libinput_event_pointer *e) void QLibInputPointer::processMotion(libinput_event_pointer *e)
@ -91,7 +94,8 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
m_pos.setX(qBound(g.left(), qRound(m_pos.x() + dx), g.right())); m_pos.setX(qBound(g.left(), qRound(m_pos.x() + dx), g.right()));
m_pos.setY(qBound(g.top(), qRound(m_pos.y() + dy), g.bottom())); m_pos.setY(qBound(g.top(), qRound(m_pos.y() + dy), g.bottom()));
QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons, QGuiApplication::keyboardModifiers()); QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons,
QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers());
} }
void QLibInputPointer::processAxis(libinput_event_pointer *e) void QLibInputPointer::processAxis(libinput_event_pointer *e)

View File

@ -6,11 +6,6 @@ QT_FOR_CONFIG += network-private
SUBDIRS += connman networkmanager SUBDIRS += connman networkmanager
} }
#win32:SUBDIRS += nla
win32:SUBDIRS += generic
win32:!winrt: SUBDIRS += nativewifi
darwin:qtConfig(corewlan): SUBDIRS += corewlan
mac:SUBDIRS += generic
android:SUBDIRS += android android:SUBDIRS += android
isEmpty(SUBDIRS):SUBDIRS = generic isEmpty(SUBDIRS):SUBDIRS = generic

View File

@ -106,7 +106,8 @@ namespace QtAndroidAccessibility
QAccessibleInterface *iface = interfaceFromId(objectId); QAccessibleInterface *iface = interfaceFromId(objectId);
if (iface && iface->isValid()) { if (iface && iface->isValid()) {
const int childCount = iface->childCount(); const int childCount = iface->childCount();
QVarLengthArray<jint, 8> ifaceIdArray(childCount); QVarLengthArray<jint, 8> ifaceIdArray;
ifaceIdArray.reserve(childCount);
for (int i = 0; i < childCount; ++i) { for (int i = 0; i < childCount; ++i) {
QAccessibleInterface *child = iface->child(i); QAccessibleInterface *child = iface->child(i);
if (child && child->isValid()) if (child && child->isValid())

View File

@ -526,6 +526,10 @@ void QAndroidInputContext::updateCursorPosition()
void QAndroidInputContext::updateSelectionHandles() void QAndroidInputContext::updateSelectionHandles()
{ {
static bool noHandles = qEnvironmentVariableIntValue("QT_QPA_NO_TEXT_HANDLES");
if (noHandles)
return;
auto im = qGuiApp->inputMethod(); auto im = qGuiApp->inputMethod();
if (!m_focusObject || (m_cursorHandleShown == CursorHandleNotShown)) { if (!m_focusObject || (m_cursorHandleShown == CursorHandleNotShown)) {
// Hide the handles // Hide the handles
@ -843,11 +847,11 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/)
const uint qtInputMethodHints = query->value(Qt::ImHints).toUInt(); const uint qtInputMethodHints = query->value(Qt::ImHints).toUInt();
if (qtInputMethodHints & Qt::ImhPreferUppercase) if (!(qtInputMethodHints & Qt::ImhLowercaseOnly) && !(qtInputMethodHints & Qt::ImhNoAutoUppercase))
res = CAP_MODE_SENTENCES; res |= CAP_MODE_SENTENCES;
if (qtInputMethodHints & Qt::ImhUppercaseOnly) if (qtInputMethodHints & Qt::ImhUppercaseOnly)
res = CAP_MODE_CHARACTERS; res |= CAP_MODE_CHARACTERS;
return res; return res;
} }

View File

@ -43,6 +43,7 @@
#include "qcocoahelpers.h" #include "qcocoahelpers.h"
#include "qcocoamenubar.h" #include "qcocoamenubar.h"
#include "qcocoamenuitem.h" #include "qcocoamenuitem.h"
#include "qcocoaintegration.h"
#include <QtCore/private/qcore_mac_p.h> #include <QtCore/private/qcore_mac_p.h>
#include <QtCore/private/qthread_p.h> #include <QtCore/private/qthread_p.h>
@ -343,10 +344,13 @@
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem - (BOOL)validateMenuItem:(NSMenuItem*)menuItem
{ {
if ([menuItem action] == @selector(hide:) if ([menuItem action] == @selector(hideOtherApplications:)
|| [menuItem action] == @selector(hideOtherApplications:)
|| [menuItem action] == @selector(unhideAllApplications:)) { || [menuItem action] == @selector(unhideAllApplications:)) {
return [NSApp validateMenuItem:menuItem]; return [NSApp validateMenuItem:menuItem];
} else if ([menuItem action] == @selector(hide:)) {
if (QCocoaIntegration::instance()->activePopupWindow())
return NO;
return [NSApp validateMenuItem:menuItem];
} else if ([menuItem tag]) { } else if ([menuItem tag]) {
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([menuItem tag]); QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([menuItem tag]);
return cocoaItem->isEnabled(); return cocoaItem->isEnabled();

View File

@ -52,6 +52,7 @@
// //
#include "qeglfsglobal_p.h" #include "qeglfsglobal_p.h"
#include "qeglfscursor_p.h"
#include <QtEglSupport/private/qeglplatformcontext_p.h> #include <QtEglSupport/private/qeglplatformcontext_p.h>
#include <QtCore/QVariant> #include <QtCore/QVariant>
@ -68,6 +69,8 @@ public:
void runGLChecks() override; void runGLChecks() override;
void swapBuffers(QPlatformSurface *surface) override; void swapBuffers(QPlatformSurface *surface) override;
QEglFSCursorData cursorData;
private: private:
EGLNativeWindowType m_tempWindow; EGLNativeWindowType m_tempWindow;
}; };

View File

@ -40,10 +40,10 @@
#include "qeglfscursor_p.h" #include "qeglfscursor_p.h"
#include "qeglfsintegration_p.h" #include "qeglfsintegration_p.h"
#include "qeglfsscreen_p.h" #include "qeglfsscreen_p.h"
#include "qeglfscontext_p.h"
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLShaderProgram>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QJsonDocument> #include <QtCore/QJsonDocument>
#include <QtCore/QJsonArray> #include <QtCore/QJsonArray>
@ -115,13 +115,6 @@ void QEglFSCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::Device
void QEglFSCursor::resetResources() void QEglFSCursor::resetResources()
{ {
if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) {
GraphicsContextData &gfx(m_gfx[ctx]);
delete gfx.program;
glDeleteTextures(1, &gfx.customCursorTexture);
glDeleteTextures(1, &gfx.atlasTexture);
gfx = GraphicsContextData();
}
m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull(); m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull();
} }
@ -144,8 +137,8 @@ void QEglFSCursor::createShaderPrograms()
" gl_FragColor = texture2D(texture, textureCoord).bgra;\n" " gl_FragColor = texture2D(texture, textureCoord).bgra;\n"
"}\n"; "}\n";
GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]); QEglFSCursorData &gfx = static_cast<QEglFSContext*>(QOpenGLContext::currentContext()->handle())->cursorData;
gfx.program = new QOpenGLShaderProgram; gfx.program.reset(new QOpenGLShaderProgram);
gfx.program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); gfx.program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
gfx.program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); gfx.program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
gfx.program->bindAttributeLocation("vertexCoordEntry", 0); gfx.program->bindAttributeLocation("vertexCoordEntry", 0);
@ -475,7 +468,7 @@ void QEglFSCursor::draw(const QRectF &r)
{ {
StateSaver stateSaver; StateSaver stateSaver;
GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]); QEglFSCursorData &gfx = static_cast<QEglFSContext*>(QOpenGLContext::currentContext()->handle())->cursorData;
if (!gfx.program) { if (!gfx.program) {
// one time initialization // one time initialization
initializeOpenGLFunctions(); initializeOpenGLFunctions();

View File

@ -56,6 +56,7 @@
#include <qpa/qplatformscreen.h> #include <qpa/qplatformscreen.h>
#include <QtGui/QMatrix4x4> #include <QtGui/QMatrix4x4>
#include <QtGui/QOpenGLFunctions> #include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLShaderProgram>
#include <QtGui/private/qinputdevicemanager_p.h> #include <QtGui/private/qinputdevicemanager_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -81,6 +82,15 @@ private:
#if QT_CONFIG(opengl) #if QT_CONFIG(opengl)
struct QEglFSCursorData {
QScopedPointer<QOpenGLShaderProgram> program;
int textureEntry = 0;
int matEntry = 0;
uint customCursorTexture = 0;
uint atlasTexture = 0;
qint64 customCursorKey = 0;
};
class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor
, protected QOpenGLFunctions , protected QOpenGLFunctions
{ {
@ -143,18 +153,6 @@ private:
QEglFSCursorDeviceListener *m_deviceListener; QEglFSCursorDeviceListener *m_deviceListener;
bool m_updateRequested; bool m_updateRequested;
QMatrix4x4 m_rotationMatrix; QMatrix4x4 m_rotationMatrix;
struct GraphicsContextData {
GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0),
customCursorTexture(0), atlasTexture(0), customCursorKey(0) { }
QOpenGLShaderProgram *program;
int textureEntry;
int matEntry;
uint customCursorTexture;
uint atlasTexture;
qint64 customCursorKey;
};
QHash<QOpenGLContext *, GraphicsContextData> m_gfx;
}; };
#endif // QT_CONFIG(opengl) #endif // QT_CONFIG(opengl)

View File

@ -7,8 +7,9 @@ qtConfig(eglfs_egldevice): SUBDIRS *= eglfs_kms_support eglfs_kms_egldevice
qtConfig(eglfs_brcm): SUBDIRS += eglfs_brcm qtConfig(eglfs_brcm): SUBDIRS += eglfs_brcm
qtConfig(eglfs_mali): SUBDIRS += eglfs_mali qtConfig(eglfs_mali): SUBDIRS += eglfs_mali
qtConfig(eglfs_viv): SUBDIRS += eglfs_viv qtConfig(eglfs_viv): SUBDIRS += eglfs_viv
qtConfig(eglfs_rcar): SUBDIRS += eglfs_rcar
qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl
qtConfig(eglfs_openwfd): SUBDIRS += eglfs_openwfd
qtConfig(opengl): SUBDIRS += eglfs_emu qtConfig(opengl): SUBDIRS += eglfs_emu
eglfs_kms_egldevice.depends = eglfs_kms_support eglfs_kms_egldevice.depends = eglfs_kms_support

View File

@ -0,0 +1,3 @@
{
"Keys": [ "eglfs_openwfd" ]
}

View File

@ -0,0 +1,17 @@
TARGET = qeglfs-openwfd-integration
QT += core-private gui-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../../api
CONFIG += egl
SOURCES += $$PWD/qeglfsopenwfdmain.cpp \
$$PWD/qeglfsopenwfdintegration.cpp
HEADERS += $$PWD/qeglfsopenwfdintegration.h
OTHER_FILES += $$PWD/eglfs_openwfd.json
PLUGIN_TYPE = egldeviceintegrations
PLUGIN_CLASS_NAME = QEglFSOpenWFDIntegrationPlugin
load(qt_plugin)

View File

@ -0,0 +1,223 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qeglfsopenwfdintegration.h"
#include "wfd.h"
#include "wfdext2.h"
QT_BEGIN_NAMESPACE
#define MAX_NUM_OF_WFD_BUFFERS 3
#define MAX_NUM_OF_WFD_DEVICES 4
#define MAX_NUM_OF_WFD_PIPELINES 4
#define MAX_NUM_OF_WFD_PORT_MODES 64
#define MAX_NUM_OF_WFD_PORTS 4
typedef struct wfd_buffer {
WFD_EGLImageType* image;
WFDSource source;
} wfd_buffer_t;
typedef struct wfd_window {
WFDDevice dev;
WFDPort port;
WFDPipeline pipeline;
int numBuffers;
wfd_buffer_t buffers[MAX_NUM_OF_WFD_BUFFERS];
} wfd_window_t;
void QEglFSOpenWFDIntegration::platformInit()
{
QEglFSDeviceIntegration::platformInit();
mNativeDisplay = EGL_DEFAULT_DISPLAY;
// Get device list
WFDint numDevs = wfdEnumerateDevices(nullptr, 0, nullptr);
WFDint devIds[MAX_NUM_OF_WFD_DEVICES];
if (numDevs > 0)
wfdEnumerateDevices(devIds, numDevs, nullptr);
// Create device
mDevice = wfdCreateDevice(WFD_DEFAULT_DEVICE_ID, nullptr);
if (WFD_INVALID_HANDLE == mDevice)
qFatal( "Failed to create wfd device");
// Get port list
WFDint portIds[MAX_NUM_OF_WFD_PORTS];
WFDint numPorts = wfdEnumeratePorts(mDevice, nullptr, 0, nullptr);
wfdEnumeratePorts(mDevice, portIds, numPorts, nullptr);
// Create port
mPort = wfdCreatePort(mDevice, portIds[0], nullptr);
if (WFD_INVALID_HANDLE == mPort)
qFatal("Failed to create wfd port");
// Get port modes
WFDint numPortModes = wfdGetPortModes(mDevice, mPort, nullptr, 0);
WFDPortMode portModes[MAX_NUM_OF_WFD_PORT_MODES];
wfdGetPortModes(mDevice, mPort, portModes, numPortModes);
// Get width and height
mScreenSize.setWidth(wfdGetPortModeAttribi(mDevice, mPort, portModes[0], WFD_PORT_MODE_WIDTH));
mScreenSize.setHeight(wfdGetPortModeAttribi(mDevice, mPort, portModes[0], WFD_PORT_MODE_HEIGHT));
// Set port mode
wfdSetPortMode(mDevice, mPort, portModes[0]);
WFDErrorCode eError = wfdGetError(mDevice);
if (WFD_ERROR_NONE != eError)
qFatal("Failed to set wfd port mode");
// Power on
wfdSetPortAttribi(mDevice, mPort, WFD_PORT_POWER_MODE, WFD_POWER_MODE_ON);
eError = wfdGetError(mDevice);
if (WFD_ERROR_NONE != eError)
qFatal("Failed to power on wfd port");
}
QSize QEglFSOpenWFDIntegration::screenSize() const
{
return mScreenSize;
}
EGLNativeDisplayType QEglFSOpenWFDIntegration::platformDisplay() const
{
return mNativeDisplay;
}
EGLNativeWindowType QEglFSOpenWFDIntegration::createNativeWindow(QPlatformWindow *window,
const QSize &size,
const QSurfaceFormat &format)
{
Q_UNUSED(window);
Q_UNUSED(format);
// Get list of pipelines
WFDint numPipelines = wfdEnumeratePipelines(mDevice, nullptr, 0, nullptr);
WFDint pipelineIds[MAX_NUM_OF_WFD_PIPELINES];
wfdEnumeratePipelines(mDevice, pipelineIds, numPipelines, nullptr);
WFDint testId = 0;
testId = pipelineIds[0];
WFDPipeline pipeline = wfdCreatePipeline(mDevice, testId, nullptr);
if (WFD_INVALID_HANDLE == pipeline)
qFatal("Failed to create wfd pipeline");
wfdSetPipelineAttribi(mDevice, pipeline, WFD_PIPELINE_TRANSPARENCY_ENABLE,
(WFD_TRANSPARENCY_SOURCE_ALPHA|WFD_TRANSPARENCY_GLOBAL_ALPHA));
WFDErrorCode eError = wfdGetError(mDevice);
if (WFD_ERROR_NONE != eError)
qFatal("Failed to set WFD_PIPELINE_TRANSPARENCY_ENABLE");
wfdSetPipelineAttribi(mDevice, pipeline, WFD_PIPELINE_GLOBAL_ALPHA, 255);
eError = wfdGetError(mDevice);
if (WFD_ERROR_NONE != eError)
qFatal("Failed to set WFD_PIPELINE_GLOBAL_ALPHA");
wfdBindPipelineToPort(mDevice, mPort, pipeline);
eError = wfdGetError(mDevice);
if (WFD_ERROR_NONE != eError)
qFatal("Failed to bind port to pipeline");
// Create buffers
WFDSource source[MAX_NUM_OF_WFD_BUFFERS] = {WFD_INVALID_HANDLE, WFD_INVALID_HANDLE,
WFD_INVALID_HANDLE};
WFDEGLImage eglImageHandles[MAX_NUM_OF_WFD_BUFFERS];
WFD_EGLImageType* wfdEglImages[MAX_NUM_OF_WFD_BUFFERS];
for (int i = 0; i < MAX_NUM_OF_WFD_BUFFERS; i++) {
wfdCreateWFDEGLImages(mDevice, mScreenSize.width(), mScreenSize.height(),
WFD_FORMAT_RGBA8888, WFD_USAGE_OPENGL_ES2 | WFD_USAGE_DISPLAY,
1, &(eglImageHandles[i]), 0);
wfdEglImages[i] = (WFD_EGLImageType *)(eglImageHandles[i]);
if (WFD_INVALID_HANDLE == wfdEglImages[i])
qFatal("Failed to create WDFEGLImages");
source[i] = wfdCreateSourceFromImage(mDevice, pipeline, eglImageHandles[i], nullptr);
if (WFD_INVALID_HANDLE == source[i])
qFatal("Failed to create source from EGLImage");
}
// Commit port
wfdDeviceCommit(mDevice, WFD_COMMIT_ENTIRE_PORT, mPort);
eError = wfdGetError(mDevice);
if (WFD_ERROR_NONE != eError)
qFatal("Failed to commit port");
// Create native window
wfd_window_t* nativeWindow = (wfd_window_t*)malloc(sizeof(wfd_window_t));
if (nullptr == nativeWindow)
qFatal("Failed to allocate memory for native window");
nativeWindow->dev = mDevice;
nativeWindow->port = mPort;
nativeWindow->pipeline = pipeline;
nativeWindow->numBuffers = MAX_NUM_OF_WFD_BUFFERS;
for (int i = 0; i < MAX_NUM_OF_WFD_BUFFERS; i++) {
nativeWindow->buffers[i].image = wfdEglImages[i];
nativeWindow->buffers[i].source = source[i];
}
return (EGLNativeWindowType)nativeWindow;
}
QSurfaceFormat QEglFSOpenWFDIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
{
QSurfaceFormat format;
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
format.setAlphaBufferSize(8);
return format;
}
void QEglFSOpenWFDIntegration::destroyNativeWindow(EGLNativeWindowType window)
{
free((void*)window);
}
QT_END_NAMESPACE

View File

@ -0,0 +1,69 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QEGLFSOPENWFDINTEGRATION_H
#define QEGLFSOPENWFDINTEGRATION_H
#include "private/qeglfsdeviceintegration_p.h"
#define WFD_WFDEXT_PROTOTYPES
#include "wfd.h"
#include "wfdext2.h"
QT_BEGIN_NAMESPACE
class QEglFSOpenWFDIntegration : public QEglFSDeviceIntegration
{
public:
void platformInit() override;
QSize screenSize() const override;
EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) override;
void destroyNativeWindow(EGLNativeWindowType window) override;
EGLNativeDisplayType platformDisplay() const override;
virtual QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const;
private:
QSize mScreenSize;
EGLNativeDisplayType mNativeDisplay;
WFDDevice mDevice;
WFDPort mPort;
};
QT_END_NAMESPACE
#endif

View File

@ -0,0 +1,58 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfsopenwfdintegration.h"
QT_BEGIN_NAMESPACE
class QEglFSOpenWFDIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_openwfd.json")
public:
QEglFSDeviceIntegration *create() override {
return new QEglFSOpenWFDIntegration;
}
};
QT_END_NAMESPACE
#include "qeglfsopenwfdmain.moc"

View File

@ -0,0 +1,3 @@
{
"Keys": [ "eglfs_rcar" ]
}

View File

@ -0,0 +1,19 @@
TARGET = qeglfs-rcar-integration
QT += core-private gui-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../../api
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
SOURCES += $$PWD/qeglfsrcarmain.cpp \
$$PWD/qeglfsrcarintegration.cpp
HEADERS += $$PWD/qeglfsrcarintegration.h
OTHER_FILES += $$PWD/eglfs_rcar.json
PLUGIN_TYPE = egldeviceintegrations
PLUGIN_CLASS_NAME = QEglFSRcarIntegrationPlugin
load(qt_plugin)

View File

@ -0,0 +1,159 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QDebug>
#include <QtEglSupport/private/qeglconvenience_p.h>
#include <EGL/egl.h>
#include "INTEGRITY.h"
#include "qeglfsrcarintegration.h"
#define RCAR_DEFAULT_DISPLAY 1
#define RCAR_DEFAULT_WM_LAYER 2
extern "C" unsigned long PVRGrfxServerInit(void);
QT_BEGIN_NAMESPACE
void QEglFSRcarIntegration::platformInit()
{
QEglFSDeviceIntegration::platformInit();
PVRGrfxServerInit();
mScreenSize = q_screenSizeFromFb(0);
mNativeDisplay = (NativeDisplayType)EGL_DEFAULT_DISPLAY;
}
QSize QEglFSRcarIntegration::screenSize() const
{
return mScreenSize;
}
EGLNativeDisplayType QEglFSRcarIntegration::platformDisplay() const
{
return mNativeDisplay;
}
static r_wm_WinColorFmt_t getWMColorFormat(const QSurfaceFormat &format)
{
const int a = format.alphaBufferSize();
const int r = format.redBufferSize();
const int g = format.greenBufferSize();
const int b = format.blueBufferSize();
switch (r) {
case 4:
if (g == 4 && b == 4 && a == 4)
return R_WM_COLORFMT_ARGB4444;
break;
case 5:
if (g == 6 && b == 5 && a == 0)
return R_WM_COLORFMT_RGB565;
else if (g == 5 && b == 5 && a == 1)
return R_WM_COLORFMT_ARGB1555;
break;
case 8:
if (g == 8 && b == 8 && a == 0)
return R_WM_COLORFMT_RGB0888;
else if (g == 8 && b == 8 && a == 8)
return R_WM_COLORFMT_ARGB8888;
break;
}
qFatal("Unsupported color format: R:%d G:%d B:%d A:%d", r, g, b, a);
return R_WM_COLORFMT_LAST;
}
EGLNativeWindowType QEglFSRcarIntegration::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format)
{
bool ok;
mNativeDisplayID = qEnvironmentVariableIntValue("QT_QPA_WM_DISP_ID", &ok);
if (!ok)
mNativeDisplayID = RCAR_DEFAULT_DISPLAY;
r_wm_Error_t wm_err = R_WM_DevInit(mNativeDisplayID);
if (wm_err != R_WM_ERR_OK)
qFatal("Failed to init WM Dev: %d, error: %d", mNativeDisplayID, wm_err);
mNativeWindow = (EGLNativeWindowTypeREL*)malloc(sizeof(EGLNativeWindowTypeREL));
memset(mNativeWindow, 0, sizeof(EGLNativeWindowTypeREL));
mNativeWindow->ColorFmt = getWMColorFormat(format);
mNativeWindow->PosX = 0;
mNativeWindow->PosY = 0;
mNativeWindow->PosZ = qEnvironmentVariableIntValue("QT_QPA_WM_LAYER", &ok);
if (!ok)
mNativeWindow->PosZ = RCAR_DEFAULT_WM_LAYER;
mNativeWindow->Pitch = size.width();
mNativeWindow->Width = size.width();
mNativeWindow->Height = size.height();
mNativeWindow->Alpha = format.alphaBufferSize();
if (format.swapBehavior() == QSurfaceFormat::DefaultSwapBehavior)
mNativeWindow->Surface.BufNum = 3;
else
mNativeWindow->Surface.BufNum = format.swapBehavior();
mNativeWindow->Surface.Type = R_WM_SURFACE_FB;
mNativeWindow->Surface.BufMode = R_WM_WINBUF_ALLOC_INTERNAL;
wm_err = R_WM_WindowCreate(mNativeDisplayID, mNativeWindow);
if (wm_err != R_WM_ERR_OK)
qFatal("Failed to create window layer: %d", wm_err);
wm_err = R_WM_DevEventRegister(mNativeDisplayID, R_WM_EVENT_VBLANK, 0);
if (wm_err != R_WM_ERR_OK)
qFatal("Failed to Register vsync event: %d", wm_err);
wm_err = R_WM_WindowEnable(mNativeDisplayID, mNativeWindow);
if (wm_err != R_WM_ERR_OK)
qFatal("Failed to Enable window surface: %d", wm_err);
return static_cast<EGLNativeWindowType>(mNativeWindow);
}
void QEglFSRcarIntegration::destroyNativeWindow(EGLNativeWindowType window)
{
R_WM_WindowDisable(mNativeDisplayID, mNativeWindow);
usleep(100000); //Needed to allow Window Manager make the window transparent
R_WM_WindowDelete(mNativeDisplayID, mNativeWindow);
R_WM_DevDeinit(mNativeDisplayID);
free(mNativeWindow);
}
QT_END_NAMESPACE

View File

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QEGLFSVIVINTEGRATION_H
#define QEGLFSVIVINTEGRATION_H
#include "private/qeglfsdeviceintegration_p.h"
#include "EGL/eglext_REL.h"
QT_BEGIN_NAMESPACE
class QEglFSRcarIntegration : public QEglFSDeviceIntegration
{
public:
void platformInit() override;
QSize screenSize() const override;
EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) override;
void destroyNativeWindow(EGLNativeWindowType window) override;
EGLNativeDisplayType platformDisplay() const override;
private:
QSize mScreenSize;
EGLNativeDisplayType mNativeDisplay;
EGLNativeWindowTypeREL *mNativeWindow;
int mNativeDisplayID;
};
QT_END_NAMESPACE
#endif

View File

@ -0,0 +1,57 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "INTEGRITY.h"
#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfsrcarintegration.h"
QT_BEGIN_NAMESPACE
class QEglFSRcarIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_rcar.json")
public:
QEglFSDeviceIntegration *create() override { return new QEglFSRcarIntegration; }
};
QT_END_NAMESPACE
#include "qeglfsrcarmain.moc"

View File

@ -8,13 +8,18 @@ QT += \
SOURCES = \ SOURCES = \
main.cpp \ main.cpp \
qintegrityfbintegration.cpp \ qintegrityfbintegration.cpp \
qintegrityfbscreen.cpp \ qintegrityfbscreen.cpp
qintegrityhidmanager.cpp
HEADERS = \ HEADERS = \
qintegrityfbintegration.h \ qintegrityfbintegration.h \
qintegrityfbscreen.h \ qintegrityfbscreen.h
qintegrityhidmanager.h
qtConfig(integrityhid) {
SOURCES += \
qintegrityhidmanager.cpp
HEADERS += \
qintegrityhidmanager.h
}
OTHER_FILES += integrity.json OTHER_FILES += integrity.json

View File

@ -40,20 +40,24 @@
#ifndef QIOSAPPLICATIONSTATE_H #ifndef QIOSAPPLICATIONSTATE_H
#define QIOSAPPLICATIONSTATE_H #define QIOSAPPLICATIONSTATE_H
#include <QtCore/qglobal.h> #include <QtCore/qobject.h>
#include <QtCore/qvector.h>
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject); #include <UIKit/UIApplication.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QIOSApplicationState class QIOSApplicationState : public QObject
{ {
Q_OBJECT
public: public:
QIOSApplicationState(); QIOSApplicationState();
~QIOSApplicationState();
private: static void handleApplicationStateChanged(UIApplicationState state, const QString &reason);
QVector<NSObject*> m_observers; static Qt::ApplicationState toQtApplicationState(UIApplicationState state);
Q_SIGNALS:
void applicationStateWillChange(Qt::ApplicationState);
void applicationStateDidChange(Qt::ApplicationState);
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -40,82 +40,77 @@
#include "qiosapplicationstate.h" #include "qiosapplicationstate.h"
#include "qiosglobal.h" #include "qiosglobal.h"
#include "qiosintegration.h"
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <QtCore/qcoreapplication.h> #include <QtCore/qcoreapplication.h>
#include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qguiapplication_p.h>
#import <UIKit/UIKit.h>
static Qt::ApplicationState qtApplicationState(UIApplicationState uiApplicationState)
{
switch (uiApplicationState) {
case UIApplicationStateActive:
// The application is visible in front, and receiving events
return Qt::ApplicationActive;
case UIApplicationStateInactive:
// The app is running in the foreground but is not receiving events. This
// typically happens while transitioning to/from active/background, like
// upon app launch or when receiving incoming calls.
return Qt::ApplicationInactive;
case UIApplicationStateBackground:
// Normally the app would enter this state briefly before it gets
// suspeded (you have five seconds, according to Apple).
// You can request more time and start a background task, which would
// normally map closer to Qt::ApplicationHidden. But since we have no
// API for doing that yet, we handle this state as "about to be suspended".
// Note: A screen-shot for the SpringBoard will also be taken after this
// call returns.
return Qt::ApplicationSuspended;
}
}
static void handleApplicationStateChanged(UIApplicationState uiApplicationState)
{
Qt::ApplicationState state = qtApplicationState(uiApplicationState);
qCDebug(lcQpaApplication) << "moved to" << state;
QWindowSystemInterface::handleApplicationStateChanged(state);
}
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QIOSApplicationState::QIOSApplicationState() static void qRegisterApplicationStateNotifications()
{ {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
m_observers.push_back([notificationCenter addObserverForName:UIApplicationDidBecomeActiveNotification // Map between notifications and corresponding application state. Note that
object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *) { // there's no separate notification for moving to UIApplicationStateInactive,
handleApplicationStateChanged(UIApplicationStateActive); // so we use UIApplicationWillResignActiveNotification as an intermediate.
} static QMap<NSNotificationName, UIApplicationState> notifications {
]); { UIApplicationWillEnterForegroundNotification, UIApplicationStateInactive },
{ UIApplicationDidBecomeActiveNotification, UIApplicationStateActive },
{ UIApplicationWillResignActiveNotification, UIApplicationStateInactive },
{ UIApplicationDidEnterBackgroundNotification, UIApplicationStateBackground },
};
m_observers.push_back([notificationCenter addObserverForName:UIApplicationWillResignActiveNotification for (auto i = notifications.constBegin(); i != notifications.constEnd(); ++i) {
object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *) { [notificationCenter addObserverForName:i.key() object:nil queue:mainQueue
// Note: UIApplication is still UIApplicationStateActive at this point, usingBlock:^void(NSNotification *notification) {
// but since there is no separate notification for the inactive state, NSRange nameRange = NSMakeRange(2, notification.name.length - 14);
// we report UIApplicationStateInactive now. QString reason = QString::fromNSString([notification.name substringWithRange:nameRange]);
handleApplicationStateChanged(UIApplicationStateInactive); QIOSApplicationState::handleApplicationStateChanged(i.value(), reason);
} }];
]); }
m_observers.push_back([notificationCenter addObserverForName:UIApplicationDidEnterBackgroundNotification
object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *) {
handleApplicationStateChanged(UIApplicationStateBackground);
}
]);
// Initialize correct startup state, which may not be the Qt default (inactive) // Initialize correct startup state, which may not be the Qt default (inactive)
UIApplicationState startupState = [UIApplication sharedApplication].applicationState; UIApplicationState startupState = [UIApplication sharedApplication].applicationState;
QGuiApplicationPrivate::applicationState = qtApplicationState(startupState); QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application loaded"));
}
Q_CONSTRUCTOR_FUNCTION(qRegisterApplicationStateNotifications)
QIOSApplicationState::QIOSApplicationState()
{
UIApplicationState startupState = [UIApplication sharedApplication].applicationState;
QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application launched"));
} }
QIOSApplicationState::~QIOSApplicationState() void QIOSApplicationState::handleApplicationStateChanged(UIApplicationState uiState, const QString &reason)
{ {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; Qt::ApplicationState state = toQtApplicationState(uiState);
foreach (const NSObject* observer, m_observers) qCDebug(lcQpaApplication) << qPrintable(reason)
[notificationCenter removeObserver:observer]; << "- moving from" << QGuiApplication::applicationState() << "to" << state;
if (QIOSIntegration *integration = QIOSIntegration::instance()) {
emit integration->applicationState.applicationStateWillChange(state);
QWindowSystemInterface::handleApplicationStateChanged(state);
emit integration->applicationState.applicationStateDidChange(state);
qCDebug(lcQpaApplication) << "done moving to" << state;
} else {
qCDebug(lcQpaApplication) << "no platform integration yet, setting state directly";
QGuiApplicationPrivate::applicationState = state;
}
} }
Qt::ApplicationState QIOSApplicationState::toQtApplicationState(UIApplicationState state)
{
switch (state) {
case UIApplicationStateActive: return Qt::ApplicationActive;
case UIApplicationStateInactive: return Qt::ApplicationInactive;
case UIApplicationStateBackground: return Qt::ApplicationSuspended;
}
}
#include "moc_qiosapplicationstate.cpp"
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -87,6 +87,7 @@ private:
bool isComplete; bool isComplete;
}; };
static bool verifyGraphicsHardwareAvailability();
static void deleteBuffers(const FramebufferObject &framebufferObject); static void deleteBuffers(const FramebufferObject &framebufferObject);
FramebufferObject &backingFramebufferObjectFor(QPlatformSurface *) const; FramebufferObject &backingFramebufferObjectFor(QPlatformSurface *) const;

View File

@ -38,10 +38,13 @@
****************************************************************************/ ****************************************************************************/
#include "qioscontext.h" #include "qioscontext.h"
#include "qiosintegration.h"
#include "qioswindow.h" #include "qioswindow.h"
#include <dlfcn.h> #include <dlfcn.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLContext>
#import <OpenGLES/EAGL.h> #import <OpenGLES/EAGL.h>
@ -136,6 +139,9 @@ bool QIOSContext::makeCurrent(QPlatformSurface *surface)
{ {
Q_ASSERT_IS_GL_SURFACE(surface); Q_ASSERT_IS_GL_SURFACE(surface);
if (!verifyGraphicsHardwareAvailability())
return false;
[EAGLContext setCurrentContext:m_eaglContext]; [EAGLContext setCurrentContext:m_eaglContext];
// For offscreen surfaces we don't prepare a default FBO // For offscreen surfaces we don't prepare a default FBO
@ -214,18 +220,12 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
{ {
Q_ASSERT_IS_GL_SURFACE(surface); Q_ASSERT_IS_GL_SURFACE(surface);
if (!verifyGraphicsHardwareAvailability())
return;
if (surface->surface()->surfaceClass() == QSurface::Offscreen) if (surface->surface()->surfaceClass() == QSurface::Offscreen)
return; // Nothing to do return; // Nothing to do
// When using threaded rendering, the render-thread may not have picked up
// yet on the fact that a window is no longer exposed, and will try to swap
// a non-exposed window. This may in some cases result in crashes, e.g. when
// iOS is suspending an application, so we have an extra guard here.
if (!static_cast<QIOSWindow *>(surface)->isExposed()) {
qCDebug(lcQpaGLContext, "Detected swapBuffers on a non-exposed window, skipping flush");
return;
}
FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface); FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface);
Q_ASSERT_X(framebufferObject.isComplete, "QIOSContext", "swapBuffers on incomplete FBO"); Q_ASSERT_X(framebufferObject.isComplete, "QIOSContext", "swapBuffers on incomplete FBO");
@ -287,6 +287,54 @@ bool QIOSContext::needsRenderbufferResize(QPlatformSurface *surface) const
return false; return false;
} }
bool QIOSContext::verifyGraphicsHardwareAvailability()
{
// Per the iOS OpenGL ES Programming Guide, background apps may not execute commands on the
// graphics hardware. Specifically: "In your app delegates applicationDidEnterBackground:
// method, your app may want to delete some of its OpenGL ES objects to make memory and
// resources available to the foreground app. Call the glFinish function to ensure that
// the resources are removed immediately. After your app exits its applicationDidEnterBackground:
// method, it must not make any new OpenGL ES calls. If it makes an OpenGL ES call, it is
// terminated by iOS.".
static bool applicationBackgrounded = QGuiApplication::applicationState() == Qt::ApplicationSuspended;
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
QIOSApplicationState *applicationState = &QIOSIntegration::instance()->applicationState;
connect(applicationState, &QIOSApplicationState::applicationStateWillChange, [](Qt::ApplicationState state) {
if (applicationBackgrounded && state != Qt::ApplicationSuspended) {
qCDebug(lcQpaGLContext) << "app no longer backgrounded, rendering enabled";
applicationBackgrounded = false;
}
});
connect(applicationState, &QIOSApplicationState::applicationStateDidChange, [](Qt::ApplicationState state) {
if (state != Qt::ApplicationSuspended)
return;
qCDebug(lcQpaGLContext) << "app backgrounded, rendering disabled";
applicationBackgrounded = true;
// By the time we receive this signal the application has moved into
// Qt::ApplactionStateSuspended, and all windows have been obscured,
// which should stop all rendering. If there's still an active GL context,
// we follow Apple's advice and call glFinish before making it inactive.
if (QOpenGLContext *currentContext = QOpenGLContext::currentContext()) {
qCWarning(lcQpaGLContext) << "explicitly glFinishing and deactivating" << currentContext;
glFinish();
currentContext->doneCurrent();
}
});
});
if (applicationBackgrounded) {
static const char warning[] = "OpenGL ES calls are not allowed while an application is backgrounded";
Q_ASSERT_X(!applicationBackgrounded, "QIOSContext", warning);
qCWarning(lcQpaGLContext, warning);
}
return !applicationBackgrounded;
}
void QIOSContext::windowDestroyed(QObject *object) void QIOSContext::windowDestroyed(QObject *object)
{ {
QIOSWindow *window = static_cast<QIOSWindow *>(object); QIOSWindow *window = static_cast<QIOSWindow *>(object);

Some files were not shown because too many files have changed in this diff Show More