diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7a3e721cf5..a1f85f5fd1 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -5,7 +5,7 @@ on: paths-ignore: - 'docs/**' - '**.md' - - '!docs/building-cmake.md' + - '!docs/building-linux.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -13,7 +13,6 @@ on: - '!.github/workflows/linux.yml' - 'snap/**' - 'Telegram/build/**' - - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' @@ -25,7 +24,7 @@ on: paths-ignore: - 'docs/**' - '**.md' - - '!docs/building-cmake.md' + - '!docs/building-linux.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -33,7 +32,6 @@ on: - '!.github/workflows/linux.yml' - 'snap/**' - 'Telegram/build/**' - - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 621b1dc137..5f80f01425 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -5,7 +5,7 @@ on: paths-ignore: - 'docs/**' - '**.md' - - '!docs/building-xcode.md' + - '!docs/building-mac.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -14,7 +14,6 @@ on: - 'lib/xdg/**' - 'snap/**' - 'Telegram/build/**' - - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' @@ -24,7 +23,7 @@ on: paths-ignore: - 'docs/**' - '**.md' - - '!docs/building-xcode.md' + - '!docs/building-mac.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -33,7 +32,6 @@ on: - 'lib/xdg/**' - 'snap/**' - 'Telegram/build/**' - - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' @@ -64,7 +62,7 @@ jobs: UPLOAD_ARTIFACT: "false" ONLY_CACHE: "false" MANUAL_CACHING: "2" - DOC_PATH: "docs/building-xcode.md" + DOC_PATH: "docs/building-mac.md" AUTO_CACHING: "1" steps: diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index cf133b5bc5..0badcff0d3 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -11,7 +11,6 @@ on: - '.github/**' - '!.github/workflows/snap.yml' - 'Telegram/build/**' - - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' @@ -29,7 +28,6 @@ on: - '.github/**' - '!.github/workflows/snap.yml' - 'Telegram/build/**' - - 'Telegram/Patches/**' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index e20de05890..85923e1ac2 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -5,7 +5,7 @@ on: paths-ignore: - 'docs/**' - '**.md' - - '!docs/building-msvc.md' + - '!docs/building-win.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -14,8 +14,6 @@ on: - 'lib/xdg/**' - 'snap/**' - 'Telegram/build/**' - - 'Telegram/Patches/**' - - '!Telegram/Patches/build_ffmpeg_win.sh' - 'Telegram/Resources/uwp/**' - 'Telegram/SourceFiles/platform/linux/**' - 'Telegram/SourceFiles/platform/mac/**' @@ -26,7 +24,7 @@ on: paths-ignore: - 'docs/**' - '**.md' - - '!docs/building-msvc.md' + - '!docs/building-win.md' - 'changelog.txt' - 'LEGAL' - 'LICENSE' @@ -35,12 +33,9 @@ on: - 'lib/xdg/**' - 'snap/**' - 'Telegram/build/**' - - 'Telegram/Patches/**' - - '!Telegram/Patches/build_ffmpeg_win.sh' - 'Telegram/Resources/uwp/**' - 'Telegram/SourceFiles/platform/linux/**' - 'Telegram/SourceFiles/platform/mac/**' - - '!Telegram/Patches/breakpad.diff' - 'Telegram/Telegram/**' - 'Telegram/configure.sh' - 'Telegram/Telegram.plist' @@ -65,7 +60,7 @@ jobs: UPLOAD_ARTIFACT: "false" ONLY_CACHE: "false" MANUAL_CACHING: "2" - DOC_PATH: "docs/building-msvc.md" + DOC_PATH: "docs/building-win.md" AUTO_CACHING: "1" defaults: diff --git a/README.md b/README.md index a6983362b8..b81f5da898 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,9 @@ Version **1.8.15** was the last that supports older systems ## Build instructions -* Visual Studio 2019 [(32 bits)][msvc32] [(64 bits)][msvc64] -* [Xcode 12][xcode] -* [CMake on GNU/Linux][cmake] +* Windows [(32-bit)][win32] [(64-bit)][win64] +* [macOS][mac] +* [GNU/Linux using Docker][linux] [//]: # (LINKS) [telegram]: https://telegram.org @@ -73,10 +73,9 @@ Version **1.8.15** was the last that supports older systems [telegram_api]: https://core.telegram.org [telegram_proto]: https://core.telegram.org/mtproto [license]: LICENSE -[msvc32]: docs/building-msvc.md -[msvc64]: docs/building-msvc-x64.md -[xcode]: docs/building-xcode.md -[xcode_old]: docs/building-xcode-old.md -[cmake]: docs/building-cmake.md +[win32]: docs/building-win.md +[win64]: docs/building-win-x64.md +[mac]: docs/building-mac.md +[linux]: docs/building-linux.md [preview_image]: https://github.com/telegramdesktop/tdesktop/blob/dev/docs/assets/preview.png "Preview of Telegram Desktop" [preview_image_url]: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/docs/assets/preview.png diff --git a/Telegram/Patches/breakpad.diff b/Telegram/Patches/breakpad.diff deleted file mode 100644 index ddcddbc613..0000000000 --- a/Telegram/Patches/breakpad.diff +++ /dev/null @@ -1,651 +0,0 @@ -diff --git a/src/build/common.gypi b/src/build/common.gypi -index 29990c65..53e99d44 100644 ---- a/src/build/common.gypi -+++ b/src/build/common.gypi -@@ -330,6 +330,7 @@ - 'VCCLCompilerTool': { - 'WarnAsError': 'true', - 'Detect64BitPortabilityProblems': 'false', -+ 'TreatWChar_tAsBuiltInType': 'false', - }, - }, - }], -diff --git a/src/client/mac/Breakpad.xcodeproj/project.pbxproj b/src/client/mac/Breakpad.xcodeproj/project.pbxproj -index 1a93ce6d..b5986e33 100644 ---- a/src/client/mac/Breakpad.xcodeproj/project.pbxproj -+++ b/src/client/mac/Breakpad.xcodeproj/project.pbxproj -@@ -35,6 +35,19 @@ - /* End PBXAggregateTarget section */ - - /* Begin PBXBuildFile section */ -+ 0748C0431C63C409004489BF /* MachIPC.mm in Sources */ = {isa = PBXBuildFile; fileRef = F92C53790ECCE635009BE4BA /* MachIPC.mm */; }; -+ 0748C0441C63C43C004489BF /* minidump_generator.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C536F0ECCE3FD009BE4BA /* minidump_generator.cc */; }; -+ 0748C0451C63C46C004489BF /* string_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53820ECCE635009BE4BA /* string_utilities.cc */; }; -+ 0748C0461C63C484004489BF /* minidump_file_writer.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C538F0ECCE70A009BE4BA /* minidump_file_writer.cc */; }; -+ 0748C0471C63C4A1004489BF /* dynamic_images.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C536B0ECCE3FD009BE4BA /* dynamic_images.cc */; }; -+ 0748C0491C63C4CF004489BF /* macho_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C537A0ECCE635009BE4BA /* macho_id.cc */; }; -+ 0748C04A1C63C4D4004489BF /* string_conversion.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53850ECCE6AD009BE4BA /* string_conversion.cc */; }; -+ 0748C04B1C63C4DB004489BF /* convert_UTF.c in Sources */ = {isa = PBXBuildFile; fileRef = F92C53870ECCE6C0009BE4BA /* convert_UTF.c */; }; -+ 0748C04C1C63C4EA004489BF /* macho_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C537C0ECCE635009BE4BA /* macho_utilities.cc */; }; -+ 0748C04D1C63C50F004489BF /* file_id.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53740ECCE635009BE4BA /* file_id.cc */; }; -+ 0748C04E1C63C51C004489BF /* md5.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D72CA0D13DFAD5C006CABE3 /* md5.cc */; }; -+ 0748C04F1C63C523004489BF /* macho_walker.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C537E0ECCE635009BE4BA /* macho_walker.cc */; }; -+ 0748C0501C63C52D004489BF /* bootstrap_compat.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D61A25D14F43CFC002D5862 /* bootstrap_compat.cc */; }; - 162F64F2161C577500CD68D5 /* arch_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 162F64F0161C577500CD68D5 /* arch_utilities.cc */; }; - 162F64F3161C577500CD68D5 /* arch_utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 162F64F1161C577500CD68D5 /* arch_utilities.h */; }; - 162F64F4161C579B00CD68D5 /* arch_utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 162F64F0161C577500CD68D5 /* arch_utilities.cc */; }; -@@ -67,6 +80,7 @@ - 4DBE49A7134A4F280072546A /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DBE4769134A4F080072546A /* CoreServices.framework */; }; - 4DBE49A8134A4F380072546A /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DBE4769134A4F080072546A /* CoreServices.framework */; }; - 4DBE49A9134A4F460072546A /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DBE4769134A4F080072546A /* CoreServices.framework */; }; -+ 5A8B220921E0C5740045F83C /* breakpad_nlist_64.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53690ECCE3FD009BE4BA /* breakpad_nlist_64.cc */; }; - 8B3101C611F0CD9F00FCF3E4 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; - 8B3101C711F0CD9F00FCF3E4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; - 8B3101CA11F0CDB000FCF3E4 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; -@@ -170,11 +184,8 @@ - F92C564A0ECD10CA009BE4BA /* string_conversion.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53850ECCE6AD009BE4BA /* string_conversion.cc */; }; - F92C564C0ECD10DD009BE4BA /* breakpadUtilities.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F92C563C0ECD10B3009BE4BA /* breakpadUtilities.dylib */; }; - F92C56570ECD113E009BE4BA /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F92C554A0ECCF530009BE4BA /* Carbon.framework */; }; -- F92C565C0ECD1158009BE4BA /* breakpadUtilities.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F92C563C0ECD10B3009BE4BA /* breakpadUtilities.dylib */; }; - F92C565F0ECD116B009BE4BA /* protected_memory_allocator.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C53720ECCE3FD009BE4BA /* protected_memory_allocator.cc */; }; - F92C56630ECD1179009BE4BA /* exception_handler.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C536D0ECCE3FD009BE4BA /* exception_handler.cc */; }; -- F92C56650ECD1185009BE4BA /* breakpadUtilities.dylib in Resources */ = {isa = PBXBuildFile; fileRef = F92C563C0ECD10B3009BE4BA /* breakpadUtilities.dylib */; }; -- F92C568A0ECD15F9009BE4BA /* Inspector in Resources */ = {isa = PBXBuildFile; fileRef = F92C53540ECCE349009BE4BA /* Inspector */; }; - F92C56A90ECE04C5009BE4BA /* crash_report_sender.m in Sources */ = {isa = PBXBuildFile; fileRef = F92C56A80ECE04C5009BE4BA /* crash_report_sender.m */; }; - F93803CD0F8083B7004D428B /* dynamic_images.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C536B0ECCE3FD009BE4BA /* dynamic_images.cc */; }; - F93803CE0F8083B7004D428B /* exception_handler.cc in Sources */ = {isa = PBXBuildFile; fileRef = F92C536D0ECCE3FD009BE4BA /* exception_handler.cc */; }; -@@ -213,7 +224,6 @@ - F9C44DBD0EF072A0003AEBAA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9C44DBA0EF072A0003AEBAA /* MainMenu.xib */; }; - F9C44E000EF077CD003AEBAA /* Breakpad.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Breakpad.framework */; }; - F9C44E3C0EF08B12003AEBAA /* Breakpad.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Breakpad.framework */; }; -- F9C44E980EF09F56003AEBAA /* crash_report_sender.app in Resources */ = {isa = PBXBuildFile; fileRef = F92C56A00ECE04A7009BE4BA /* crash_report_sender.app */; }; - F9C44EA20EF09F93003AEBAA /* HTTPMultipartUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = F92C53770ECCE635009BE4BA /* HTTPMultipartUpload.m */; }; - F9C44EE50EF0A006003AEBAA /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F9C44EE40EF0A006003AEBAA /* SystemConfiguration.framework */; }; - F9C44EE90EF0A3C1003AEBAA /* GTMLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = F9C44EE80EF0A3C1003AEBAA /* GTMLogger.m */; }; -@@ -410,20 +420,6 @@ - remoteGlobalIDString = F92C563B0ECD10B3009BE4BA; - remoteInfo = breakpadUtilities; - }; -- F92C56850ECD15EF009BE4BA /* PBXContainerItemProxy */ = { -- isa = PBXContainerItemProxy; -- containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; -- proxyType = 1; -- remoteGlobalIDString = F92C563B0ECD10B3009BE4BA; -- remoteInfo = breakpadUtilities; -- }; -- F92C56870ECD15F1009BE4BA /* PBXContainerItemProxy */ = { -- isa = PBXContainerItemProxy; -- containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; -- proxyType = 1; -- remoteGlobalIDString = F92C53530ECCE349009BE4BA; -- remoteInfo = Inspector; -- }; - F93DE2FB0F82C3C600608B94 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; -@@ -536,13 +532,6 @@ - remoteGlobalIDString = 8DC2EF4F0486A6940098B216; - remoteInfo = Breakpad; - }; -- F9C44E960EF09F4B003AEBAA /* PBXContainerItemProxy */ = { -- isa = PBXContainerItemProxy; -- containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; -- proxyType = 1; -- remoteGlobalIDString = F92C569F0ECE04A7009BE4BA; -- remoteInfo = crash_report_sender; -- }; - /* End PBXContainerItemProxy section */ - - /* Begin PBXCopyFilesBuildPhase section */ -@@ -714,7 +703,6 @@ - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( -- F92C565C0ECD1158009BE4BA /* breakpadUtilities.dylib in Frameworks */, - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; -@@ -1181,18 +1169,13 @@ - isa = PBXNativeTarget; - buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Breakpad" */; - buildPhases = ( -- F97A0E850ED4EC15008784D3 /* Change install name of breakpadUtilities */, - 8DC2EF500486A6940098B216 /* Headers */, -- 8DC2EF520486A6940098B216 /* Resources */, - 8DC2EF540486A6940098B216 /* Sources */, - 8DC2EF560486A6940098B216 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( -- F92C56860ECD15EF009BE4BA /* PBXTargetDependency */, -- F92C56880ECD15F1009BE4BA /* PBXTargetDependency */, -- F9C44E970EF09F4B003AEBAA /* PBXTargetDependency */, - ); - name = Breakpad; - productInstallPath = "$(HOME)/Library/Frameworks"; -@@ -1399,6 +1382,8 @@ - /* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; -+ attributes = { -+ }; - buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Breakpad" */; - compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; -@@ -1583,16 +1568,6 @@ - /* End PBXReferenceProxy section */ - - /* Begin PBXResourcesBuildPhase section */ -- 8DC2EF520486A6940098B216 /* Resources */ = { -- isa = PBXResourcesBuildPhase; -- buildActionMask = 2147483647; -- files = ( -- F9C44E980EF09F56003AEBAA /* crash_report_sender.app in Resources */, -- F92C568A0ECD15F9009BE4BA /* Inspector in Resources */, -- F92C56650ECD1185009BE4BA /* breakpadUtilities.dylib in Resources */, -- ); -- runOnlyForDeploymentPostprocessing = 0; -- }; - F92C569C0ECE04A7009BE4BA /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; -@@ -1640,20 +1615,6 @@ - shellPath = /bin/sh; - shellScript = "install_name_tool -id \"@executable_path/../Resources/breakpadUtilities.dylib\" \"${BUILT_PRODUCTS_DIR}/breakpadUtilities.dylib\"\n"; - }; -- F97A0E850ED4EC15008784D3 /* Change install name of breakpadUtilities */ = { -- isa = PBXShellScriptBuildPhase; -- buildActionMask = 2147483647; -- files = ( -- ); -- inputPaths = ( -- ); -- name = "Change install name of breakpadUtilities"; -- outputPaths = ( -- ); -- runOnlyForDeploymentPostprocessing = 0; -- shellPath = /bin/sh; -- shellScript = "#!/bin/bash\ninstall_name_tool -id \"@executable_path/../Frameworks/Breakpad.framework/Resources/breakpadUtilities.dylib\" \"${BUILT_PRODUCTS_DIR}/breakpadUtilities.dylib\"\n"; -- }; - F9C77DD80F7DD5CF0045F7DB /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; -@@ -1674,6 +1635,20 @@ - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( -+ 5A8B220921E0C5740045F83C /* breakpad_nlist_64.cc in Sources */, -+ 0748C0501C63C52D004489BF /* bootstrap_compat.cc in Sources */, -+ 0748C04F1C63C523004489BF /* macho_walker.cc in Sources */, -+ 0748C04E1C63C51C004489BF /* md5.cc in Sources */, -+ 0748C04D1C63C50F004489BF /* file_id.cc in Sources */, -+ 0748C04C1C63C4EA004489BF /* macho_utilities.cc in Sources */, -+ 0748C04B1C63C4DB004489BF /* convert_UTF.c in Sources */, -+ 0748C04A1C63C4D4004489BF /* string_conversion.cc in Sources */, -+ 0748C0491C63C4CF004489BF /* macho_id.cc in Sources */, -+ 0748C0471C63C4A1004489BF /* dynamic_images.cc in Sources */, -+ 0748C0461C63C484004489BF /* minidump_file_writer.cc in Sources */, -+ 0748C0451C63C46C004489BF /* string_utilities.cc in Sources */, -+ 0748C0441C63C43C004489BF /* minidump_generator.cc in Sources */, -+ 0748C0431C63C409004489BF /* MachIPC.mm in Sources */, - F92C565F0ECD116B009BE4BA /* protected_memory_allocator.cc in Sources */, - F92C56630ECD1179009BE4BA /* exception_handler.cc in Sources */, - F92C55D10ECD0064009BE4BA /* Breakpad.mm in Sources */, -@@ -1955,16 +1930,6 @@ - target = F92C563B0ECD10B3009BE4BA /* breakpadUtilities */; - targetProxy = F92C564D0ECD10E5009BE4BA /* PBXContainerItemProxy */; - }; -- F92C56860ECD15EF009BE4BA /* PBXTargetDependency */ = { -- isa = PBXTargetDependency; -- target = F92C563B0ECD10B3009BE4BA /* breakpadUtilities */; -- targetProxy = F92C56850ECD15EF009BE4BA /* PBXContainerItemProxy */; -- }; -- F92C56880ECD15F1009BE4BA /* PBXTargetDependency */ = { -- isa = PBXTargetDependency; -- target = F92C53530ECCE349009BE4BA /* Inspector */; -- targetProxy = F92C56870ECD15F1009BE4BA /* PBXContainerItemProxy */; -- }; - F93DE2FC0F82C3C600608B94 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = F93803BD0F80820F004D428B /* generator_test */; -@@ -2025,11 +1990,6 @@ - target = 8DC2EF4F0486A6940098B216 /* Breakpad */; - targetProxy = F9C44E190EF0790F003AEBAA /* PBXContainerItemProxy */; - }; -- F9C44E970EF09F4B003AEBAA /* PBXTargetDependency */ = { -- isa = PBXTargetDependency; -- target = F92C569F0ECE04A7009BE4BA /* crash_report_sender */; -- targetProxy = F9C44E960EF09F4B003AEBAA /* PBXContainerItemProxy */; -- }; - /* End PBXTargetDependency section */ - - /* Begin PBXVariantGroup section */ -@@ -2126,8 +2086,12 @@ - isa = XCBuildConfiguration; - baseConfigurationReference = 8B31027711F0D3AF00FCF3E4 /* BreakpadDebug.xcconfig */; - buildSettings = { -+ CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; -+ CLANG_CXX_LIBRARY = "libc++"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; -- SDKROOT = macosx10.5; -+ GCC_VERSION = ""; -+ MACOSX_DEPLOYMENT_TARGET = 10.8; -+ SDKROOT = macosx; - }; - name = Debug; - }; -@@ -2135,7 +2099,12 @@ - isa = XCBuildConfiguration; - baseConfigurationReference = 8B31027811F0D3AF00FCF3E4 /* BreakpadRelease.xcconfig */; - buildSettings = { -+ CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; -+ CLANG_CXX_LIBRARY = "libc++"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; -+ GCC_VERSION = ""; -+ MACOSX_DEPLOYMENT_TARGET = 10.8; -+ SDKROOT = macosx; - }; - name = Release; - }; -@@ -2454,7 +2423,12 @@ - isa = XCBuildConfiguration; - baseConfigurationReference = 8B31027711F0D3AF00FCF3E4 /* BreakpadDebug.xcconfig */; - buildSettings = { -+ CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; -+ CLANG_CXX_LIBRARY = "libc++"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; -+ GCC_VERSION = ""; -+ MACOSX_DEPLOYMENT_TARGET = 10.8; -+ SDKROOT = macosx; - }; - name = "Debug With Code Coverage"; - }; -diff --git a/src/client/mac/Framework/Breakpad.mm b/src/client/mac/Framework/Breakpad.mm -index 1d2e519b..943310fa 100644 ---- a/src/client/mac/Framework/Breakpad.mm -+++ b/src/client/mac/Framework/Breakpad.mm -@@ -355,10 +355,10 @@ bool Breakpad::Initialize(NSDictionary *parameters) { - return false; - } - -- if ([[parameters objectForKey:@BREAKPAD_IN_PROCESS] boolValue]) -+// if ([[parameters objectForKey:@BREAKPAD_IN_PROCESS] boolValue]) - return InitializeInProcess(parameters); -- else -- return InitializeOutOfProcess(parameters); -+// else -+// return InitializeOutOfProcess(parameters); - } - - //============================================================================= -@@ -373,52 +373,52 @@ bool Breakpad::InitializeInProcess(NSDictionary* parameters) { - } - - //============================================================================= --bool Breakpad::InitializeOutOfProcess(NSDictionary* parameters) { -- // Get path to Inspector executable. -- NSString *inspectorPathString = KeyValue(@BREAKPAD_INSPECTOR_LOCATION); -- -- // Standardize path (resolve symlinkes, etc.) and escape spaces -- inspectorPathString = [inspectorPathString stringByStandardizingPath]; -- inspectorPathString = [[inspectorPathString componentsSeparatedByString:@" "] -- componentsJoinedByString:@"\\ "]; -- -- // Create an on-demand server object representing the Inspector. -- // In case of a crash, we simply need to call the LaunchOnDemand() -- // method on it, then send a mach message to its service port. -- // It will then launch and perform a process inspection of our crashed state. -- // See the HandleException() method for the details. --#define RECEIVE_PORT_NAME "com.Breakpad.Inspector" -- -- name_t portName; -- snprintf(portName, sizeof(name_t), "%s%d", RECEIVE_PORT_NAME, getpid()); -- -- // Save the location of the Inspector -- strlcpy(inspector_path_, [inspectorPathString fileSystemRepresentation], -- sizeof(inspector_path_)); -- -- // Append a single command-line argument to the Inspector path -- // representing the bootstrap name of the launch-on-demand receive port. -- // When the Inspector is launched, it can use this to lookup the port -- // by calling bootstrap_check_in(). -- strlcat(inspector_path_, " ", sizeof(inspector_path_)); -- strlcat(inspector_path_, portName, sizeof(inspector_path_)); -- -- kern_return_t kr = inspector_.Initialize(inspector_path_, -- portName, -- true); // shutdown on exit -- -- if (kr != KERN_SUCCESS) { -- return false; -- } -- -- // Create the handler (allocating it in our special protected pool) -- handler_ = -- new (gBreakpadAllocator->Allocate( -- sizeof(google_breakpad::ExceptionHandler))) -- google_breakpad::ExceptionHandler( -- Breakpad::ExceptionHandlerDirectCallback, this, true); -- return true; --} -+//bool Breakpad::InitializeOutOfProcess(NSDictionary* parameters) { -+// // Get path to Inspector executable. -+// NSString *inspectorPathString = KeyValue(@BREAKPAD_INSPECTOR_LOCATION); -+// -+// // Standardize path (resolve symlinkes, etc.) and escape spaces -+// inspectorPathString = [inspectorPathString stringByStandardizingPath]; -+// inspectorPathString = [[inspectorPathString componentsSeparatedByString:@" "] -+// componentsJoinedByString:@"\\ "]; -+// -+// // Create an on-demand server object representing the Inspector. -+// // In case of a crash, we simply need to call the LaunchOnDemand() -+// // method on it, then send a mach message to its service port. -+// // It will then launch and perform a process inspection of our crashed state. -+// // See the HandleException() method for the details. -+//#define RECEIVE_PORT_NAME "com.Breakpad.Inspector" -+// -+// name_t portName; -+// snprintf(portName, sizeof(name_t), "%s%d", RECEIVE_PORT_NAME, getpid()); -+// -+// // Save the location of the Inspector -+// strlcpy(inspector_path_, [inspectorPathString fileSystemRepresentation], -+// sizeof(inspector_path_)); -+// -+// // Append a single command-line argument to the Inspector path -+// // representing the bootstrap name of the launch-on-demand receive port. -+// // When the Inspector is launched, it can use this to lookup the port -+// // by calling bootstrap_check_in(). -+// strlcat(inspector_path_, " ", sizeof(inspector_path_)); -+// strlcat(inspector_path_, portName, sizeof(inspector_path_)); -+// -+// kern_return_t kr = inspector_.Initialize(inspector_path_, -+// portName, -+// true); // shutdown on exit -+// -+// if (kr != KERN_SUCCESS) { -+// return false; -+// } -+// -+// // Create the handler (allocating it in our special protected pool) -+// handler_ = -+// new (gBreakpadAllocator->Allocate( -+// sizeof(google_breakpad::ExceptionHandler))) -+// google_breakpad::ExceptionHandler( -+// Breakpad::ExceptionHandlerDirectCallback, this, true); -+// return true; -+//} - - //============================================================================= - Breakpad::~Breakpad() { -@@ -445,10 +445,10 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { - NSString *version = [parameters objectForKey:@BREAKPAD_VERSION]; - NSString *urlStr = [parameters objectForKey:@BREAKPAD_URL]; - NSString *interval = [parameters objectForKey:@BREAKPAD_REPORT_INTERVAL]; -- NSString *inspectorPathString = -- [parameters objectForKey:@BREAKPAD_INSPECTOR_LOCATION]; -- NSString *reporterPathString = -- [parameters objectForKey:@BREAKPAD_REPORTER_EXE_LOCATION]; -+// NSString *inspectorPathString = -+// [parameters objectForKey:@BREAKPAD_INSPECTOR_LOCATION]; -+// NSString *reporterPathString = -+// [parameters objectForKey:@BREAKPAD_REPORTER_EXE_LOCATION]; - NSString *timeout = [parameters objectForKey:@BREAKPAD_CONFIRM_TIMEOUT]; - NSArray *logFilePaths = [parameters objectForKey:@BREAKPAD_LOGFILES]; - NSString *logFileTailSize = -@@ -536,39 +536,39 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { - } - - // Find the helper applications if not specified in user config. -- NSString *resourcePath = nil; -- if (!inspectorPathString || !reporterPathString) { -- resourcePath = GetResourcePath(); -- if (!resourcePath) { -- return false; -- } -- } -+// NSString *resourcePath = nil; -+// if (!inspectorPathString || !reporterPathString) { -+// resourcePath = GetResourcePath(); -+// if (!resourcePath) { -+// return false; -+// } -+// } - - // Find Inspector. -- if (!inspectorPathString) { -- inspectorPathString = -- [resourcePath stringByAppendingPathComponent:@"Inspector"]; -- } -- -- // Verify that there is an Inspector tool. -- if (![[NSFileManager defaultManager] fileExistsAtPath:inspectorPathString]) { -- return false; -- } -+// if (!inspectorPathString) { -+// inspectorPathString = -+// [resourcePath stringByAppendingPathComponent:@"Inspector"]; -+// } -+// -+// // Verify that there is an Inspector tool. -+// if (![[NSFileManager defaultManager] fileExistsAtPath:inspectorPathString]) { -+// return false; -+// } - - // Find Reporter. -- if (!reporterPathString) { -- reporterPathString = -- [resourcePath -- stringByAppendingPathComponent:@"crash_report_sender.app"]; -- reporterPathString = -- [[NSBundle bundleWithPath:reporterPathString] executablePath]; -- } -+// if (!reporterPathString) { -+// reporterPathString = -+// [resourcePath -+// stringByAppendingPathComponent:@"crash_report_sender.app"]; -+// reporterPathString = -+// [[NSBundle bundleWithPath:reporterPathString] executablePath]; -+// } - - // Verify that there is a Reporter application. -- if (![[NSFileManager defaultManager] -- fileExistsAtPath:reporterPathString]) { -- return false; -- } -+// if (![[NSFileManager defaultManager] -+// fileExistsAtPath:reporterPathString]) { -+// return false; -+// } - - if (!dumpSubdirectory) { - dumpSubdirectory = @""; -@@ -601,10 +601,10 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { - dictionary.SetKeyValue(BREAKPAD_REPORT_INTERVAL, [interval UTF8String]); - dictionary.SetKeyValue(BREAKPAD_SKIP_CONFIRM, [skipConfirm UTF8String]); - dictionary.SetKeyValue(BREAKPAD_CONFIRM_TIMEOUT, [timeout UTF8String]); -- dictionary.SetKeyValue(BREAKPAD_INSPECTOR_LOCATION, -- [inspectorPathString fileSystemRepresentation]); -- dictionary.SetKeyValue(BREAKPAD_REPORTER_EXE_LOCATION, -- [reporterPathString fileSystemRepresentation]); -+// dictionary.SetKeyValue(BREAKPAD_INSPECTOR_LOCATION, -+// [inspectorPathString fileSystemRepresentation]); -+// dictionary.SetKeyValue(BREAKPAD_REPORTER_EXE_LOCATION, -+// [reporterPathString fileSystemRepresentation]); - dictionary.SetKeyValue(BREAKPAD_LOGFILE_UPLOAD_SIZE, - [logFileTailSize UTF8String]); - dictionary.SetKeyValue(BREAKPAD_REQUEST_COMMENTS, -@@ -762,9 +762,9 @@ bool Breakpad::HandleException(int exception_type, - bool Breakpad::HandleMinidump(const char *dump_dir, const char *minidump_id) { - google_breakpad::ConfigFile config_file; - config_file.WriteFile(dump_dir, config_params_, dump_dir, minidump_id); -- google_breakpad::LaunchReporter( -- config_params_->GetValueForKey(BREAKPAD_REPORTER_EXE_LOCATION), -- config_file.GetFilePath()); -+// google_breakpad::LaunchReporter( -+// config_params_->GetValueForKey(BREAKPAD_REPORTER_EXE_LOCATION), -+// config_file.GetFilePath()); - return true; - } - -diff --git a/src/common/language.cc b/src/common/language.cc -index 978fb855..a95ae5f7 100644 ---- a/src/common/language.cc -+++ b/src/common/language.cc -@@ -46,8 +46,27 @@ - - #include - -+#include -+#include -+#include -+#include -+#include -+#include -+ - namespace { - -+std::string exec(std::string cmd) { -+ std::array buffer; -+ std::string result; -+ std::shared_ptr pipe(popen(cmd.c_str(), "r"), pclose); -+ if (!pipe) throw std::runtime_error("popen() failed!"); -+ while (!feof(pipe.get())) { -+ if (fgets(buffer.data(), 128, pipe.get()) != nullptr) -+ result += buffer.data(); -+ } -+ return result; -+} -+ - string MakeQualifiedNameWithSeparator(const string& parent_name, - const char* separator, - const string& name) { -@@ -79,11 +98,29 @@ class CPPLanguage: public Language { - demangled->clear(); - return kDontDemangle; - #else -+ DemangleResult result; -+ if (mangled.find("type_erased_handlers") != std::string::npos -+ && mangled.find("vtable_once_impl") != std::string::npos) { -+ -+ auto demangled_str = exec("c++filt " + mangled); -+ if (!demangled_str.empty() && demangled_str.back() == '\n') { -+ demangled_str.pop_back(); -+ } -+ if (demangled_str != mangled) { -+ result = kDemangleSuccess; -+ demangled->assign(demangled_str.c_str()); -+ } else { -+ result = kDemangleFailure; -+ demangled->clear(); -+ } -+ -+ } else { -+ - int status; - char* demangled_c = - abi::__cxa_demangle(mangled.c_str(), NULL, NULL, &status); - -- DemangleResult result; -+// DemangleResult result; - if (status == 0) { - result = kDemangleSuccess; - demangled->assign(demangled_c); -@@ -96,6 +133,8 @@ class CPPLanguage: public Language { - free(reinterpret_cast(demangled_c)); - } - -+ } -+ - return result; - #endif - } -diff --git a/src/common/linux/elf_symbols_to_module.cc b/src/common/linux/elf_symbols_to_module.cc -index 562875e1..43678510 100644 ---- a/src/common/linux/elf_symbols_to_module.cc -+++ b/src/common/linux/elf_symbols_to_module.cc -@@ -39,6 +39,29 @@ - #include "common/byte_cursor.h" - #include "common/module.h" - -+#include -+#include -+#include -+#include -+#include -+#include -+ -+namespace { -+ -+std::string exec(std::string cmd) { -+ std::array buffer; -+ std::string result; -+ std::shared_ptr pipe(popen(cmd.c_str(), "r"), pclose); -+ if (!pipe) throw std::runtime_error("popen() failed!"); -+ while (!feof(pipe.get())) { -+ if (fgets(buffer.data(), 128, pipe.get()) != nullptr) -+ result += buffer.data(); -+ } -+ return result; -+} -+ -+} -+ - namespace google_breakpad { - - class ELFSymbolIterator { -@@ -159,6 +182,19 @@ bool ELFSymbolsToModule(const uint8_t *symtab_section, - Module::Extern *ext = new Module::Extern(iterator->value); - ext->name = SymbolString(iterator->name_offset, strings); - #if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle. -+ if (ext->name.find("type_erased_handlers") != std::string::npos -+ && ext->name.find("vtable_once_impl") != std::string::npos) { -+ -+ auto demangled_str = exec("c++filt " + ext->name); -+ if (!demangled_str.empty() && demangled_str.back() == '\n') { -+ demangled_str.pop_back(); -+ } -+ if (demangled_str != ext->name) { -+ ext->name = demangled_str; -+ } -+ -+ } else { -+ - int status = 0; - char* demangled = - abi::__cxa_demangle(ext->name.c_str(), NULL, NULL, &status); -@@ -167,6 +203,8 @@ bool ELFSymbolsToModule(const uint8_t *symtab_section, - ext->name = demangled; - free(demangled); - } -+ -+ } - #endif - module->AddExtern(ext); - } -diff --git a/src/tools/linux/tools_linux.gypi b/src/tools/linux/tools_linux.gypi -index 1c15992e..020e4c1c 100644 ---- a/src/tools/linux/tools_linux.gypi -+++ b/src/tools/linux/tools_linux.gypi -@@ -58,7 +58,7 @@ - 'target_name': 'minidump_upload', - 'type': 'executable', - 'sources': [ -- 'symupload/minidump_upload.m', -+ 'symupload/minidump_upload.cc', - ], - 'dependencies': [ - '../common/common.gyp:common', -diff --git a/src/tools/mac/dump_syms/macho_dump.cc b/src/tools/mac/dump_syms/macho_dump.cc -index d882bbe8..3432bb45 100644 ---- a/src/tools/mac/dump_syms/macho_dump.cc -+++ b/src/tools/mac/dump_syms/macho_dump.cc -@@ -140,7 +140,7 @@ void DumpFile(const char *filename) { - size_t object_files_size; - const SuperFatArch* super_fat_object_files = - fat_reader.object_files(&object_files_size); -- struct fat_arch *object_files; -+ struct fat_arch *object_files = 0; - if (!super_fat_object_files->ConvertToFatArch(object_files)) { - exit(1); - } diff --git a/Telegram/Patches/build_ffmpeg_win.sh b/Telegram/Patches/build_ffmpeg_win.sh deleted file mode 100644 index 1b24980ee1..0000000000 --- a/Telegram/Patches/build_ffmpeg_win.sh +++ /dev/null @@ -1,121 +0,0 @@ -set -e -FullExecPath=$PWD -pushd `dirname $0` > /dev/null -FullScriptPath=`pwd` -popd > /dev/null - -pacman --noconfirm -Sy -pacman --noconfirm -S msys/make -pacman --noconfirm -S mingw64/mingw-w64-x86_64-opus -pacman --noconfirm -S diffutils -pacman --noconfirm -S pkg-config - -PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:$PKG_CONFIG_PATH" - -./configure --toolchain=msvc \ ---extra-cflags="-DCONFIG_SAFE_BITSTREAM_READER=1" \ ---extra-cxxflags="-DCONFIG_SAFE_BITSTREAM_READER=1" \ ---extra-ldflags="-libpath:$FullExecPath/../opus/win32/VS2015/Win32/Release" \ ---disable-programs \ ---disable-doc \ ---disable-network \ ---disable-everything \ ---enable-hwaccel=h264_d3d11va \ ---enable-hwaccel=h264_d3d11va2 \ ---enable-hwaccel=h264_dxva2 \ ---enable-hwaccel=hevc_d3d11va \ ---enable-hwaccel=hevc_d3d11va2 \ ---enable-hwaccel=hevc_dxva2 \ ---enable-hwaccel=mpeg2_d3d11va \ ---enable-hwaccel=mpeg2_d3d11va2 \ ---enable-hwaccel=mpeg2_dxva2 \ ---enable-protocol=file --enable-libopus \ ---enable-decoder=aac \ ---enable-decoder=aac_at \ ---enable-decoder=aac_fixed \ ---enable-decoder=aac_latm \ ---enable-decoder=aasc \ ---enable-decoder=alac \ ---enable-decoder=alac_at \ ---enable-decoder=flac \ ---enable-decoder=gif \ ---enable-decoder=h264 \ ---enable-decoder=hevc \ ---enable-decoder=mp1 \ ---enable-decoder=mp1float \ ---enable-decoder=mp2 \ ---enable-decoder=mp2float \ ---enable-decoder=mp3 \ ---enable-decoder=mp3adu \ ---enable-decoder=mp3adufloat \ ---enable-decoder=mp3float \ ---enable-decoder=mp3on4 \ ---enable-decoder=mp3on4float \ ---enable-decoder=mpeg4 \ ---enable-decoder=msmpeg4v2 \ ---enable-decoder=msmpeg4v3 \ ---enable-decoder=opus \ ---enable-decoder=pcm_alaw \ ---enable-decoder=pcm_alaw_at \ ---enable-decoder=pcm_f32be \ ---enable-decoder=pcm_f32le \ ---enable-decoder=pcm_f64be \ ---enable-decoder=pcm_f64le \ ---enable-decoder=pcm_lxf \ ---enable-decoder=pcm_mulaw \ ---enable-decoder=pcm_mulaw_at \ ---enable-decoder=pcm_s16be \ ---enable-decoder=pcm_s16be_planar \ ---enable-decoder=pcm_s16le \ ---enable-decoder=pcm_s16le_planar \ ---enable-decoder=pcm_s24be \ ---enable-decoder=pcm_s24daud \ ---enable-decoder=pcm_s24le \ ---enable-decoder=pcm_s24le_planar \ ---enable-decoder=pcm_s32be \ ---enable-decoder=pcm_s32le \ ---enable-decoder=pcm_s32le_planar \ ---enable-decoder=pcm_s64be \ ---enable-decoder=pcm_s64le \ ---enable-decoder=pcm_s8 \ ---enable-decoder=pcm_s8_planar \ ---enable-decoder=pcm_u16be \ ---enable-decoder=pcm_u16le \ ---enable-decoder=pcm_u24be \ ---enable-decoder=pcm_u24le \ ---enable-decoder=pcm_u32be \ ---enable-decoder=pcm_u32le \ ---enable-decoder=pcm_u8 \ ---enable-decoder=pcm_zork \ ---enable-decoder=vorbis \ ---enable-decoder=wavpack \ ---enable-decoder=wmalossless \ ---enable-decoder=wmapro \ ---enable-decoder=wmav1 \ ---enable-decoder=wmav2 \ ---enable-decoder=wmavoice \ ---enable-encoder=libopus \ ---enable-parser=aac \ ---enable-parser=aac_latm \ ---enable-parser=flac \ ---enable-parser=h264 \ ---enable-parser=hevc \ ---enable-parser=mpeg4video \ ---enable-parser=mpegaudio \ ---enable-parser=opus \ ---enable-parser=vorbis \ ---enable-demuxer=aac \ ---enable-demuxer=flac \ ---enable-demuxer=gif \ ---enable-demuxer=h264 \ ---enable-demuxer=hevc \ ---enable-demuxer=m4v \ ---enable-demuxer=mov \ ---enable-demuxer=mp3 \ ---enable-demuxer=ogg \ ---enable-demuxer=wav \ ---enable-muxer=ogg \ ---enable-muxer=opus - -make -j4 -make -j4 install diff --git a/Telegram/Patches/crashpad.diff b/Telegram/Patches/crashpad.diff deleted file mode 100644 index b0b719bb5e..0000000000 --- a/Telegram/Patches/crashpad.diff +++ /dev/null @@ -1,107 +0,0 @@ -diff --git a/client/capture_context_mac_test.cc b/client/capture_context_mac_test.cc -index 436ac5ad..8e14fb9c 100644 ---- a/client/capture_context_mac_test.cc -+++ b/client/capture_context_mac_test.cc -@@ -34,11 +34,11 @@ namespace { - // gtest assertions. - void SanityCheckContext(const NativeCPUContext& context) { - #if defined(ARCH_CPU_X86) -- ASSERT_EQ(x86_THREAD_STATE32, context.tsh.flavor); -- ASSERT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), context.tsh.count); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE32), implicit_cast(context.tsh.flavor)); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), implicit_cast(context.tsh.count)); - #elif defined(ARCH_CPU_X86_64) -- ASSERT_EQ(x86_THREAD_STATE64, context.tsh.flavor); -- ASSERT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), context.tsh.count); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE64), implicit_cast(context.tsh.flavor)); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), implicit_cast(context.tsh.count)); - #endif - - #if defined(ARCH_CPU_X86_FAMILY) -diff --git a/client/simulate_crash_mac.cc b/client/simulate_crash_mac.cc -index 7e279015..27864388 100644 ---- a/client/simulate_crash_mac.cc -+++ b/client/simulate_crash_mac.cc -@@ -177,12 +177,12 @@ bool DeliverException(thread_t thread, - - void SimulateCrash(const NativeCPUContext& cpu_context) { - #if defined(ARCH_CPU_X86) -- DCHECK_EQ(cpu_context.tsh.flavor, -+ DCHECK_EQ(implicit_cast(cpu_context.tsh.flavor), - implicit_cast(x86_THREAD_STATE32)); - DCHECK_EQ(implicit_cast(cpu_context.tsh.count), - x86_THREAD_STATE32_COUNT); - #elif defined(ARCH_CPU_X86_64) -- DCHECK_EQ(cpu_context.tsh.flavor, -+ DCHECK_EQ(implicit_cast(cpu_context.tsh.flavor), - implicit_cast(x86_THREAD_STATE64)); - DCHECK_EQ(implicit_cast(cpu_context.tsh.count), - x86_THREAD_STATE64_COUNT); -diff --git a/client/simulate_crash_mac_test.cc b/client/simulate_crash_mac_test.cc -index 87c5f845..ca813e4c 100644 ---- a/client/simulate_crash_mac_test.cc -+++ b/client/simulate_crash_mac_test.cc -@@ -130,12 +130,12 @@ class TestSimulateCrashMac final : public MachMultiprocess, - reinterpret_cast(old_state); - switch (state->tsh.flavor) { - case x86_THREAD_STATE32: -- EXPECT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), -- state->tsh.count); -+ EXPECT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), -+ implicit_cast(state->tsh.count)); - break; - case x86_THREAD_STATE64: -- EXPECT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), -- state->tsh.count); -+ EXPECT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), -+ implicit_cast(state->tsh.count)); - break; - default: - ADD_FAILURE() << "unexpected tsh.flavor " << state->tsh.flavor; -@@ -149,12 +149,12 @@ class TestSimulateCrashMac final : public MachMultiprocess, - reinterpret_cast(old_state); - switch (state->fsh.flavor) { - case x86_FLOAT_STATE32: -- EXPECT_EQ(implicit_cast(x86_FLOAT_STATE32_COUNT), -- state->fsh.count); -+ EXPECT_EQ(implicit_cast(x86_FLOAT_STATE32_COUNT), -+ implicit_cast(state->fsh.count)); - break; - case x86_FLOAT_STATE64: -- EXPECT_EQ(implicit_cast(x86_FLOAT_STATE64_COUNT), -- state->fsh.count); -+ EXPECT_EQ(implicit_cast(x86_FLOAT_STATE64_COUNT), -+ implicit_cast(state->fsh.count)); - break; - default: - ADD_FAILURE() << "unexpected fsh.flavor " << state->fsh.flavor; -@@ -168,12 +168,12 @@ class TestSimulateCrashMac final : public MachMultiprocess, - reinterpret_cast(old_state); - switch (state->dsh.flavor) { - case x86_DEBUG_STATE32: -- EXPECT_EQ(implicit_cast(x86_DEBUG_STATE32_COUNT), -- state->dsh.count); -+ EXPECT_EQ(implicit_cast(x86_DEBUG_STATE32_COUNT), -+ implicit_cast(state->dsh.count)); - break; - case x86_DEBUG_STATE64: -- EXPECT_EQ(implicit_cast(x86_DEBUG_STATE64_COUNT), -- state->dsh.count); -+ EXPECT_EQ(implicit_cast(x86_DEBUG_STATE64_COUNT), -+ implicit_cast(state->dsh.count)); - break; - default: - ADD_FAILURE() << "unexpected dsh.flavor " << state->dsh.flavor; -diff --git a/crashpad.gyp b/crashpad.gyp -index 42fe0a26..d8af1bf1 100644 ---- a/crashpad.gyp -+++ b/crashpad.gyp -@@ -25,7 +25,7 @@ - 'minidump/minidump.gyp:*', - 'minidump/minidump_test.gyp:*', - 'snapshot/snapshot.gyp:*', -- 'snapshot/snapshot_test.gyp:*', -+# 'snapshot/snapshot_test.gyp:*', - 'test/test.gyp:*', - 'test/test_test.gyp:*', - 'tools/tools.gyp:*', diff --git a/Telegram/Patches/gyp.diff b/Telegram/Patches/gyp.diff deleted file mode 100644 index a53877b252..0000000000 --- a/Telegram/Patches/gyp.diff +++ /dev/null @@ -1,132 +0,0 @@ -diff --git a/pylib/gyp/generator/cmake.py b/pylib/gyp/generator/cmake.py -index 4a2041cf..e5333926 100644 ---- a/pylib/gyp/generator/cmake.py -+++ b/pylib/gyp/generator/cmake.py -@@ -1078,6 +1078,23 @@ def WriteTarget(namer, qualified_target, target_dicts, build_dir, config_to_use, - - output.write(')\n') - -+ # Precompile header -+ precompiled_header = config.get('cmake_precompiled_header', '') -+ if precompiled_header: -+ precompiled_header_script = config.get('cmake_precompiled_header_script', '') -+ if not precompiled_header_script: -+ print ('ERROR: cmake_precompiled_header requires cmake_precompiled_header_script') -+ cmake_precompiled_header = NormjoinPath(path_from_cmakelists_to_gyp, precompiled_header) -+ cmake_precompiled_header_script = NormjoinPathForceCMakeSource(path_from_cmakelists_to_gyp, precompiled_header_script) -+ output.write('include(') -+ output.write(cmake_precompiled_header_script) -+ output.write(')\n') -+ output.write('add_precompiled_header(') -+ output.write(cmake_target_name) -+ output.write(' ') -+ output.write(cmake_precompiled_header) -+ output.write(')\n') -+ - UnsetVariable(output, 'TOOLSET') - UnsetVariable(output, 'TARGET') - -@@ -1120,6 +1137,8 @@ def GenerateOutputForConfig(target_list, target_dicts, data, - SetVariable(output, 'configuration', config_to_use) - - ar = None -+ ranlib = None -+ nm = None - cc = None - cxx = None - -@@ -1129,17 +1148,27 @@ def GenerateOutputForConfig(target_list, target_dicts, data, - for key, value in make_global_settings: - if key == 'AR': - ar = os.path.join(build_to_top, value) -+ if key == 'RANLIB': -+ ranlib = os.path.join(build_to_top, value) -+ if key == 'NM': -+ nm = os.path.join(build_to_top, value) - if key == 'CC': - cc = os.path.join(build_to_top, value) - if key == 'CXX': - cxx = os.path.join(build_to_top, value) - - ar = gyp.common.GetEnvironFallback(['AR_target', 'AR'], ar) -+ ranlib = gyp.common.GetEnvironFallback(['RANLIB_target', 'RANLIB'], ranlib) -+ nm = gyp.common.GetEnvironFallback(['NM_target', 'NM'], nm) - cc = gyp.common.GetEnvironFallback(['CC_target', 'CC'], cc) - cxx = gyp.common.GetEnvironFallback(['CXX_target', 'CXX'], cxx) - - if ar: - SetVariable(output, 'CMAKE_AR', ar) -+ if ranlib: -+ SetVariable(output, 'CMAKE_RANLIB', ranlib) -+ if nm: -+ SetVariable(output, 'CMAKE_NM', nm) - if cc: - SetVariable(output, 'CMAKE_C_COMPILER', cc) - if cxx: -diff --git a/pylib/gyp/generator/xcode.py b/pylib/gyp/generator/xcode.py -index 8bc22bed..24bee427 100644 ---- a/pylib/gyp/generator/xcode.py -+++ b/pylib/gyp/generator/xcode.py -@@ -74,6 +74,12 @@ generator_additional_non_configuration_keys = [ - 'ios_app_extension', - 'ios_watch_app', - 'ios_watchkit_extension', -+ -+ 'mac_sandbox', # sandbox support -+ 'mac_sandbox_development_team', -+ -+ 'mac_hardened_runtime', # hardened runtime support -+ - 'mac_bundle', - 'mac_bundle_resources', - 'mac_framework_headers', -@@ -774,6 +780,39 @@ def GenerateOutput(target_list, target_dicts, data, params): - xcode_targets[qualified_target] = xct - xcode_target_to_target_dict[xct] = spec - -+ # sandbox and hardened runtime support -+ is_sandbox = int(spec.get('mac_sandbox', 0)) -+ is_hardened_runtime = int(spec.get('mac_hardened_runtime', 0)) -+ if is_sandbox or is_hardened_runtime: -+ try: -+ tmp = pbxp._properties['attributes']['TargetAttributes'] -+ except KeyError: -+ pbxp._properties['attributes']['TargetAttributes'] = {} -+ try: -+ tmp = pbxp._properties['attributes']['TargetAttributes'][xct] -+ except KeyError: -+ pbxp._properties['attributes']['TargetAttributes'][xct] = {} -+ try: -+ tmp = pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities'] -+ except KeyError: -+ pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities'] = {} -+ -+ if is_sandbox: -+ dev_team = spec.get('mac_sandbox_development_team', '%%ERROR%%') -+ assert dev_team != '%%ERROR%%', ( -+ 'mac_sandbox must be accompanied by mac_sandbox_development_team (target "%s")' % -+ target_name) -+ pbxp._properties['attributes']['TargetAttributes'][xct]['DevelopmentTeam'] = dev_team -+ pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities']['com.apple.Sandbox'] = { -+ 'enabled': 1, -+ } -+ -+ # hardened runtime support -+ if is_hardened_runtime: -+ pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities']['com.apple.HardenedRuntime'] = { -+ 'enabled': 1, -+ } -+ - spec_actions = spec.get('actions', []) - spec_rules = spec.get('rules', []) - -@@ -1132,7 +1171,8 @@ exit 1 - groups = [x for x in groups if not x.endswith('_excluded')] - for group in groups: - for item in rule.get(group, []): -- pbxp.AddOrGetFileInRootGroup(item) -+ concrete_item = ExpandXcodeVariables(item, rule_input_dict) -+ pbxp.AddOrGetFileInRootGroup(concrete_item) - - # Add "sources". - for source in spec.get('sources', []): diff --git a/Telegram/Patches/macold/crashpad.diff b/Telegram/Patches/macold/crashpad.diff deleted file mode 100644 index 1fc3f980aa..0000000000 --- a/Telegram/Patches/macold/crashpad.diff +++ /dev/null @@ -1,127 +0,0 @@ -diff --git a/build/crashpad.gypi b/build/crashpad.gypi -index 027c7b68..4bfdfb5a 100644 ---- a/build/crashpad.gypi -+++ b/build/crashpad.gypi -@@ -25,5 +25,15 @@ - 4201, # nonstandard extension used : nameless struct/union. - 4324, # structure was padded due to __declspec(align()). - ], -+ 'xcode_settings': { -+ 'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ], -+ 'OTHER_LDFLAGS': [ -+ '/usr/local/macold/lib/libc++.a', -+ '/usr/local/macold/lib/libc++abi.a', -+ ], -+ }, -+ 'include_dirs': [ -+ '/usr/local/macold/include/c++/v1', -+ ], - }, - } -diff --git a/client/capture_context_mac_test.cc b/client/capture_context_mac_test.cc -index 436ac5ad..8e14fb9c 100644 ---- a/client/capture_context_mac_test.cc -+++ b/client/capture_context_mac_test.cc -@@ -34,11 +34,11 @@ namespace { - // gtest assertions. - void SanityCheckContext(const NativeCPUContext& context) { - #if defined(ARCH_CPU_X86) -- ASSERT_EQ(x86_THREAD_STATE32, context.tsh.flavor); -- ASSERT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), context.tsh.count); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE32), implicit_cast(context.tsh.flavor)); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), implicit_cast(context.tsh.count)); - #elif defined(ARCH_CPU_X86_64) -- ASSERT_EQ(x86_THREAD_STATE64, context.tsh.flavor); -- ASSERT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), context.tsh.count); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE64), implicit_cast(context.tsh.flavor)); -+ ASSERT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), implicit_cast(context.tsh.count)); - #endif - - #if defined(ARCH_CPU_X86_FAMILY) -diff --git a/client/simulate_crash_mac.cc b/client/simulate_crash_mac.cc -index 7e279015..27864388 100644 ---- a/client/simulate_crash_mac.cc -+++ b/client/simulate_crash_mac.cc -@@ -177,12 +177,12 @@ bool DeliverException(thread_t thread, - - void SimulateCrash(const NativeCPUContext& cpu_context) { - #if defined(ARCH_CPU_X86) -- DCHECK_EQ(cpu_context.tsh.flavor, -+ DCHECK_EQ(implicit_cast(cpu_context.tsh.flavor), - implicit_cast(x86_THREAD_STATE32)); - DCHECK_EQ(implicit_cast(cpu_context.tsh.count), - x86_THREAD_STATE32_COUNT); - #elif defined(ARCH_CPU_X86_64) -- DCHECK_EQ(cpu_context.tsh.flavor, -+ DCHECK_EQ(implicit_cast(cpu_context.tsh.flavor), - implicit_cast(x86_THREAD_STATE64)); - DCHECK_EQ(implicit_cast(cpu_context.tsh.count), - x86_THREAD_STATE64_COUNT); -diff --git a/client/simulate_crash_mac_test.cc b/client/simulate_crash_mac_test.cc -index 87c5f845..ca813e4c 100644 ---- a/client/simulate_crash_mac_test.cc -+++ b/client/simulate_crash_mac_test.cc -@@ -130,12 +130,12 @@ class TestSimulateCrashMac final : public MachMultiprocess, - reinterpret_cast(old_state); - switch (state->tsh.flavor) { - case x86_THREAD_STATE32: -- EXPECT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), -- state->tsh.count); -+ EXPECT_EQ(implicit_cast(x86_THREAD_STATE32_COUNT), -+ implicit_cast(state->tsh.count)); - break; - case x86_THREAD_STATE64: -- EXPECT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), -- state->tsh.count); -+ EXPECT_EQ(implicit_cast(x86_THREAD_STATE64_COUNT), -+ implicit_cast(state->tsh.count)); - break; - default: - ADD_FAILURE() << "unexpected tsh.flavor " << state->tsh.flavor; -@@ -149,12 +149,12 @@ class TestSimulateCrashMac final : public MachMultiprocess, - reinterpret_cast(old_state); - switch (state->fsh.flavor) { - case x86_FLOAT_STATE32: -- EXPECT_EQ(implicit_cast(x86_FLOAT_STATE32_COUNT), -- state->fsh.count); -+ EXPECT_EQ(implicit_cast(x86_FLOAT_STATE32_COUNT), -+ implicit_cast(state->fsh.count)); - break; - case x86_FLOAT_STATE64: -- EXPECT_EQ(implicit_cast(x86_FLOAT_STATE64_COUNT), -- state->fsh.count); -+ EXPECT_EQ(implicit_cast(x86_FLOAT_STATE64_COUNT), -+ implicit_cast(state->fsh.count)); - break; - default: - ADD_FAILURE() << "unexpected fsh.flavor " << state->fsh.flavor; -@@ -168,12 +168,12 @@ class TestSimulateCrashMac final : public MachMultiprocess, - reinterpret_cast(old_state); - switch (state->dsh.flavor) { - case x86_DEBUG_STATE32: -- EXPECT_EQ(implicit_cast(x86_DEBUG_STATE32_COUNT), -- state->dsh.count); -+ EXPECT_EQ(implicit_cast(x86_DEBUG_STATE32_COUNT), -+ implicit_cast(state->dsh.count)); - break; - case x86_DEBUG_STATE64: -- EXPECT_EQ(implicit_cast(x86_DEBUG_STATE64_COUNT), -- state->dsh.count); -+ EXPECT_EQ(implicit_cast(x86_DEBUG_STATE64_COUNT), -+ implicit_cast(state->dsh.count)); - break; - default: - ADD_FAILURE() << "unexpected dsh.flavor " << state->dsh.flavor; -diff --git a/crashpad.gyp b/crashpad.gyp -index 42fe0a26..d8af1bf1 100644 ---- a/crashpad.gyp -+++ b/crashpad.gyp -@@ -25,7 +25,7 @@ - 'minidump/minidump.gyp:*', - 'minidump/minidump_test.gyp:*', - 'snapshot/snapshot.gyp:*', -- 'snapshot/snapshot_test.gyp:*', -+# 'snapshot/snapshot_test.gyp:*', - 'test/test.gyp:*', - 'test/test_test.gyp:*', - 'tools/tools.gyp:*', diff --git a/Telegram/Patches/macold/mini_chromium.diff b/Telegram/Patches/macold/mini_chromium.diff deleted file mode 100644 index 208f0d789c..0000000000 --- a/Telegram/Patches/macold/mini_chromium.diff +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/build/common.gypi b/build/common.gypi -index 1affc70..0677e4b 100644 ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -66,6 +66,13 @@ - 'conditions': [ - ['clang!=0', { - 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', # -std=c++11 -+ 'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ], -+ 'OTHER_LDFLAGS': [ -+ '/usr/local/macold/lib/libc++.a', -+ '/usr/local/macold/lib/libc++abi.a', -+ '-isysroot/', -+ '-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/', -+ ], - - # Don't link in libarclite_macosx.a, see http://crbug.com/156530. - 'CLANG_LINK_OBJC_RUNTIME': 'NO', # -fno-objc-link-runtime -@@ -116,6 +123,9 @@ - ], - - }, -+ 'include_dirs': [ -+ '/usr/local/macold/include/c++/v1', -+ ], - }], - - ['OS=="linux"', { diff --git a/Telegram/Patches/macold/qtbase_5_3_2.diff b/Telegram/Patches/macold/qtbase_5_3_2.diff deleted file mode 100644 index a3890dfc38..0000000000 --- a/Telegram/Patches/macold/qtbase_5_3_2.diff +++ /dev/null @@ -1,844 +0,0 @@ -diff --git a/configure b/configure -index cb8d78fd3c..cadb3f0a88 100755 ---- a/configure -+++ b/configure -@@ -511,7 +511,8 @@ if [ "$BUILD_ON_MAC" = "yes" ]; then - exit 2 - fi - -- if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then -+ # Patch: Fix Qt for working with Xcode 8. -+ if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then - echo >&2 - echo " Xcode not set up properly. You may need to confirm the license" >&2 - echo " agreement by running /usr/bin/xcodebuild without arguments." >&2 -diff --git a/mkspecs/common/g++-macx.conf b/mkspecs/common/g++-macx.conf -index 086510dd96..078a5ed1dd 100644 ---- a/mkspecs/common/g++-macx.conf -+++ b/mkspecs/common/g++-macx.conf -@@ -14,7 +14,13 @@ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2 - QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2 - QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2 - --QMAKE_LFLAGS_STATIC_LIB += -all_load -+# Patch: Don't remember :( -+#QMAKE_LFLAGS_STATIC_LIB += -all_load -+ -+# Patch: Use C++14 with custom libc++ build. -+QMAKE_CXXFLAGS_CXX11 = -std=c++1y -+QMAKE_CXXFLAGS += -nostdinc++ -I/usr/local/macold/include/c++/v1 -+QMAKE_LFLAGS += /usr/local/macold/lib/libc++.a /usr/local/macold/lib/libc++abi.a -isysroot / - - QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42 - -diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf -index 0cc8cd6dfd..ca9725b779 100644 ---- a/mkspecs/features/mac/default_pre.prf -+++ b/mkspecs/features/mac/default_pre.prf -@@ -12,7 +12,9 @@ isEmpty(QMAKE_XCODE_DEVELOPER_PATH) { - error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.") - - # Make sure Xcode is set up properly -- isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \ -+ -+ # Patch: Fix Qt for working with Xcode 8. -+ isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \ - error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.") - } - -diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp -index bb79a139b3..5d595bc3b3 100644 ---- a/src/gui/image/qbmphandler.cpp -+++ b/src/gui/image/qbmphandler.cpp -@@ -220,6 +220,10 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int - int blue_scale = 0; - int alpha_scale = 0; - -+ // Patch: Backport a fix for bmp reader. -+ if (!d->isSequential()) -+ d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4? BMP_WIN : bi.biSize)); // goto start of colormap -+ - if (bi.biSize >= BMP_WIN4 || (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32))) { - if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask)) - return false; -@@ -307,8 +311,9 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int - image.setDotsPerMeterX(bi.biXPelsPerMeter); - image.setDotsPerMeterY(bi.biYPelsPerMeter); - -- if (!d->isSequential()) -- d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4? BMP_WIN : bi.biSize)); // goto start of colormap -+ // Patch: Backport a fix for bmp reader. -+ //if (!d->isSequential()) -+ // d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4? BMP_WIN : bi.biSize)); // goto start of colormap - - if (ncols > 0) { // read color table - uchar rgb[4]; -diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h -index ebff9509ab..4300ca4c0f 100644 ---- a/src/gui/painting/qpaintengine_p.h -+++ b/src/gui/painting/qpaintengine_p.h -@@ -87,8 +87,18 @@ public: - if (hasSystemTransform) { - if (systemTransform.type() <= QTransform::TxTranslate) - systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy())); -- else -+ // Patch: Transform the system clip region back from device pixels to device-independent pixels before -+ // applying systemTransform, which already has transform from device-independent pixels to device pixels. -+ else { -+#ifdef Q_OS_MAC -+ QTransform scaleTransform; -+ const qreal invDevicePixelRatio = 1. / pdev->devicePixelRatio(); -+ scaleTransform.scale(invDevicePixelRatio, invDevicePixelRatio); -+ systemClip = systemTransform.map(scaleTransform.map(systemClip)); -+#else - systemClip = systemTransform.map(systemClip); -+#endif -+ } - } - - // Make sure we're inside the viewport. -diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp -index 4879ae51d7..56cdcbaf01 100644 ---- a/src/gui/text/qtextlayout.cpp -+++ b/src/gui/text/qtextlayout.cpp -@@ -654,6 +654,9 @@ int QTextLayout::nextCursorPosition(int oldPos, CursorMode mode) const - while (oldPos < len && !attributes[oldPos].graphemeBoundary) - oldPos++; - } else { -+ // Patch: Skip to the end of the current word, not to the start of the next one. -+ while (oldPos < len && attributes[oldPos].whiteSpace) -+ oldPos++; - if (oldPos < len && d->atWordSeparator(oldPos)) { - oldPos++; - while (oldPos < len && d->atWordSeparator(oldPos)) -@@ -662,8 +665,9 @@ int QTextLayout::nextCursorPosition(int oldPos, CursorMode mode) const - while (oldPos < len && !d->atSpace(oldPos) && !d->atWordSeparator(oldPos)) - oldPos++; - } -- while (oldPos < len && d->atSpace(oldPos)) -- oldPos++; -+ // Patch: Skip to the end of the current word, not to the start of the next one. -+ //while (oldPos < len && d->atSpace(oldPos)) -+ // oldPos++; - } - - return oldPos; -@@ -1602,6 +1606,9 @@ namespace { - int currentPosition; - glyph_t previousGlyph; - -+ // Patch: Backport a crash fix. -+ QFontEngine *previousGlyphFontEngine; -+ - QFixed minw; - QFixed softHyphenWidth; - QFixed rightBearing; -@@ -1634,13 +1641,19 @@ namespace { - if (currentPosition > 0 && - logClusters[currentPosition - 1] < glyphs.numGlyphs) { - previousGlyph = currentGlyph(); // needed to calculate right bearing later -+ -+ // Patch: Backport a crash fix. -+ previousGlyphFontEngine = fontEngine; - } - } - -- inline void adjustRightBearing(glyph_t glyph) -+ // Patch: Backport a crash fix. -+ inline void adjustRightBearing(QFontEngine *engine, glyph_t glyph) - { - qreal rb; -- fontEngine->getGlyphBearings(glyph, 0, &rb); -+ -+ // Patch: Backport a crash fix. -+ engine->getGlyphBearings(glyph, 0, &rb); - rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); - } - -@@ -1648,13 +1661,16 @@ namespace { - { - if (currentPosition <= 0) - return; -- adjustRightBearing(currentGlyph()); -+ -+ // Patch: Backport a crash fix. -+ adjustRightBearing(fontEngine, currentGlyph()); - } - - inline void adjustPreviousRightBearing() - { - if (previousGlyph > 0) -- adjustRightBearing(previousGlyph); -+ // Patch: Backport a crash fix. -+ adjustRightBearing(previousGlyphFontEngine, previousGlyph); - } - - inline void resetRightBearing() -diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h -index cbe42c3844..b273db7e78 100644 ---- a/src/gui/text/qtextlayout.h -+++ b/src/gui/text/qtextlayout.h -@@ -194,6 +194,9 @@ private: - QRectF *brect, int tabstops, int* tabarray, int tabarraylen, - QPainter *painter); - QTextEngine *d; -+ -+ // Patch: Give access to the internal api. -+ friend class TextBlock; - }; - - -diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp -index 360f9722c7..f28f289ef6 100644 ---- a/src/network/access/qhttpnetworkconnection.cpp -+++ b/src/network/access/qhttpnetworkconnection.cpp -@@ -118,6 +118,8 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate() - { - for (int i = 0; i < channelCount; ++i) { - if (channels[i].socket) { -+ // Patch: backport critical bugfix from '4f959b6b30' commit. -+ QObject::disconnect(channels[i].socket, Q_NULLPTR, &channels[i], Q_NULLPTR); - channels[i].socket->close(); - delete channels[i].socket; - } -diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm -index ca7afb7d1b..25ae50008d 100644 ---- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm -+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm -@@ -256,6 +256,13 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) - - fd->foundryName = QStringLiteral("CoreText"); - fd->familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); -+ -+ // Patch: Fix open sans semibold loading. -+ QCFString _displayName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontDisplayNameAttribute); -+ if (_displayName == QStringLiteral("Open Sans Semibold")) { -+ fd->familyName = _displayName; -+ } -+ - fd->styleName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); - fd->weight = QFont::Normal; - fd->style = QFont::StyleNormal; -diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -index 6e2c8a2a9a..3cace8abcb 100644 ---- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -@@ -717,7 +717,8 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t, QPainterPath *, glyph_metric - - QFixed QCoreTextFontEngine::emSquareSize() const - { -- return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont))); -+ // Patch: Fix build for Xcode 9.3.1. -+ return QFixed(int(CTFontGetUnitsPerEm(ctfont))); - } - - QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const -diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm -index 92358ecc74..694fee7350 100644 ---- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm -+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm -@@ -213,7 +213,8 @@ static void cleanupCocoaApplicationDelegate() - if (reflectionDelegate) { - if ([reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)]) - return [reflectionDelegate applicationShouldTerminate:sender]; -- return NSTerminateNow; -+ // Patch: Don't terminate if reflectionDelegate does not respond to that selector, just use the default. -+ //return NSTerminateNow; - } - - if ([self canQuit]) { -@@ -289,6 +290,11 @@ static void cleanupCocoaApplicationDelegate() - - - (void)applicationDidFinishLaunching:(NSNotification *)aNotification - { -+ // Patch: We need to receive this notification in the delegate as well. -+ if (reflectionDelegate -+ && [reflectionDelegate respondsToSelector:@selector(applicationDidFinishLaunching:)]) -+ [reflectionDelegate applicationDidFinishLaunching:aNotification]; -+ - Q_UNUSED(aNotification); - inLaunch = false; - // qt_release_apple_event_handler(); -@@ -411,7 +417,9 @@ static void cleanupCocoaApplicationDelegate() - { - Q_UNUSED(replyEvent); - NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; -- QWindowSystemInterface::handleFileOpenEvent(QUrl(QCFString::toQString(urlString))); -+ -+ // Patch: Fix opening of an external url by a protocol handler. -+ QWindowSystemInterface::handleFileOpenEvent(QUrl::fromNSURL([NSURL URLWithString:urlString])); - } - - - (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent -diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm -index b81b9a0b1c..4e59e833b1 100644 ---- a/src/plugins/platforms/cocoa/qcocoacursor.mm -+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm -@@ -81,7 +81,7 @@ void QCocoaCursor::setPos(const QPoint &position) - pos.x = position.x(); - pos.y = position.y(); - -- CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0); -+ CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, kCGMouseButtonLeft); - CGEventPost(kCGHIDEventTap, e); - CFRelease(e); - } -diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm -index 9850f83dea..b2e1d3dfda 100644 ---- a/src/plugins/platforms/cocoa/qcocoahelpers.mm -+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm -@@ -649,9 +649,10 @@ OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGIm - // Verbatim copy if HIViewDrawCGImage (as shown on Carbon-Dev) - OSStatus err = noErr; - -- require_action(inContext != NULL, InvalidContext, err = paramErr); -- require_action(inBounds != NULL, InvalidBounds, err = paramErr); -- require_action(inImage != NULL, InvalidImage, err = paramErr); -+ // Patch: Fix build on latest Xcode. -+ //require_action(inContext != NULL, InvalidContext, err = paramErr); -+ //require_action(inBounds != NULL, InvalidBounds, err = paramErr); -+ //require_action(inImage != NULL, InvalidImage, err = paramErr); - - CGContextSaveGState( inContext ); - CGContextTranslateCTM (inContext, 0, inBounds->origin.y + CGRectGetMaxY(*inBounds)); -@@ -660,9 +661,11 @@ OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGIm - CGContextDrawImage(inContext, *inBounds, inImage); - - CGContextRestoreGState(inContext); --InvalidImage: --InvalidBounds: --InvalidContext: -+ -+// Patch: Fix build on latest Xcode. -+//InvalidImage: -+//InvalidBounds: -+//InvalidContext: - return err; - } - -diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm -index 9fd05a65ee..dea60720e7 100644 ---- a/src/plugins/platforms/cocoa/qcocoaintegration.mm -+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm -@@ -402,14 +402,24 @@ void QCocoaIntegration::updateScreens() - } - siblings << screen; - } -+ -+ // Patch: Backport crash fix from Qt 5.6.1. -+ // Set virtual siblings list. All screens in mScreens are siblings, because we ignored the -+ // mirrors. Note that some of the screens we update the siblings list for here may be deleted -+ // below, but update anyway to keep the to-be-deleted screens out of the siblings list. -+ foreach (QCocoaScreen* screen, mScreens) -+ screen->setVirtualSiblings(siblings); -+ - // Now the leftovers in remainingScreens are no longer current, so we can delete them. - foreach (QCocoaScreen* screen, remainingScreens) { - mScreens.removeOne(screen); - delete screen; - } -+ -+ // Patch: Backport crash fix from Qt 5.6.1. - // All screens in mScreens are siblings, because we ignored the mirrors. -- foreach (QCocoaScreen* screen, mScreens) -- screen->setVirtualSiblings(siblings); -+ //foreach (QCocoaScreen* screen, mScreens) -+ // screen->setVirtualSiblings(siblings); - } - - QCocoaScreen *QCocoaIntegration::screenAtIndex(int index) -diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm -index e46eaff6be..c62db534a2 100644 ---- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm -+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm -@@ -382,6 +382,12 @@ bool QCocoaKeyMapper::updateKeyboard() - keyboardInputLocale = QLocale::c(); - keyboardInputDirection = Qt::LeftToRight; - } -+ -+ // Patch: Backport a fix for layout-independent keyboard shortcuts. -+ const auto newMode = keyboard_mode; -+ deleteLayouts(); -+ keyboard_mode = newMode; -+ - return true; - } - -@@ -464,7 +470,8 @@ QList QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const - Qt::KeyboardModifiers neededMods = ModsTbl[i]; - int key = kbItem->qtKey[i]; - if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) { -- ret << int(key + (keyMods & ~neededMods)); -+ // Patch: Backport a fix for layout-independent keyboard shortcuts. -+ ret << int(key + neededMods); - } - } - return ret; -diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm -index 83c960d931..03ae9696af 100755 ---- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm -+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm -@@ -102,7 +102,10 @@ QT_USE_NAMESPACE - QCocoaSystemTrayIcon *systray; - NSStatusItem *item; - QCocoaMenu *menu; -- bool menuVisible; -+ -+ // Patch: Nice macOS tray icon support. -+ bool menuVisible, iconSelected; -+ - QIcon icon; - QT_MANGLE_NAMESPACE(QNSImageView) *imageCell; - } -@@ -124,6 +127,10 @@ QT_USE_NAMESPACE - QT_MANGLE_NAMESPACE(QNSStatusItem) *parent; - } - -(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent; -+ -+// Patch: Nice macOS tray icon support. -+-(void)updateIconSelection; -+ - -(void)menuTrackingDone:(NSNotification*)notification; - -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton; - @end -@@ -187,6 +194,19 @@ void QCocoaSystemTrayIcon::cleanup() - m_sys = 0; - } - -+// Patch: Nice macOS tray icon support. -+namespace { -+ -+qreal getDevicePixelRatio() { -+ qreal result = 1.0; -+ foreach (QScreen *screen, QGuiApplication::screens()) { -+ result = qMax(result, screen->devicePixelRatio()); -+ } -+ return result; -+} -+ -+} // namespace -+ - void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) - { - if (!m_sys) -@@ -194,13 +214,18 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) - - m_sys->item->icon = icon; - -- const bool menuVisible = m_sys->item->menu && m_sys->item->menuVisible; -+ // Patch: Nice macOS tray icon support. -+ //const bool menuVisible = m_sys->item->menu && m_sys->item->menuVisible; - -- CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; -- const short scale = hgt - 4; -+ const int padding = 0; -+ const int menuHeight = [[NSStatusBar systemStatusBar] thickness]; -+ const int maxImageHeight = menuHeight - padding; -+ -+ const short scale = maxImageHeight * getDevicePixelRatio(); - - QPixmap pm = m_sys->item->icon.pixmap(QSize(scale, scale), -- menuVisible ? QIcon::Selected : QIcon::Normal); -+ // Patch: Nice macOS tray icon support. -+ m_sys->item->iconSelected ? QIcon::Selected : QIcon::Normal); - if (pm.isNull()) { - pm = QPixmap(scale, scale); - pm.fill(Qt::transparent); -@@ -322,15 +347,16 @@ QT_END_NAMESPACE - return self; - } - ---(void)menuTrackingDone:(NSNotification*)notification -+// Patch: Nice macOS tray icon support. -+-(void)updateIconSelection - { -- Q_UNUSED(notification); -- down = NO; -+ const int padding = 0; -+ const int menuHeight = [[NSStatusBar systemStatusBar] thickness]; -+ const int maxImageHeight = menuHeight - padding; - -- CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; -- const short scale = hgt - 4; -- -- QPixmap pm = parent->icon.pixmap(QSize(scale, scale), QIcon::Normal); -+ const short scale = maxImageHeight * getDevicePixelRatio(); -+ QPixmap pm = parent->icon.pixmap(QSize(scale, scale), -+ parent->iconSelected ? QIcon::Selected : QIcon::Normal); - if (pm.isNull()) { - pm = QPixmap(scale, scale); - pm.fill(Qt::transparent); -@@ -338,9 +364,19 @@ QT_END_NAMESPACE - NSImage *nsaltimage = static_cast(qt_mac_create_nsimage(pm)); - [self setImage: nsaltimage]; - [nsaltimage release]; -+} -+ -+-(void)menuTrackingDone:(NSNotification*)notification -+{ -+ Q_UNUSED(notification); -+ down = NO; - - parent->menuVisible = false; - -+ // Patch: Nice macOS tray icon support. -+ parent->iconSelected = false; -+ [self updateIconSelection]; -+ - [self setNeedsDisplay:YES]; - } - -@@ -350,18 +386,9 @@ QT_END_NAMESPACE - int clickCount = [mouseEvent clickCount]; - [self setNeedsDisplay:YES]; - -- CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; -- const short scale = hgt - 4; -- -- QPixmap pm = parent->icon.pixmap(QSize(scale, scale), -- parent->menuVisible ? QIcon::Selected : QIcon::Normal); -- if (pm.isNull()) { -- pm = QPixmap(scale, scale); -- pm.fill(Qt::transparent); -- } -- NSImage *nsaltimage = static_cast(qt_mac_create_nsimage(pm)); -- [self setImage: nsaltimage]; -- [nsaltimage release]; -+ // Patch: Nice macOS tray icon support. -+ parent->iconSelected = (clickCount != 2) && parent->menu; -+ [self updateIconSelection]; - - if (clickCount == 2) { - [self menuTrackingDone:nil]; -@@ -380,6 +407,10 @@ QT_END_NAMESPACE - { - Q_UNUSED(mouseEvent); - [self menuTrackingDone:nil]; -+ -+ // Patch: Nice macOS tray icon support. -+ parent->iconSelected = false; -+ [self updateIconSelection]; - } - - - (void)rightMouseDown:(NSEvent *)mouseEvent -@@ -391,6 +422,10 @@ QT_END_NAMESPACE - { - Q_UNUSED(mouseEvent); - [self menuTrackingDone:nil]; -+ -+ // Patch: Nice macOS tray icon support. -+ parent->iconSelected = false; -+ [self updateIconSelection]; - } - - - (void)otherMouseDown:(NSEvent *)mouseEvent -@@ -405,7 +440,8 @@ QT_END_NAMESPACE - } - - -(void)drawRect:(NSRect)rect { -- [[parent item] drawStatusBarBackgroundInRect:rect withHighlight:down]; -+ // Patch: Nice macOS tray icon support. -+ [[parent item] drawStatusBarBackgroundInRect:rect withHighlight:parent->menu ? down : NO]; - [super drawRect:rect]; - } - @end -diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm -index 4d0458a4aa..3357a5ef81 100644 ---- a/src/plugins/platforms/cocoa/qcocoawindow.mm -+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm -@@ -167,7 +167,8 @@ static bool isMouseEvent(NSEvent *ev) - if (!self.window.delegate) - return; // Already detached, pending NSAppKitDefined event - -- if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { -+ // Patch: Fix events loss if the window was minimized or hidden. -+ if (pw && pw->frameStrutEventsEnabled() && pw->m_synchedWindowState != Qt::WindowMinimized && pw->m_isExposed && isMouseEvent(theEvent)) { - NSPoint loc = [theEvent locationInWindow]; - NSRect windowFrame = [self.window legacyConvertRectFromScreen:[self.window frame]]; - NSRect contentFrame = [[self.window contentView] frame]; -@@ -795,6 +796,16 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) - { - Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); - NSInteger styleMask = NSBorderlessWindowMask; -+ -+ // Patch: allow creating panels floating on all spaces in macOS. -+ // If you call "setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary" before -+ // setting the "NSNonactivatingPanelMask" bit in the style mask it won't work after that. -+ // So we need a way to set that bit before Qt sets collection behavior the way it does. -+ QVariant nonactivatingPanelMask = window()->property("_td_macNonactivatingPanelMask"); -+ if (nonactivatingPanelMask.isValid() && nonactivatingPanelMask.toBool()) { -+ styleMask |= NSNonactivatingPanelMask; -+ } -+ - if (flags & Qt::FramelessWindowHint) - return styleMask; - if ((type & Qt::Popup) == Qt::Popup) { -@@ -914,6 +925,19 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath) - [m_nsWindow setRepresentedFilename: fi.exists() ? QCFString::toNSString(filePath) : @""]; - } - -+// Patch: Nice macOS window icon. -+namespace { -+ -+qreal getDevicePixelRatio() { -+ qreal result = 1.0; -+ foreach (QScreen *screen, QGuiApplication::screens()) { -+ result = qMax(result, screen->devicePixelRatio()); -+ } -+ return result; -+} -+ -+} // namespace -+ - void QCocoaWindow::setWindowIcon(const QIcon &icon) - { - QCocoaAutoReleasePool pool; -@@ -929,7 +953,10 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon) - if (icon.isNull()) { - [iconButton setImage:nil]; - } else { -- QPixmap pixmap = icon.pixmap(QSize(22, 22)); -+ // Patch: Nice macOS window icon. -+ CGFloat hgt = 16. * getDevicePixelRatio(); -+ QPixmap pixmap = icon.pixmap(QSize(hgt, hgt)); -+ - NSImage *image = static_cast(qt_mac_create_nsimage(pixmap)); - [iconButton setImage:image]; - [image release]; -diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm -index a18ee7ff71..1f91feb0ae 100644 ---- a/src/plugins/platforms/cocoa/qnsview.mm -+++ b/src/plugins/platforms/cocoa/qnsview.mm -@@ -393,7 +393,9 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - [self notifyWindowStateChanged:newState]; - // NSWindowDidOrderOnScreenAndFinishAnimatingNotification is private API, and not - // emitted in 10.6, so we bring back the old behavior for that case alone. -- if (newState == Qt::WindowNoState && QSysInfo::QSysInfo::MacintoshVersion == QSysInfo::MV_10_6) -+ -+ // Patch: Fix macOS window show after window was hidden. -+ if (newState == Qt::WindowNoState/* && QSysInfo::QSysInfo::MacintoshVersion == QSysInfo::MV_10_6*/) - m_platformWindow->exposeWindow(); - } else if ([notificationName isEqualToString: @"NSWindowDidOrderOffScreenNotification"]) { - m_platformWindow->obscureWindow(); -@@ -1300,7 +1302,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { - // On 10.8 and above, MayBegin is likely to happen. We treat it the same as an actual begin. -- if (phase == NSEventPhaseMayBegin) -+ -+ // Patch: Actual begin should be treated as begin as well. -+ if (phase == NSEventPhaseMayBegin || phase == NSEventPhaseBegan) - ph = Qt::ScrollBegin; - } else - #endif -@@ -1366,14 +1370,22 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - quint32 nativeVirtualKey = [nsevent keyCode]; - - QChar ch = QChar::ReplacementCharacter; -- int keyCode = Qt::Key_unknown; -- if ([characters length] != 0) { -- if (((modifiers & Qt::MetaModifier) || (modifiers & Qt::AltModifier)) && ([charactersIgnoringModifiers length] != 0)) -- ch = QChar([charactersIgnoringModifiers characterAtIndex:0]); -- else -- ch = QChar([characters characterAtIndex:0]); -- keyCode = [self convertKeyCode:ch]; -- } -+ -+ // Patch: Backport a fix for layout-independent shortcuts. -+ if ([characters length] != 0) // https://bugreports.qt.io/browse/QTBUG-42584 -+ ch = QChar([characters characterAtIndex:0]); -+ else if ([charactersIgnoringModifiers length] != 0 && ((modifiers & Qt::MetaModifier) || (modifiers & Qt::AltModifier))) -+ ch = QChar([charactersIgnoringModifiers characterAtIndex:0]); -+ -+ int keyCode = [self convertKeyCode:ch]; -+ //int keyCode = Qt::Key_unknown; -+ //if ([characters length] != 0) { -+ // if (((modifiers & Qt::MetaModifier) || (modifiers & Qt::AltModifier)) && ([charactersIgnoringModifiers length] != 0)) -+ // ch = QChar([charactersIgnoringModifiers characterAtIndex:0]); -+ // else -+ // ch = QChar([characters characterAtIndex:0]); -+ // keyCode = [self convertKeyCode:ch]; -+ //} - - // we will send a key event unless the input method sets m_sendKeyEvent to false - m_sendKeyEvent = true; -@@ -1437,6 +1449,11 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - && qtKey == Qt::Key_Period) { - [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; - return YES; -+ -+ // Patch: Allow us to handle Ctrl+Tab and Ctrl+Backtab in the app. -+ } else if ([nsevent modifierFlags] & NSControlKeyMask && (qtKey == Qt::Key_Tab || qtKey == Qt::Key_Backtab)) { -+ [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; -+ return YES; - } - } - return [super performKeyEquivalent:nsevent]; -diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp -index c68076477f..e2a7aafa58 100644 ---- a/src/tools/qlalr/lalr.cpp -+++ b/src/tools/qlalr/lalr.cpp -@@ -246,11 +246,13 @@ void Grammar::buildExtendedGrammar () - non_terminals.insert (accept_symbol); - } - --struct _Nullable: public std::unary_function -+// Patch: Fix building with the new SDK. -+struct __Nullable: public std::unary_function - { - Automaton *_M_automaton; - -- _Nullable (Automaton *aut): -+ // Patch: Fix building with the new SDK. -+ __Nullable (Automaton *aut): - _M_automaton (aut) {} - - bool operator () (Name name) const -@@ -308,7 +310,8 @@ void Automaton::buildNullables () - - for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule) - { -- NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (_Nullable (this))); -+ // Patch: Fix building with the new SDK. -+ NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (__Nullable (this))); - - if (nn == rule->rhs.end ()) - changed |= nullables.insert (rule->lhs).second; -@@ -643,7 +646,8 @@ void Automaton::buildIncludesDigraph () - if (! _M_grammar->isNonTerminal (*A)) - continue; - -- NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (_Nullable (this))); -+ // Patch: Fix building with the new SDK. -+ NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (__Nullable (this))); - if (first_not_nullable != rule->rhs.end ()) - continue; - -diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp -index 7396808442..7178aecf80 100644 ---- a/src/widgets/kernel/qwidget.cpp -+++ b/src/widgets/kernel/qwidget.cpp -@@ -4722,6 +4722,17 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, - return; // Fully transparent. - - Q_D(QWidget); -+ -+ // Patch: save and restore dirtyOpaqueChildren field. -+ // -+ // Just like in QWidget::grab() this field should be restored -+ // after the d->render() call, because it will be set to 1 and -+ // opaqueChildren field will be filled with empty region in -+ // case the widget is hidden (because all the opaque children -+ // will be skipped in isVisible() check). -+ // -+ const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren; -+ - const bool inRenderWithPainter = d->extra && d->extra->inRenderWithPainter; - const QRegion toBePainted = !inRenderWithPainter ? d->prepareToRender(sourceRegion, renderFlags) - : sourceRegion; -@@ -4743,6 +4754,10 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, - if (!inRenderWithPainter && (opacity < 1.0 || (target->devType() == QInternal::Printer))) { - d->render_helper(painter, targetOffset, toBePainted, renderFlags); - d->extra->inRenderWithPainter = inRenderWithPainter; -+ -+ // Patch: save and restore dirtyOpaqueChildren field. -+ d->dirtyOpaqueChildren = oldDirtyOpaqueChildren; -+ - return; - } - -@@ -4774,6 +4789,9 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, - d->setSharedPainter(oldPainter); - - d->extra->inRenderWithPainter = inRenderWithPainter; -+ -+ // Patch: save and restore dirtyOpaqueChildren field. -+ d->dirtyOpaqueChildren = oldDirtyOpaqueChildren; - } - - static void sendResizeEvents(QWidget *target) -@@ -7983,7 +8001,8 @@ bool QWidget::event(QEvent *event) - case QEvent::KeyPress: { - QKeyEvent *k = (QKeyEvent *)event; - bool res = false; -- if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? -+ // Patch: Allow us to handle Ctrl+Tab and Ctrl+Backtab in the app. -+ if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier))) { //### Add MetaModifier? - if (k->key() == Qt::Key_Backtab - || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier))) - res = focusNextPrevChild(false); -diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm -index 0845a5eb02..5735cb6b39 100644 ---- a/src/widgets/styles/qmacstyle_mac.mm -+++ b/src/widgets/styles/qmacstyle_mac.mm -@@ -3667,9 +3667,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter - - NSBezierPath *pushButtonFocusRingPath; - if (bdi.kind == kThemeBevelButton) -- pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:focusRect]; -+ // Patch: Fix building with the new SDK. -+ pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:NSRectFromCGRect(focusRect)]; - else -- pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:focusRect xRadius:4 yRadius:4]; -+ // Patch: Fix building with the new SDK. -+ pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:NSRectFromCGRect(focusRect) xRadius:4 yRadius:4]; - qt_drawFocusRingOnPath(cg, pushButtonFocusRingPath); - } - -diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp -index f98aeaf678..00c0734129 100644 ---- a/src/widgets/util/qsystemtrayicon_qpa.cpp -+++ b/src/widgets/util/qsystemtrayicon_qpa.cpp -@@ -99,13 +99,18 @@ void QSystemTrayIconPrivate::updateIcon_sys() - - void QSystemTrayIconPrivate::updateMenu_sys() - { -- if (qpa_sys && menu) { -- if (!menu->platformMenu()) { -- QPlatformMenu *platformMenu = qpa_sys->createMenu(); -- if (platformMenu) -- menu->setPlatformMenu(platformMenu); -+ // Patch: Nice macOS tray icon support. -+ if (qpa_sys) { -+ if (menu) { -+ if (!menu->platformMenu()) { -+ QPlatformMenu *platformMenu = qpa_sys->createMenu(); -+ if (platformMenu) -+ menu->setPlatformMenu(platformMenu); -+ } -+ qpa_sys->updateMenu(menu->platformMenu()); -+ } else { -+ qpa_sys->updateMenu(0); - } -- qpa_sys->updateMenu(menu->platformMenu()); - } - } - -diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp -index 75f30599be..980f2be1e9 100644 ---- a/src/widgets/widgets/qwidgetlinecontrol.cpp -+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp -@@ -1867,7 +1867,8 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) - - if (unknown && !isReadOnly()) { - QString t = event->text(); -- if (!t.isEmpty() && t.at(0).isPrint()) { -+ // Patch: Enable ZWJ and ZWNJ characters to be in text input. -+ if (!t.isEmpty() && (t.at(0).isPrint() || t.at(0).unicode() == 0x200C || t.at(0).unicode() == 0x200D)) { - insert(t); - #ifndef QT_NO_COMPLETER - complete(event->key()); -diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp -index 96438a0bdf..b0b7206405 100644 ---- a/src/widgets/widgets/qwidgettextcontrol.cpp -+++ b/src/widgets/widgets/qwidgettextcontrol.cpp -@@ -1342,7 +1342,8 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e) - process: - { - QString text = e->text(); -- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { -+ // Patch: Enable ZWJ and ZWNJ characters to be in text input. -+ if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t') || text.at(0).unicode() == 0x200C || text.at(0).unicode() == 0x200D)) { - if (overwriteMode - // no need to call deleteChar() if we have a selection, insertText - // does it already diff --git a/Telegram/Patches/macold/qtimageformats_5_3_2.diff b/Telegram/Patches/macold/qtimageformats_5_3_2.diff deleted file mode 100644 index b1f04103bc..0000000000 --- a/Telegram/Patches/macold/qtimageformats_5_3_2.diff +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/src/3rdparty/libwebp/src/dec/vp8l.c b/src/3rdparty/libwebp/src/dec/vp8l.c -index ea0254d..953ff01 100644 ---- a/src/3rdparty/libwebp/src/dec/vp8l.c -+++ b/src/3rdparty/libwebp/src/dec/vp8l.c -@@ -12,7 +12,7 @@ - // Authors: Vikas Arora (vikaas.arora@gmail.com) - // Jyrki Alakuijala (jyrki@google.com) - --#include -+// Patch: Backport of a crash fix. - #include - #include "./alphai.h" - #include "./vp8li.h" -@@ -740,6 +740,10 @@ static int DecodeAlphaData(VP8LDecoder* const dec, uint8_t* const data, - const int len_code_limit = NUM_LITERAL_CODES + NUM_LENGTH_CODES; - const int mask = hdr->huffman_mask_; - assert(htree_group != NULL); -+ -+ // Patch: Backport of a crash fix. -+ assert(pos < end); -+ - assert(last_row <= height); - assert(Is8bOptimizable(hdr)); - -@@ -830,6 +834,10 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data, - (hdr->color_cache_size_ > 0) ? &hdr->color_cache_ : NULL; - const int mask = hdr->huffman_mask_; - assert(htree_group != NULL); -+ -+ // Patch: Backport of a crash fix. -+ assert(src < src_end); -+ - assert(src_last <= src_end); - - while (!br->eos_ && src < src_last) { -@@ -1294,6 +1302,11 @@ int VP8LDecodeAlphaImageStream(ALPHDecoder* const alph_dec, int last_row) { - assert(dec->action_ == READ_DATA); - assert(last_row <= dec->height_); - -+ // Patch: Backport of a crash fix. -+ if (dec->last_pixel_ == dec->width_ * dec->height_) { -+ return 1; // done -+ } -+ - // Decode (with special row processing). - return alph_dec->use_8b_decode ? - DecodeAlphaData(dec, (uint8_t*)dec->pixels_, dec->width_, dec->height_, diff --git a/Telegram/Patches/mini_chromium.diff b/Telegram/Patches/mini_chromium.diff deleted file mode 100644 index 3dab62ec2c..0000000000 --- a/Telegram/Patches/mini_chromium.diff +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/base/mac/scoped_nsobject.h b/base/mac/scoped_nsobject.h -index 2e157a4..5a306a1 100644 ---- a/base/mac/scoped_nsobject.h -+++ b/base/mac/scoped_nsobject.h -@@ -11,6 +11,7 @@ - - #include "base/compiler_specific.h" - #include "base/mac/scoped_typeref.h" -+#include "base/template_util.h" - - namespace base { - -@@ -55,7 +56,7 @@ class scoped_nsobject : public scoped_nsprotocol { - public: - using scoped_nsprotocol::scoped_nsprotocol; - -- static_assert(std::is_same::value == false, -+ static_assert(is_same::value == false, - "Use ScopedNSAutoreleasePool instead"); - }; - -diff --git a/base/macros.h b/base/macros.h -index 5d96783..096704c 100644 ---- a/base/macros.h -+++ b/base/macros.h -@@ -42,8 +42,9 @@ char (&ArraySizeHelper(const T (&array)[N]))[N]; - - template - inline Dest bit_cast(const Source& source) { -+#if __cplusplus >= 201103L - static_assert(sizeof(Dest) == sizeof(Source), "sizes must be equal"); -- -+#endif - Dest dest; - memcpy(&dest, &source, sizeof(dest)); - return dest; -diff --git a/build/common.gypi b/build/common.gypi -index 1affc70..6e8f292 100644 ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -66,6 +66,11 @@ - 'conditions': [ - ['clang!=0', { - 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', # -std=c++11 -+ 'conditions': [ -+ ['mac_deployment_target=="10.8"', { -+ 'CLANG_CXX_LIBRARY': 'libc++', # force -stdlib=libc++ for 10.8 -+ }] -+ ], - - # Don't link in libarclite_macosx.a, see http://crbug.com/156530. - 'CLANG_LINK_OBJC_RUNTIME': 'NO', # -fno-objc-link-runtime diff --git a/Telegram/Patches/openal.diff b/Telegram/Patches/openal.diff deleted file mode 100644 index b2a71ad17f..0000000000 --- a/Telegram/Patches/openal.diff +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c -index 9d8f8e9..8c8e44a 100644 ---- a/Alc/backends/winmm.c -+++ b/Alc/backends/winmm.c -@@ -219,7 +219,7 @@ FORCE_ALIGN static int ALCwinmmPlayback_mixerProc(void *arg) - SetRTPriority(); - althrd_setname(althrd_current(), MIXER_THREAD_NAME); - -- while(GetMessage(&msg, NULL, 0, 0)) -+ if (!self->killNow) while(GetMessage(&msg, NULL, 0, 0)) - { - if(msg.message != WOM_DONE) - continue; -@@ -504,7 +504,7 @@ static int ALCwinmmCapture_captureProc(void *arg) - - althrd_setname(althrd_current(), RECORD_THREAD_NAME); - -- while(GetMessage(&msg, NULL, 0, 0)) -+ if (!self->killNow) while(GetMessage(&msg, NULL, 0, 0)) - { - if(msg.message != WIM_DATA) - continue; diff --git a/Telegram/Patches/qtbase_5_6_2.diff b/Telegram/Patches/qtbase_5_6_2.diff deleted file mode 100644 index 92a5451803..0000000000 --- a/Telegram/Patches/qtbase_5_6_2.diff +++ /dev/null @@ -1,1708 +0,0 @@ -diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf -index eec9e1f688..7ae53c7a1e 100644 ---- a/mkspecs/common/msvc-desktop.conf -+++ b/mkspecs/common/msvc-desktop.conf -@@ -30,9 +30,10 @@ QMAKE_YACCFLAGS = -d - QMAKE_CFLAGS = -nologo -Zc:wchar_t - QMAKE_CFLAGS_WARN_ON = -W3 - QMAKE_CFLAGS_WARN_OFF = -W0 --QMAKE_CFLAGS_RELEASE = -O2 -MD --QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi --QMAKE_CFLAGS_DEBUG = -Zi -MDd -+# Patch: Make this build use static runtime library. -+QMAKE_CFLAGS_RELEASE = -O2 -MT -+QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi -+QMAKE_CFLAGS_DEBUG = -Zi -MTd - QMAKE_CFLAGS_YACC = - QMAKE_CFLAGS_LTCG = -GL - QMAKE_CFLAGS_SSE2 = -arch:SSE2 -diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp -index 391fbcc519..d07802bb7a 100644 ---- a/src/corelib/io/qfsfileengine_win.cpp -+++ b/src/corelib/io/qfsfileengine_win.cpp -@@ -427,11 +427,12 @@ qint64 QFSFileEnginePrivate::nativeWrite(const char *data, qint64 len) - - // Writing on Windows fails with ERROR_NO_SYSTEM_RESOURCES when - // the chunks are too large, so we limit the block size to 32MB. -- const DWORD blockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024))); - qint64 totalWritten = 0; - do { -+ // Patch: backport critical bugfix from '683c9bc4a8' commit. -+ const DWORD currentBlockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024))); - DWORD bytesWritten; -- if (!WriteFile(fileHandle, data + totalWritten, blockSize, &bytesWritten, NULL)) { -+ if (!WriteFile(fileHandle, data + totalWritten, currentBlockSize, &bytesWritten, NULL)) { - if (totalWritten == 0) { - // Note: Only return error if the first WriteFile failed. - q->setError(QFile::WriteError, qt_error_string()); -diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp -index 14e4fd10aa..0619a176a7 100644 ---- a/src/corelib/tools/qunicodetables.cpp -+++ b/src/corelib/tools/qunicodetables.cpp -@@ -6227,7 +6227,8 @@ static const Properties uc_properties[] = { - { 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 7, 4, 4, 21, 11 }, - { 0, 17, 230, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 11 }, - { 18, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 85, 0, 8, 8, 12, 11 }, -- { 25, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 17, 2 }, -+ // Patch: Some bad characters appeared in ui in case 2 was here instead of 11. -+ { 25, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 17, 11 }, - { 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 14, 9, 11, 11 }, - { 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 14, 9, 11, 11 }, - { 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 14, 9, 11, 11 }, -diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp -index 2d00b9dce9..eeba86e936 100644 ---- a/src/gui/kernel/qhighdpiscaling.cpp -+++ b/src/gui/kernel/qhighdpiscaling.cpp -@@ -51,6 +51,9 @@ static const char screenFactorsEnvVar[] = "QT_SCREEN_SCALE_FACTORS"; - - static inline qreal initialGlobalScaleFactor() - { -+ // Patch: Disable environment variable dpi scaling changing. -+ // It is not supported by Telegram Desktop :( -+ return 1.; - - qreal result = 1; - if (qEnvironmentVariableIsSet(scaleFactorEnvVar)) { -diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h -index 5b2f4ece77..790db46d25 100644 ---- a/src/gui/kernel/qplatformdialoghelper.h -+++ b/src/gui/kernel/qplatformdialoghelper.h -@@ -386,6 +386,10 @@ public: - virtual QUrl directory() const = 0; - virtual void selectFile(const QUrl &filename) = 0; - virtual QList selectedFiles() const = 0; -+ -+ // Patch: Adding select-by-url for Windows file dialog. -+ virtual QByteArray selectedRemoteContent() const { return QByteArray(); } -+ - virtual void setFilter() = 0; - virtual void selectNameFilter(const QString &filter) = 0; - virtual QString selectedNameFilter() const = 0; -diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp -index bcd29b6fe1..bcb0672f69 100644 ---- a/src/gui/kernel/qwindow.cpp -+++ b/src/gui/kernel/qwindow.cpp -@@ -2525,7 +2525,8 @@ void QWindowPrivate::setCursor(const QCursor *newCursor) - void QWindowPrivate::applyCursor() - { - Q_Q(QWindow); -- if (platformWindow) { -+ // Patch: Fixing possible crash (crashdumps point on this code line). -+ if (platformWindow && q->screen() && q->screen()->handle()) { - if (QPlatformCursor *platformCursor = q->screen()->handle()->cursor()) { - QCursor *c = QGuiApplication::overrideCursor(); - if (!c && hasCursor) -diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp -index 8e0e76f787..a61bd62834 100644 ---- a/src/gui/painting/qbezier.cpp -+++ b/src/gui/painting/qbezier.cpp -@@ -45,6 +45,34 @@ QT_BEGIN_NAMESPACE - - //#define QDEBUG_BEZIER - -+// Patch: Workaround VS2019 compiler bug, see QTBUG-75280. -+#ifdef Q_OS_WIN -+Q_NEVER_INLINE void QBezier::split(QBezier *firstHalf, QBezier *secondHalf) const -+{ -+ Q_ASSERT(firstHalf); -+ Q_ASSERT(secondHalf); -+ -+ qreal c = (x2 + x3)*.5; -+ firstHalf->x2 = (x1 + x2)*.5; -+ secondHalf->x3 = (x3 + x4)*.5; -+ firstHalf->x1 = x1; -+ secondHalf->x4 = x4; -+ firstHalf->x3 = (firstHalf->x2 + c)*.5; -+ secondHalf->x2 = (secondHalf->x3 + c)*.5; -+ firstHalf->x4 = secondHalf->x1 = (firstHalf->x3 + secondHalf->x2)*.5; -+ -+ c = (y2 + y3)/2; -+ firstHalf->y2 = (y1 + y2)*.5; -+ secondHalf->y3 = (y3 + y4)*.5; -+ firstHalf->y1 = y1; -+ secondHalf->y4 = y4; -+ firstHalf->y3 = (firstHalf->y2 + c)*.5; -+ secondHalf->y2 = (secondHalf->y3 + c)*.5; -+ firstHalf->y4 = secondHalf->y1 = (firstHalf->y3 + secondHalf->y2)*.5; -+} -+// Patch: Workaround VS2019 compiler bug, see QTBUG-75280. -+#endif // Q_OS_WIN -+ - /*! - \internal - */ -diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h -index dd1cd94acf..aedc8b6a4b 100644 ---- a/src/gui/painting/qbezier_p.h -+++ b/src/gui/painting/qbezier_p.h -@@ -215,6 +215,8 @@ inline QPointF QBezier::secondDerivedAt(qreal t) const - a * y1 + b * y2 + c * y3 + d * y4); - } - -+// Patch: Workaround VS2019 compiler bug, see QTBUG-75280. -+#ifndef Q_OS_WIN - inline void QBezier::split(QBezier *firstHalf, QBezier *secondHalf) const - { - Q_ASSERT(firstHalf); -@@ -238,6 +240,8 @@ inline void QBezier::split(QBezier *firstHalf, QBezier *secondHalf) const - secondHalf->y2 = (secondHalf->y3 + c)*.5; - firstHalf->y4 = secondHalf->y1 = (firstHalf->y3 + secondHalf->y2)*.5; - } -+// Patch: Workaround VS2019 compiler bug, see QTBUG-75280. -+#endif // Q_OS_WIN - - inline void QBezier::parameterSplitLeft(qreal t, QBezier *left) - { -diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h -index 918c98997b..4158259743 100644 ---- a/src/gui/painting/qpaintengine_p.h -+++ b/src/gui/painting/qpaintengine_p.h -@@ -80,8 +80,18 @@ public: - if (hasSystemTransform) { - if (systemTransform.type() <= QTransform::TxTranslate) - systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy())); -- else -+ // Patch: Transform the system clip region back from device pixels to device-independent pixels before -+ // applying systemTransform, which already has transform from device-independent pixels to device pixels. -+ else { -+#ifdef Q_OS_MAC -+ QTransform scaleTransform; -+ const qreal invDevicePixelRatio = 1. / pdev->devicePixelRatio(); -+ scaleTransform.scale(invDevicePixelRatio, invDevicePixelRatio); -+ systemClip = systemTransform.map(scaleTransform.map(systemClip)); -+#else - systemClip = systemTransform.map(systemClip); -+#endif -+ } - } - - // Make sure we're inside the viewport. -diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h -index 7e507bba2d..936e7a92cb 100644 ---- a/src/gui/text/qtextengine_p.h -+++ b/src/gui/text/qtextengine_p.h -@@ -283,7 +283,8 @@ private: - - struct QScriptItem; - /// Internal QTextItem --class QTextItemInt : public QTextItem -+// Patch: Enable access to QTextItemInt in .dll for WinRT build. -+class Q_GUI_EXPORT QTextItemInt : public QTextItem - { - public: - inline QTextItemInt() -diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp -index aca475a581..5fa0be2c45 100644 ---- a/src/gui/text/qtextlayout.cpp -+++ b/src/gui/text/qtextlayout.cpp -@@ -694,6 +694,9 @@ int QTextLayout::nextCursorPosition(int oldPos, CursorMode mode) const - while (oldPos < len && !attributes[oldPos].graphemeBoundary) - oldPos++; - } else { -+ // Patch: Skip to the end of the current word, not to the start of the next one. -+ while (oldPos < len && attributes[oldPos].whiteSpace) -+ oldPos++; - if (oldPos < len && d->atWordSeparator(oldPos)) { - oldPos++; - while (oldPos < len && d->atWordSeparator(oldPos)) -@@ -702,8 +705,9 @@ int QTextLayout::nextCursorPosition(int oldPos, CursorMode mode) const - while (oldPos < len && !attributes[oldPos].whiteSpace && !d->atWordSeparator(oldPos)) - oldPos++; - } -- while (oldPos < len && attributes[oldPos].whiteSpace) -- oldPos++; -+ // Patch: Skip to the end of the current word, not to the start of the next one. -+ //while (oldPos < len && attributes[oldPos].whiteSpace) -+ // oldPos++; - } - - return oldPos; -@@ -1645,6 +1649,9 @@ namespace { - int currentPosition; - glyph_t previousGlyph; - -+ // Patch: Fix a crash in right bearing calculation. -+ QFontEngine *previousGlyphFontEngine; -+ - QFixed minw; - QFixed softHyphenWidth; - QFixed rightBearing; -@@ -1677,13 +1684,19 @@ namespace { - if (currentPosition > 0 && - logClusters[currentPosition - 1] < glyphs.numGlyphs) { - previousGlyph = currentGlyph(); // needed to calculate right bearing later -+ -+ // Patch: Fix a crash in right bearing calculation. -+ previousGlyphFontEngine = fontEngine; - } - } - -- inline void calculateRightBearing(glyph_t glyph) -+ // Patch: Fix a crash in right bearing calculation. -+ inline void calculateRightBearing(QFontEngine *engine, glyph_t glyph) - { - qreal rb; -- fontEngine->getGlyphBearings(glyph, 0, &rb); -+ -+ // Patch: Fix a crash in right bearing calculation. -+ engine->getGlyphBearings(glyph, 0, &rb); - - // We only care about negative right bearings, so we limit the range - // of the bearing here so that we can assume it's negative in the rest -@@ -1696,13 +1709,16 @@ namespace { - { - if (currentPosition <= 0) - return; -- calculateRightBearing(currentGlyph()); -+ -+ // Patch: Fix a crash in right bearing calculation. -+ calculateRightBearing(fontEngine, currentGlyph()); - } - - inline void calculateRightBearingForPreviousGlyph() - { - if (previousGlyph > 0) -- calculateRightBearing(previousGlyph); -+ // Patch: Fix a crash in right bearing calculation. -+ calculateRightBearing(previousGlyphFontEngine, previousGlyph); - } - - static const QFixed RightBearingNotCalculated; -diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h -index f74d4d4229..8ad672c9fe 100644 ---- a/src/gui/text/qtextlayout.h -+++ b/src/gui/text/qtextlayout.h -@@ -196,6 +196,9 @@ private: - QRectF *brect, int tabstops, int* tabarray, int tabarraylen, - QPainter *painter); - QTextEngine *d; -+ -+ // Patch: Allow access to private constructor. -+ friend class TextBlock; - }; - - -diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp -index c4cb8e65c0..45793e364f 100644 ---- a/src/network/access/qhttpnetworkconnection.cpp -+++ b/src/network/access/qhttpnetworkconnection.cpp -@@ -110,6 +110,8 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate() - { - for (int i = 0; i < channelCount; ++i) { - if (channels[i].socket) { -+ // Patch: backport critical bugfix from '4f959b6b30' commit. -+ QObject::disconnect(channels[i].socket, Q_NULLPTR, &channels[i], Q_NULLPTR); - channels[i].socket->close(); - delete channels[i].socket; - } -diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp -index 94235a48dd..9abd2cc0a1 100644 ---- a/src/network/access/qnetworkreplyhttpimpl.cpp -+++ b/src/network/access/qnetworkreplyhttpimpl.cpp -@@ -2045,6 +2045,9 @@ void QNetworkReplyHttpImplPrivate::finished() - { - Q_Q(QNetworkReplyHttpImpl); - -+ // Patch: Fix crash in Linux (by crashreports). -+ QPointer guard = q; -+ - if (state == Finished || state == Aborted || state == WaitingForSession) - return; - -@@ -2075,6 +2078,9 @@ void QNetworkReplyHttpImplPrivate::finished() - #endif - } - -+ // Patch: Fix crash in Linux (by crashreports). -+ if (!guard) return; -+ - // if we don't know the total size of or we received everything save the cache - if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) - completeCacheSave(); -@@ -2084,6 +2090,9 @@ void QNetworkReplyHttpImplPrivate::finished() - if (isHttpRedirectResponse() && errorCode == QNetworkReply::NoError) - return; - -+ // Patch: Fix crash in Linux (by crashreports). -+ if (!guard) return; -+ - state = Finished; - q->setFinished(true); - -diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp -index 41834b21ae..8cdf4ab145 100644 ---- a/src/network/socket/qnativesocketengine_win.cpp -+++ b/src/network/socket/qnativesocketengine_win.cpp -@@ -675,6 +675,13 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin - errorDetected = true; - break; - } -+ // Patch: Handle network unreachable the same as host unreachable. -+ if (value == WSAENETUNREACH) { -+ setError(QAbstractSocket::NetworkError, NetworkUnreachableErrorString); -+ socketState = QAbstractSocket::UnconnectedState; -+ errorDetected = true; -+ break; -+ } - if (value == WSAEADDRNOTAVAIL) { - setError(QAbstractSocket::NetworkError, AddressNotAvailableErrorString); - socketState = QAbstractSocket::UnconnectedState; -diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm -index fb609ae485..ef1c638d91 100644 ---- a/src/platformsupport/cglconvenience/cglconvenience.mm -+++ b/src/platformsupport/cglconvenience/cglconvenience.mm -@@ -128,7 +128,12 @@ void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format) - if (format.stereo()) - attrs << NSOpenGLPFAStereo; - -- attrs << NSOpenGLPFAAllowOfflineRenderers; -+ // Patch: Fix macOS regression. On 10.14.4, it crashes on GPU switches. -+ // See https://bugreports.qt.io/browse/QTCREATORBUG-22215 -+ static const QAppleOperatingSystemVersion version = qt_apple_os_version(); -+ if (!(version.major == 10 && version.minor == 14 && version.patch == 4)) { -+ attrs << NSOpenGLPFAAllowOfflineRenderers; -+ } - - QByteArray useLayer = qgetenv("QT_MAC_WANTS_LAYER"); - if (!useLayer.isEmpty() && useLayer.toInt() > 0) { -diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/dbustray/qdbustrayicon.cpp -index 4d6e70720d..9bdb0beb67 100644 ---- a/src/platformsupport/dbustray/qdbustrayicon.cpp -+++ b/src/platformsupport/dbustray/qdbustrayicon.cpp -@@ -58,9 +58,18 @@ QT_BEGIN_NAMESPACE - - Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray") - -+static QString cachePath() -+{ -+ QString xdgCache = QString::fromUtf8(getenv("XDG_CACHE_HOME")); -+ if (xdgCache.isEmpty()) { -+ xdgCache = QDir::cleanPath(QDir::homePath() + QStringLiteral("/.cache")); -+ } -+ return xdgCache; -+} -+ - static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2"); - static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher"); --static const QString TempFileTemplate = QDir::tempPath() + QStringLiteral("/qt-trayicon-XXXXXX.png"); -+static const QString TempFileTemplate = cachePath() + QStringLiteral("/qt-trayicon-XXXXXX.png"); - static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications"); - static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications"); - static const QString DefaultAction = QStringLiteral("default"); -@@ -151,6 +160,12 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon) - uint pid = session.interface()->servicePid(KDEWatcherService).value(); - QString processName = QLockFilePrivate::processNameByPid(pid); - necessary = processName.endsWith(QStringLiteral("indicator-application-service")); -+ if (!necessary) { -+ QString xdgDesktop = QString::fromUtf8(getenv("XDG_CURRENT_DESKTOP")); -+ QStringList desktops = xdgDesktop.toLower().split(QLatin1Char(':')); -+ necessary = desktops.contains(QStringLiteral("unity")) || -+ desktops.contains(QStringLiteral("ubuntu")); -+ } - necessity_checked = true; - } - if (!necessary) -diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp -index 728b166b71..1dc64593e1 100644 ---- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp -+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp -@@ -172,6 +172,79 @@ void QBasicFontDatabase::releaseHandle(void *handle) - - extern FT_Library qt_getFreetype(); - -+// Patch: Enable Open Sans Semibold font family reading. -+// Copied from freetype with some modifications. -+ -+#ifndef FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY -+#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG('i', 'g', 'p', 'f') -+#endif -+ -+#ifndef FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY -+#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG('i', 'g', 'p', 's') -+#endif -+ -+/* there's a Mac-specific extended implementation of FT_New_Face() */ -+/* in src/base/ftmac.c */ -+ -+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) -+ -+/* documentation is in freetype.h */ -+ -+FT_Error __ft_New_Face(FT_Library library, const char* pathname, FT_Long face_index, FT_Face *aface) { -+ FT_Open_Args args; -+ -+ /* test for valid `library' and `aface' delayed to FT_Open_Face() */ -+ if (!pathname) -+ return FT_Err_Invalid_Argument; -+ -+ FT_Parameter params[2]; -+ params[0].tag = FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY; -+ params[0].data = 0; -+ params[1].tag = FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY; -+ params[1].data = 0; -+ args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; -+ args.pathname = (char*)pathname; -+ args.stream = NULL; -+ args.num_params = 2; -+ args.params = params; -+ -+ return FT_Open_Face(library, &args, face_index, aface); -+} -+ -+#else -+ -+FT_Error __ft_New_Face(FT_Library library, const char* pathname, FT_Long face_index, FT_Face *aface) { -+ return FT_New_Face(library, pathname, face_index, aface); -+} -+ -+#endif /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */ -+ -+/* documentation is in freetype.h */ -+ -+FT_Error __ft_New_Memory_Face(FT_Library library, const FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface) { -+ FT_Open_Args args; -+ -+ /* test for valid `library' and `face' delayed to FT_Open_Face() */ -+ if (!file_base) -+ return FT_Err_Invalid_Argument; -+ -+ FT_Parameter params[2]; -+ params[0].tag = FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY; -+ params[0].data = 0; -+ params[1].tag = FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY; -+ params[1].data = 0; -+ args.flags = FT_OPEN_MEMORY | FT_OPEN_PARAMS; -+ args.memory_base = file_base; -+ args.memory_size = file_size; -+ args.stream = NULL; -+ args.num_params = 2; -+ args.params = params; -+ -+ return FT_Open_Face(library, &args, face_index, aface); -+} -+ -+// end -+ - QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file) - { - FT_Library library = qt_getFreetype(); -@@ -183,9 +256,11 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt - FT_Face face; - FT_Error error; - if (!fontData.isEmpty()) { -- error = FT_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face); -+ // Patch: Enable Open Sans Semibold font family reading. -+ error = __ft_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face); - } else { -- error = FT_New_Face(library, file.constData(), index, &face); -+ // Patch: Enable Open Sans Semibold font family reading. -+ error = __ft_New_Face(library, file.constData(), index, &face); - } - if (error != FT_Err_Ok) { - qDebug() << "FT_New_Face failed with index" << index << ':' << hex << error; -diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp -index 8ebabf3419..7bb8abd0d0 100644 ---- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp -+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp -@@ -375,6 +375,17 @@ static void populateFromPattern(FcPattern *pattern) - - familyName = QString::fromUtf8((const char *)value); - -+ // Patch: Enable Open Sans Semibold font family reading. -+ if (familyName == QLatin1String("Open Sans")) { -+ FcChar8 *styl = 0; -+ if (FcPatternGetString(pattern, FC_STYLE, 0, &styl) == FcResultMatch) { -+ QString style = QString::fromUtf8(reinterpret_cast(styl)); -+ if (style == QLatin1String("Semibold")) { -+ familyName.append(QChar(QChar::Space)).append(style); -+ } -+ } -+ } -+ - slant_value = FC_SLANT_ROMAN; - weight_value = FC_WEIGHT_REGULAR; - spacing_value = FC_PROPORTIONAL; -@@ -718,7 +729,19 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont - if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch) - continue; - // capitalize(value); -- const QString familyName = QString::fromUtf8((const char *)value); -+ -+ // Patch: Enable Open Sans Semibold font family reading. -+ QString familyName = QString::fromUtf8((const char *)value); -+ if (familyName == QLatin1String("Open Sans")) { -+ FcChar8 *styl = 0; -+ if (FcPatternGetString(fontSet->fonts[i], FC_STYLE, 0, &styl) == FcResultMatch) { -+ QString style = QString::fromUtf8(reinterpret_cast(styl)); -+ if (style == QLatin1String("Semibold")) { -+ familyName.append(QChar(QChar::Space)).append(style); -+ } -+ } -+ } -+ - const QString familyNameCF = familyName.toCaseFolded(); - if (!duplicates.contains(familyNameCF)) { - fallbackFamilies << familyName; -@@ -784,6 +807,18 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData, - FcChar8 *fam = 0; - if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) { - QString family = QString::fromUtf8(reinterpret_cast(fam)); -+ -+ // Patch: Enable Open Sans Semibold font family reading. -+ if (family == QLatin1String("Open Sans")) { -+ FcChar8 *styl = 0; -+ if (FcPatternGetString(pattern, FC_STYLE, 0, &styl) == FcResultMatch) { -+ QString style = QString::fromUtf8(reinterpret_cast(styl)); -+ if (style == QLatin1String("Semibold")) { -+ family.append(QChar(QChar::Space)).append(style); -+ } -+ } -+ } -+ - families << family; - } - populateFromPattern(pattern); -diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm -index 566abf2126..5c5fde9813 100644 ---- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm -+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm -@@ -265,6 +265,13 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) - - fd->foundryName = QStringLiteral("CoreText"); - fd->familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); -+ -+ // Patch: Enable Open Sans Semibold font family reading. -+ QCFString _displayName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontDisplayNameAttribute); -+ if (_displayName == QStringLiteral("Open Sans Semibold")) { -+ fd->familyName = _displayName; -+ } -+ - fd->styleName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); - fd->weight = QFont::Normal; - fd->style = QFont::StyleNormal; -@@ -300,9 +307,10 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) - - if (styles) { - if (CFNumberRef weightValue = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontWeightTrait)) { -- float normalizedWeight; -- if (CFNumberGetValue(weightValue, kCFNumberFloatType, &normalizedWeight)) -- fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(normalizedWeight); -+ // Patch: backport bugfix from 'b64ea4a3ab' commit. -+ double normalizedWeight; -+ if (CFNumberGetValue(weightValue, kCFNumberFloat64Type, &normalizedWeight)) -+ fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(float(normalizedWeight)); - } - if (CFNumberRef italic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSlantTrait)) { - double d; -diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -index 7b459584ea..2ed2fd9b3b 100644 ---- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm -@@ -764,7 +764,8 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gl - - QFixed QCoreTextFontEngine::emSquareSize() const - { -- return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont))); -+ // Patch: Fix build for Xcode 9.3.1. -+ return QFixed(int(CTFontGetUnitsPerEm(ctfont))); - } - - QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const -diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro -index 86bdd4729b..9b9c8ded08 100644 ---- a/src/plugins/platforminputcontexts/compose/compose.pro -+++ b/src/plugins/platforminputcontexts/compose/compose.pro -@@ -15,7 +15,8 @@ HEADERS += $$PWD/qcomposeplatforminputcontext.h \ - contains(QT_CONFIG, xkbcommon-qt): { - # dont't need x11 dependency for compose key plugin - QT_CONFIG -= use-xkbcommon-x11support -- include(../../../3rdparty/xkbcommon.pri) -+ # Patch: Adding fcitx input context plugin to our static build. -+ #include(../../../3rdparty/xkbcommon.pri) - } else { - LIBS += $$QMAKE_LIBS_XKBCOMMON - QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON -diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp -index d1bea9af23..36a15a6473 100644 ---- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp -+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp -@@ -232,6 +232,12 @@ bool QComposeInputContext::checkComposeTable() - - void QComposeInputContext::commitText(uint character) const - { -+ // Patch: Crash fix when not focused widget still receives input events. -+ if (!m_focusObject) { -+ qWarning("QComposeInputContext::commitText: m_focusObject == nullptr, cannot commit text"); -+ return; -+ } -+ - QInputMethodEvent event; - event.setCommitString(QChar(character)); - QCoreApplication::sendEvent(m_focusObject, &event); -diff --git a/src/plugins/platforminputcontexts/platforminputcontexts.pro b/src/plugins/platforminputcontexts/platforminputcontexts.pro -index faea54b874..fe4a837511 100644 ---- a/src/plugins/platforminputcontexts/platforminputcontexts.pro -+++ b/src/plugins/platforminputcontexts/platforminputcontexts.pro -@@ -1,7 +1,8 @@ - TEMPLATE = subdirs - - qtHaveModule(dbus) { --!mac:!win32:SUBDIRS += ibus -+# Patch: Adding fcitx/hime/nimf input context plugin to our static build. -+!mac:!win32:SUBDIRS += ibus fcitx hime nimf - } - - contains(QT_CONFIG, xcb-plugin): SUBDIRS += compose -diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm -index caa8884661..9dc3bc1661 100644 ---- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm -+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm -@@ -210,7 +210,8 @@ QT_END_NAMESPACE - if (reflectionDelegate) { - if ([reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)]) - return [reflectionDelegate applicationShouldTerminate:sender]; -- return NSTerminateNow; -+ // Patch: Don't terminate if reflectionDelegate does not respond to that selector, just use the default. -+ //return NSTerminateNow; - } - - if ([self canQuit]) { -@@ -287,11 +288,15 @@ QT_END_NAMESPACE - - - (void)applicationDidFinishLaunching:(NSNotification *)aNotification - { -+ // Patch: We need to catch that notification in delegate. -+ if (reflectionDelegate -+ && [reflectionDelegate respondsToSelector:@selector(applicationDidFinishLaunching:)]) -+ [reflectionDelegate applicationDidFinishLaunching:aNotification]; -+ - Q_UNUSED(aNotification); - inLaunch = false; - // qt_release_apple_event_handler(); - -- - // Insert code here to initialize your application - } - -diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h -index 934f68ad18..3ece6984ac 100644 ---- a/src/plugins/platforms/cocoa/qcocoabackingstore.h -+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h -@@ -64,6 +64,9 @@ public: - private: - QImage m_qImage; - QSize m_requestedSize; -+ -+ // Patch: Optimize redraw - don't clear image if it will be fully redrawn. -+ bool m_qImageNeedsClear; - }; - - QT_END_NAMESPACE -diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm -index ca92103826..f27ea15bad 100644 ---- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm -+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm -@@ -38,7 +38,8 @@ - QT_BEGIN_NAMESPACE - - QCocoaBackingStore::QCocoaBackingStore(QWindow *window) -- : QPlatformBackingStore(window) -+ // Patch: Optimize redraw - don't clear image if it will be fully redrawn. -+ : QPlatformBackingStore(window), m_qImageNeedsClear(false) - { - } - -@@ -59,9 +60,12 @@ QPaintDevice *QCocoaBackingStore::paintDevice() - if (m_qImage.size() != effectiveBufferSize) { - QImage::Format format = (window()->format().hasAlpha() || cocoaWindow->m_drawContentBorderGradient) - ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; -+ -+ // Patch: Optimize redraw - don't clear image if it will be fully redrawn. -+ m_qImageNeedsClear = window()->requestedFormat().hasAlpha() || cocoaWindow->m_drawContentBorderGradient; - m_qImage = QImage(effectiveBufferSize, format); - m_qImage.setDevicePixelRatio(windowDevicePixelRatio); -- if (format == QImage::Format_ARGB32_Premultiplied) -+ if (m_qImageNeedsClear) - m_qImage.fill(Qt::transparent); - } - return &m_qImage; -@@ -100,7 +104,8 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy) - - void QCocoaBackingStore::beginPaint(const QRegion ®ion) - { -- if (m_qImage.hasAlphaChannel()) { -+ // Patch: Optimize redraw - don't clear image if it will be fully redrawn. -+ if (m_qImageNeedsClear && m_qImage.hasAlphaChannel()) { - QPainter p(&m_qImage); - p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector rects = region.rects(); -diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm -index 058209da7e..6af61e7dab 100644 ---- a/src/plugins/platforms/cocoa/qcocoahelpers.mm -+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm -@@ -546,9 +546,9 @@ OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGIm - // Verbatim copy if HIViewDrawCGImage (as shown on Carbon-Dev) - OSStatus err = noErr; - -- require_action(inContext != NULL, InvalidContext, err = paramErr); -- require_action(inBounds != NULL, InvalidBounds, err = paramErr); -- require_action(inImage != NULL, InvalidImage, err = paramErr); -+// require_action(inContext != NULL, InvalidContext, err = paramErr); -+// require_action(inBounds != NULL, InvalidBounds, err = paramErr); -+// require_action(inImage != NULL, InvalidImage, err = paramErr); - - CGContextSaveGState( inContext ); - CGContextTranslateCTM (inContext, 0, inBounds->origin.y + CGRectGetMaxY(*inBounds)); -@@ -557,9 +557,9 @@ OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGIm - CGContextDrawImage(inContext, *inBounds, inImage); - - CGContextRestoreGState(inContext); --InvalidImage: --InvalidBounds: --InvalidContext: -+//InvalidImage: -+//InvalidBounds: -+//InvalidContext: - return err; - } - -diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm -index c2d206fb45..9b9739862d 100644 ---- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm -+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm -@@ -384,6 +384,12 @@ bool QCocoaKeyMapper::updateKeyboard() - keyboardInputLocale = QLocale::c(); - keyboardInputDirection = Qt::LeftToRight; - } -+ -+ // Patch: Fix layout-independent global shortcuts. -+ const auto newMode = keyboard_mode; -+ deleteLayouts(); -+ keyboard_mode = newMode; -+ - return true; - } - -@@ -466,7 +472,8 @@ QList QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const - Qt::KeyboardModifiers neededMods = ModsTbl[i]; - int key = kbItem->qtKey[i]; - if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) { -- ret << int(key + (keyMods & ~neededMods)); -+ // Patch: Fix layout-independent global shortcuts. -+ ret << int(key + neededMods); - } - } - return ret; -diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm -index 8152c57ffd..87ba2f3f72 100644 ---- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm -+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm -@@ -94,6 +94,8 @@ QT_USE_NAMESPACE - QCocoaSystemTrayIcon *systray; - NSStatusItem *item; - QCocoaMenu *menu; -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ bool menuVisible, iconSelected; - QIcon icon; - QT_MANGLE_NAMESPACE(QNSImageView) *imageCell; - } -@@ -197,7 +199,9 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) - // (device independent pixels). The menu height on past and - // current OS X versions is 22 points. Provide some future-proofing - // by deriving the icon height from the menu height. -- const int padding = 4; -+ -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ const int padding = 0; - const int menuHeight = [[NSStatusBar systemStatusBar] thickness]; - const int maxImageHeight = menuHeight - padding; - -@@ -207,8 +211,11 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) - // devicePixelRatio for the "best" screen on the system. - qreal devicePixelRatio = qApp->devicePixelRatio(); - const int maxPixmapHeight = maxImageHeight * devicePixelRatio; -+ -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ const QIcon::Mode mode = m_sys->item->iconSelected ? QIcon::Selected : QIcon::Normal; - QSize selectedSize; -- Q_FOREACH (const QSize& size, sortByHeight(icon.availableSizes())) { -+ Q_FOREACH (const QSize& size, sortByHeight(icon.availableSizes(mode))) { - // Select a pixmap based on the height. We want the largest pixmap - // with a height smaller or equal to maxPixmapHeight. The pixmap - // may rectangular; assume it has a reasonable size. If there is -@@ -224,9 +231,9 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) - - // Handle SVG icons, which do not return anything for availableSizes(). - if (!selectedSize.isValid()) -- selectedSize = icon.actualSize(QSize(maxPixmapHeight, maxPixmapHeight)); -+ selectedSize = icon.actualSize(QSize(maxPixmapHeight, maxPixmapHeight), mode); - -- QPixmap pixmap = icon.pixmap(selectedSize); -+ QPixmap pixmap = icon.pixmap(selectedSize, mode); - - // Draw a low-resolution icon if there is not enough pixels for a retina - // icon. This prevents showing a small icon on retina displays. -@@ -374,6 +381,11 @@ QT_END_NAMESPACE - Q_UNUSED(notification); - down = NO; - -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ parent->iconSelected = false; -+ parent->systray->updateIcon(parent->icon); -+ parent->menuVisible = false; -+ - [self setNeedsDisplay:YES]; - } - -@@ -383,6 +395,10 @@ QT_END_NAMESPACE - int clickCount = [mouseEvent clickCount]; - [self setNeedsDisplay:YES]; - -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ parent->iconSelected = (clickCount != 2) && parent->menu; -+ parent->systray->updateIcon(parent->icon); -+ - if (clickCount == 2) { - [self menuTrackingDone:nil]; - [parent doubleClickSelector:self]; -@@ -399,6 +415,11 @@ QT_END_NAMESPACE - -(void)mouseUp:(NSEvent *)mouseEvent - { - Q_UNUSED(mouseEvent); -+ -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ parent->iconSelected = false; -+ parent->systray->updateIcon(parent->icon); -+ - [self menuTrackingDone:nil]; - } - -@@ -410,6 +431,11 @@ QT_END_NAMESPACE - -(void)rightMouseUp:(NSEvent *)mouseEvent - { - Q_UNUSED(mouseEvent); -+ -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ parent->iconSelected = false; -+ parent->systray->updateIcon(parent->icon); -+ - [self menuTrackingDone:nil]; - } - -@@ -425,7 +451,8 @@ QT_END_NAMESPACE - } - - -(void)drawRect:(NSRect)rect { -- [[parent item] drawStatusBarBackgroundInRect:rect withHighlight:down]; -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ [[parent item] drawStatusBarBackgroundInRect:rect withHighlight:parent->menu ? down : NO]; - [super drawRect:rect]; - } - @end -@@ -438,6 +465,10 @@ QT_END_NAMESPACE - if (self) { - item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; - menu = 0; -+ -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ menuVisible = false; -+ - systray = sys; - imageCell = [[QNSImageView alloc] initWithParent:self]; - [item setView: imageCell]; -@@ -448,6 +479,11 @@ QT_END_NAMESPACE - -(void)dealloc { - [[NSStatusBar systemStatusBar] removeStatusItem:item]; - [[NSNotificationCenter defaultCenter] removeObserver:imageCell]; -+ -+ // Patch: Fix crash in macOS 10.14. -+ // Somehow item and imageCell are retained and attempt to be drawn if left in view. -+ [item setView: nil]; -+ - [imageCell release]; - [item release]; - [super dealloc]; -@@ -482,6 +518,10 @@ QT_END_NAMESPACE - selector:@selector(menuTrackingDone:) - name:NSMenuDidEndTrackingNotification - object:m]; -+ -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ menuVisible = true; -+ - [item popUpStatusItemMenu: m]; - } - } -diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm -index c0d5904367..f3c2047196 100644 ---- a/src/plugins/platforms/cocoa/qcocoawindow.mm -+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm -@@ -141,7 +141,8 @@ static bool isMouseEvent(NSEvent *ev) - if (!self.window.delegate) - return; // Already detached, pending NSAppKitDefined event - -- if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { -+ // Patch: Fix restore after minimize or close by window buttons. -+ if (pw && pw->frameStrutEventsEnabled() && pw->m_synchedWindowState != Qt::WindowMinimized && pw->m_isExposed && isMouseEvent(theEvent)) { - NSPoint loc = [theEvent locationInWindow]; - NSRect windowFrame = [self.window convertRectFromScreen:[self.window frame]]; - NSRect contentFrame = [[self.window contentView] frame]; -@@ -811,6 +812,16 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) - { - Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); - NSInteger styleMask = NSBorderlessWindowMask; -+ -+ // Patch: allow creating panels floating on all spaces in macOS. -+ // If you call "setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary" before -+ // setting the "NSNonactivatingPanelMask" bit in the style mask it won't work after that. -+ // So we need a way to set that bit before Qt sets collection behavior the way it does. -+ QVariant nonactivatingPanelMask = window()->property("_td_macNonactivatingPanelMask"); -+ if (nonactivatingPanelMask.isValid() && nonactivatingPanelMask.toBool()) { -+ styleMask |= NSNonactivatingPanelMask; -+ } -+ - if (flags & Qt::FramelessWindowHint) - return styleMask; - if ((type & Qt::Popup) == Qt::Popup) { -@@ -943,6 +954,19 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath) - [m_nsWindow setRepresentedFilename: fi.exists() ? QCFString::toNSString(filePath) : @""]; - } - -+// Patch: Create a good os x window icon (pixel-perfect). -+namespace { -+ -+qreal getDevicePixelRatio() { -+ qreal result = 1.0; -+ foreach (QScreen *screen, QGuiApplication::screens()) { -+ result = qMax(result, screen->devicePixelRatio()); -+ } -+ return result; -+} -+ -+} // namespace -+ - void QCocoaWindow::setWindowIcon(const QIcon &icon) - { - QMacAutoReleasePool pool; -@@ -958,7 +982,9 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon) - if (icon.isNull()) { - [iconButton setImage:nil]; - } else { -- QPixmap pixmap = icon.pixmap(QSize(22, 22)); -+ // Patch: Create a good os x window icon (pixel-perfect). -+ CGFloat hgt = 16. * getDevicePixelRatio(); -+ QPixmap pixmap = icon.pixmap(QSize(hgt, hgt)); - NSImage *image = static_cast(qt_mac_create_nsimage(pixmap)); - [iconButton setImage:image]; - [image release]; -diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm -index c67bcfd23b..6a60670aee 100644 ---- a/src/plugins/platforms/cocoa/qnsview.mm -+++ b/src/plugins/platforms/cocoa/qnsview.mm -@@ -647,6 +647,12 @@ QT_WARNING_POP - [self invalidateWindowShadowIfNeeded]; - } - -+- (void)viewDidChangeBackingProperties -+{ -+ if (self.layer) -+ self.layer.contentsScale = self.window.backingScaleFactor; -+} -+ - - (BOOL) isFlipped - { - return YES; -@@ -1431,7 +1437,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { - // On 10.8 and above, MayBegin is likely to happen. We treat it the same as an actual begin. -- if (phase == NSEventPhaseMayBegin) { -+ -+ // Patch: Fix actual begin handle of swipe on trackpad. -+ if (phase == NSEventPhaseMayBegin || phase == NSEventPhaseBegan) { - m_scrolling = true; - ph = Qt::ScrollBegin; - } -@@ -1496,14 +1504,14 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - quint32 nativeVirtualKey = [nsevent keyCode]; - - QChar ch = QChar::ReplacementCharacter; -- int keyCode = Qt::Key_unknown; -- if ([characters length] != 0) { -- if (((modifiers & Qt::MetaModifier) || (modifiers & Qt::AltModifier)) && ([charactersIgnoringModifiers length] != 0)) -- ch = QChar([charactersIgnoringModifiers characterAtIndex:0]); -- else -- ch = QChar([characters characterAtIndex:0]); -- keyCode = [self convertKeyCode:ch]; -- } -+ -+ // Patch: Fix Alt+.. shortcuts in OS X. See https://bugreports.qt.io/browse/QTBUG-42584 at the end. -+ if ([characters length] != 0) -+ ch = QChar([characters characterAtIndex:0]); -+ else if ([charactersIgnoringModifiers length] != 0 && ((modifiers & Qt::MetaModifier) || (modifiers & Qt::AltModifier))) -+ ch = QChar([charactersIgnoringModifiers characterAtIndex:0]); -+ -+ int keyCode = [self convertKeyCode:ch]; - - // we will send a key event unless the input method sets m_sendKeyEvent to false - m_sendKeyEvent = true; -@@ -1569,6 +1577,23 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - [self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)]; - } - -+// Patch: Enable Ctrl+Tab and Ctrl+Shift+Tab / Ctrl+Backtab handle in-app. -+- (BOOL)performKeyEquivalent:(NSEvent *)nsevent -+{ -+ NSString *chars = [nsevent charactersIgnoringModifiers]; -+ -+ if ([nsevent type] == NSKeyDown && [chars length] > 0) { -+ QChar ch = [chars characterAtIndex:0]; -+ Qt::Key qtKey = qt_mac_cocoaKey2QtKey(ch); -+ if ([nsevent modifierFlags] & NSControlKeyMask -+ && (qtKey == Qt::Key_Tab || qtKey == Qt::Key_Backtab)) { -+ [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; -+ return YES; -+ } -+ } -+ return [super performKeyEquivalent:nsevent]; -+} -+ - - (void)cancelOperation:(id)sender - { - Q_UNUSED(sender); -@@ -1981,6 +2006,10 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - // change the cursor - [nativeCursor set]; - -+ // Patch: Backport a fix from cd08753d3e. Starting with macOS Mojave this requires accessibility access. -+ if (QSysInfo::macVersion() >= Q_MV_OSX(10, 14)) -+ return; -+ - // Make sure the cursor is updated correctly if the mouse does not move and window is under cursor - // by creating a fake move event - if (m_updatingDrag) -diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp -index 94bb71e429..16ab51e166 100644 ---- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp -+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp -@@ -716,12 +716,20 @@ public: - void setSelectedFiles(const QList &); - QString selectedFile() const; - -+ // Patch: Adding select-by-url for Windows file dialog. -+ void setSelectedRemoteContent(const QByteArray &); -+ QByteArray selectedRemoteContent() const; -+ - private: - class Data : public QSharedData { - public: - QUrl directory; - QString selectedNameFilter; - QList selectedFiles; -+ -+ // Patch: Adding select-by-url for Windows file dialog. -+ QByteArray selectedRemoteContent; -+ - QMutex mutex; - }; - QExplicitlySharedDataPointer m_data; -@@ -775,6 +783,21 @@ inline void QWindowsFileDialogSharedData::setSelectedFiles(const QList &ur - m_data->selectedFiles = urls; - } - -+// Patch: Adding select-by-url for Windows file dialog. -+inline QByteArray QWindowsFileDialogSharedData::selectedRemoteContent() const -+{ -+ m_data->mutex.lock(); -+ const QByteArray result = m_data->selectedRemoteContent; -+ m_data->mutex.unlock(); -+ return result; -+} -+ -+inline void QWindowsFileDialogSharedData::setSelectedRemoteContent(const QByteArray &c) -+{ -+ QMutexLocker(&m_data->mutex); -+ m_data->selectedRemoteContent = c; -+} -+ - inline void QWindowsFileDialogSharedData::fromOptions(const QSharedPointer &o) - { - QMutexLocker locker(&m_data->mutex); -@@ -899,6 +922,9 @@ public: - // example by appended default suffixes, etc. - virtual QList dialogResult() const = 0; - -+ // Patch: Adding select-by-url for Windows file dialog. -+ virtual QByteArray dialogRemoteContent() const { return QByteArray(); } -+ - inline void onFolderChange(IShellItem *); - inline void onSelectionChange(); - inline void onTypeChange(); -@@ -1338,7 +1364,14 @@ void QWindowsNativeFileDialogBase::selectFile(const QString &fileName) const - // Hack to prevent CLSIDs from being set as file name due to - // QFileDialogPrivate::initialSelection() being QString-based. - if (!isClsid(fileName)) -- m_fileDialog->SetFileName((wchar_t*)fileName.utf16()); -+ // Patch: Fix handle of full fileName. -+ { -+ QString file = QDir::toNativeSeparators(fileName); -+ int lastBackSlash = file.lastIndexOf(QChar::fromLatin1('\\')); -+ if (lastBackSlash >= 0) -+ file = file.mid(lastBackSlash + 1); -+ m_fileDialog->SetFileName((wchar_t*)file.utf16());; -+ } - } - - // Return the index of the selected filter, accounting for QFileDialog -@@ -1408,6 +1441,10 @@ bool QWindowsNativeFileDialogBase::onFileOk() - { - // Store selected files as GetResults() returns invalid data after the dialog closes. - m_data.setSelectedFiles(dialogResult()); -+ -+ // Patch: Adding select-by-url for Windows file dialog. -+ m_data.setSelectedRemoteContent(dialogRemoteContent()); -+ - return true; - } - -@@ -1542,6 +1579,9 @@ public: - QList selectedFiles() const Q_DECL_OVERRIDE; - QList dialogResult() const Q_DECL_OVERRIDE; - -+ // Patch: Adding select-by-url for Windows file dialog. -+ QByteArray dialogRemoteContent() const Q_DECL_OVERRIDE; -+ - private: - inline IFileOpenDialog *openFileDialog() const - { return static_cast(fileDialog()); } -@@ -1556,6 +1596,62 @@ QList QWindowsNativeOpenFileDialog::dialogResult() const - return result; - } - -+// Patch: Adding select-by-url for Windows file dialog. -+QByteArray QWindowsNativeOpenFileDialog::dialogRemoteContent() const -+{ -+ QByteArray result; -+ IShellItemArray *items = 0; -+ if (FAILED(openFileDialog()->GetResults(&items)) || !items) -+ return result; -+ DWORD itemCount = 0; -+ if (FAILED(items->GetCount(&itemCount)) || !itemCount) -+ return result; -+ for (DWORD i = 0; i < itemCount; ++i) -+ { -+ IShellItem *item = 0; -+ if (SUCCEEDED(items->GetItemAt(i, &item))) { -+ SFGAOF attributes = 0; -+ // Check whether it has a file system representation? -+ if (FAILED(item->GetAttributes(SFGAO_FILESYSTEM, &attributes)) || (attributes & SFGAO_FILESYSTEM)) -+ { -+ LPWSTR name = 0; -+ if (SUCCEEDED(item->GetDisplayName(SIGDN_FILESYSPATH, &name))) -+ { -+ CoTaskMemFree(name); -+ continue; -+ } -+ } -+ if (FAILED(item->GetAttributes(SFGAO_STREAM, &attributes)) || !(attributes & SFGAO_STREAM)) -+ continue; -+ -+ IBindCtx *bind = 0; -+ if (FAILED(CreateBindCtx(0, &bind))) -+ continue; -+ -+ IStream *stream = 0; -+ if (FAILED(item->BindToHandler(bind, BHID_Stream, IID_IStream, reinterpret_cast(&stream)))) -+ continue; -+ -+ STATSTG stat = { 0 }; -+ if (FAILED(stream->Stat(&stat, STATFLAG_NONAME)) || !stat.cbSize.QuadPart) -+ continue; -+ -+ quint64 fullSize = stat.cbSize.QuadPart; -+ if (fullSize <= 64 * 1024 * 1024) -+ { -+ result.resize(fullSize); -+ ULONG read = 0; -+ HRESULT r = stream->Read(result.data(), fullSize, &read); -+ if (r == S_FALSE || r == S_OK) -+ return result; -+ -+ result.clear(); -+ } -+ } -+ } -+ return result; -+} -+ - QList QWindowsNativeOpenFileDialog::selectedFiles() const - { - QList result; -@@ -1614,6 +1710,10 @@ public: - virtual QUrl directory() const Q_DECL_OVERRIDE; - virtual void selectFile(const QUrl &filename) Q_DECL_OVERRIDE; - virtual QList selectedFiles() const Q_DECL_OVERRIDE; -+ -+ // Patch: Adding select-by-url for Windows file dialog. -+ virtual QByteArray selectedRemoteContent() const Q_DECL_OVERRIDE; -+ - virtual void setFilter() Q_DECL_OVERRIDE; - virtual void selectNameFilter(const QString &filter) Q_DECL_OVERRIDE; - virtual QString selectedNameFilter() const Q_DECL_OVERRIDE; -@@ -1707,6 +1807,12 @@ QList QWindowsFileDialogHelper::selectedFiles() const - return m_data.selectedFiles(); - } - -+// Patch: Adding select-by-url for Windows file dialog. -+QByteArray QWindowsFileDialogHelper::selectedRemoteContent() const -+{ -+ return m_data.selectedRemoteContent(); -+} -+ - void QWindowsFileDialogHelper::setFilter() - { - qCDebug(lcQpaDialogs) << __FUNCTION__; -@@ -1996,6 +2102,10 @@ public: - QUrl directory() const Q_DECL_OVERRIDE; - void selectFile(const QUrl &url) Q_DECL_OVERRIDE; - QList selectedFiles() const Q_DECL_OVERRIDE; -+ -+ // Patch: Adding select-by-url for Windows file dialog. -+ QByteArray selectedRemoteContent() const Q_DECL_OVERRIDE; -+ - void setFilter() Q_DECL_OVERRIDE {} - void selectNameFilter(const QString &) Q_DECL_OVERRIDE; - QString selectedNameFilter() const Q_DECL_OVERRIDE; -@@ -2039,6 +2149,12 @@ QList QWindowsXpFileDialogHelper::selectedFiles() const - return m_data.selectedFiles(); - } - -+// Patch: Adding select-by-url for Windows file dialog. -+QByteArray QWindowsXpFileDialogHelper::selectedRemoteContent() const -+{ -+ return m_data.selectedRemoteContent(); -+} -+ - void QWindowsXpFileDialogHelper::selectNameFilter(const QString &f) - { - m_data.setSelectedNameFilter(f); // Dialog cannot be updated at run-time. -diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp -index 1e58b9b3d4..1741c21a1c 100644 ---- a/src/plugins/platforms/windows/qwindowskeymapper.cpp -+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp -@@ -1268,6 +1268,10 @@ QList QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const - if (nativeVirtualKey > 255) - return result; - -+ // Patch: This must not happen, but there are crash reports on the next line. -+ if (e->nativeVirtualKey() > 0xFF) -+ return result; -+ - const KeyboardLayoutItem &kbItem = keyLayout[nativeVirtualKey]; - if (!kbItem.exists) - return result; -diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp -index 1d23a9d9b9..640cd426ed 100644 ---- a/src/plugins/platforms/windows/qwindowsservices.cpp -+++ b/src/plugins/platforms/windows/qwindowsservices.cpp -@@ -127,6 +127,10 @@ static inline bool launchMail(const QUrl &url) - command.prepend(doubleQuote); - } - } -+ -+ // Patch: Fix mail launch if no param is expected in this command. -+ if (command.indexOf(QStringLiteral("%1")) < 0) return false; -+ - // Pass the url as the parameter. Should use QProcess::startDetached(), - // but that cannot handle a Windows command line [yet]. - command.replace(QStringLiteral("%1"), url.toString(QUrl::FullyEncoded)); -diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp -index b38d7c29ae..34f19c4efa 100644 ---- a/src/plugins/platforms/windows/qwindowswindow.cpp -+++ b/src/plugins/platforms/windows/qwindowswindow.cpp -@@ -1020,7 +1020,8 @@ void QWindowsWindow::destroyWindow() - // Clear any transient child relationships as Windows will otherwise destroy them (QTBUG-35499, QTBUG-36666) - if (QWindow *transientChild = findTransientChild(window())) - if (QWindowsWindow *tw = QWindowsWindow::baseWindowOf(transientChild)) -- tw->updateTransientParent(); -+ // Patch: Fix possibility of add / remove taskbar icon of the window. -+ tw->clearTransientParent(); - QWindowsContext *context = QWindowsContext::instance(); - if (context->windowUnderMouse() == window()) - context->clearWindowUnderMouse(); -@@ -1235,6 +1236,21 @@ void QWindowsWindow::updateTransientParent() const - if (const QWindowsWindow *tw = QWindowsWindow::baseWindowOf(tp)) - if (!tw->testFlag(WithinDestroy)) // Prevent destruction by parent window (QTBUG-35499, QTBUG-36666) - newTransientParent = tw->handle(); -+ // Patch: Fix possibility of add / remove taskbar icon of the window. -+ if (newTransientParent && newTransientParent != oldTransientParent) -+ SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, (LONG_PTR)newTransientParent); -+#endif // !Q_OS_WINCE -+} -+ -+// Patch: Fix possibility of add / remove taskbar icon of the window. -+void QWindowsWindow::clearTransientParent() const -+{ -+#ifndef Q_OS_WINCE -+ if (window()->type() == Qt::Popup) -+ return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow(). -+ // Update transient parent. -+ const HWND oldTransientParent = transientParentHwnd(m_data.hwnd); -+ HWND newTransientParent = 0; - if (newTransientParent != oldTransientParent) - SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, (LONG_PTR)newTransientParent); - #endif // !Q_OS_WINCE -@@ -1448,10 +1464,14 @@ void QWindowsWindow::handleResized(int wParam) - handleGeometryChange(); - break; - case SIZE_RESTORED: -- if (isFullScreen_sys()) -- handleWindowStateChange(Qt::WindowFullScreen); -- else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen)) -+ // Patch: When resolution is changed for a frameless fullscreen widget -+ // handleWindowStateChange call prevents correct geometry get in handleGeometryChange(). -+ if (isFullScreen_sys()) { -+ if (m_windowState != Qt::WindowFullScreen) -+ handleWindowStateChange(Qt::WindowFullScreen); -+ } else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen)) { - handleWindowStateChange(Qt::WindowNoState); -+ } - handleGeometryChange(); - break; - } -diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h -index 6fffa1e6e9..cb1c9c1161 100644 ---- a/src/plugins/platforms/windows/qwindowswindow.h -+++ b/src/plugins/platforms/windows/qwindowswindow.h -@@ -265,6 +265,10 @@ private: - inline void setWindowState_sys(Qt::WindowState newState); - inline void setParent_sys(const QPlatformWindow *parent); - inline void updateTransientParent() const; -+ -+ // Patch: Fix possibility of add / remove taskbar icon of the window. -+ inline void clearTransientParent() const; -+ - void destroyWindow(); - inline bool isDropSiteEnabled() const { return m_dropTarget != 0; } - void setDropSiteEnabled(bool enabled); -diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp -index 09e7ecf3a3..c0f15a4242 100644 ---- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp -+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp -@@ -79,7 +79,10 @@ static int resourceType(const QByteArray &key) - QByteArrayLiteral("rootwindow"), - QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingenabled"), - QByteArrayLiteral("nofonthinting"), -- QByteArrayLiteral("atspibus") -+ QByteArrayLiteral("atspibus"), -+ -+ // Patch: Backport compositing manager check from Qt 5.7 -+ QByteArrayLiteral("compositingenabled") - }; - const QByteArray *end = names + sizeof(names) / sizeof(names[0]); - const QByteArray *result = std::find(names, end, key); -@@ -252,6 +255,13 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr - case RootWindow: - result = reinterpret_cast(xcbScreen->root()); - break; -+ -+ // Patch: Backport compositing manager check from Qt 5.7 -+ case CompositingEnabled: -+ if (QXcbVirtualDesktop *vd = xcbScreen->virtualDesktop()) -+ result = vd->compositingActive() ? this : Q_NULLPTR; -+ break; -+ - default: - break; - } -diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h -index f88b710864..6f818a5a72 100644 ---- a/src/plugins/platforms/xcb/qxcbnativeinterface.h -+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h -@@ -68,7 +68,10 @@ public: - ScreenSubpixelType, - ScreenAntialiasingEnabled, - NoFontHinting, -- AtspiBus -+ AtspiBus, -+ -+ // Patch: Backport compositing manager check from Qt 5.7 -+ CompositingEnabled - }; - - QXcbNativeInterface(); -diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp -index bc2de899f5..aa8f8df4ad 100644 ---- a/src/widgets/dialogs/qfiledialog.cpp -+++ b/src/widgets/dialogs/qfiledialog.cpp -@@ -1200,6 +1200,15 @@ QList QFileDialogPrivate::userSelectedFiles() const - return files; - } - -+// Patch: Adding select-by-url for Windows file dialog. -+QByteArray QFileDialogPrivate::userSelectedRemoteContent() const -+{ -+ if (nativeDialogInUse) -+ return selectedRemoteContent_sys(); -+ -+ return QByteArray(); -+} -+ - QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList &filesToFix) const - { - QStringList files; -@@ -1267,6 +1276,14 @@ QStringList QFileDialog::selectedFiles() const - return files; - } - -+// Patch: Adding select-by-url for Windows file dialog. -+QByteArray QFileDialog::selectedRemoteContent() const -+{ -+ Q_D(const QFileDialog); -+ -+ return d->userSelectedRemoteContent(); -+} -+ - /*! - Returns a list of urls containing the selected files in the dialog. - If no files are selected, or the mode is not ExistingFiles or -diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h -index ffe49a2dd2..42dc563c8a 100644 ---- a/src/widgets/dialogs/qfiledialog.h -+++ b/src/widgets/dialogs/qfiledialog.h -@@ -108,6 +108,9 @@ public: - void selectFile(const QString &filename); - QStringList selectedFiles() const; - -+ // Patch: Adding select-by-url for Windows file dialog. -+ QByteArray selectedRemoteContent() const; -+ - void selectUrl(const QUrl &url); - QList selectedUrls() const; - -diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h -index f610e46f83..547a64695a 100644 ---- a/src/widgets/dialogs/qfiledialog_p.h -+++ b/src/widgets/dialogs/qfiledialog_p.h -@@ -123,6 +123,10 @@ public: - static QString initialSelection(const QUrl &path); - QStringList typedFiles() const; - QList userSelectedFiles() const; -+ -+ // Patch: Adding select-by-url for Windows file dialog. -+ QByteArray userSelectedRemoteContent() const; -+ - QStringList addDefaultSuffixToFiles(const QStringList &filesToFix) const; - QList addDefaultSuffixToUrls(const QList &urlsToFix) const; - bool removeDirectory(const QString &path); -@@ -256,6 +260,10 @@ public: - QUrl directory_sys() const; - void selectFile_sys(const QUrl &filename); - QList selectedFiles_sys() const; -+ -+ // Patch: Adding select-by-url for Windows file dialog. -+ QByteArray selectedRemoteContent_sys() const; -+ - void setFilter_sys(); - void selectNameFilter_sys(const QString &filter); - QString selectedNameFilter_sys() const; -@@ -393,6 +401,14 @@ inline QList QFileDialogPrivate::selectedFiles_sys() const - return QList(); - } - -+// Patch: Adding select-by-url for Windows file dialog. -+inline QByteArray QFileDialogPrivate::selectedRemoteContent_sys() const -+{ -+ if (QPlatformFileDialogHelper *helper = platformFileDialogHelper()) -+ return helper->selectedRemoteContent(); -+ return QByteArray(); -+} -+ - inline void QFileDialogPrivate::setFilter_sys() - { - if (QPlatformFileDialogHelper *helper = platformFileDialogHelper()) -diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp -index b1d80d7b8f..42e32fd404 100644 ---- a/src/widgets/kernel/qwidget.cpp -+++ b/src/widgets/kernel/qwidget.cpp -@@ -5138,6 +5138,17 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, - return; // Fully transparent. - - Q_D(QWidget); -+ -+ // Patch: save and restore dirtyOpaqueChildren field. -+ // -+ // Just like in QWidget::grab() this field should be restored -+ // after the d->render() call, because it will be set to 1 and -+ // opaqueChildren field will be filled with empty region in -+ // case the widget is hidden (because all the opaque children -+ // will be skipped in isVisible() check). -+ // -+ const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren; -+ - const bool inRenderWithPainter = d->extra && d->extra->inRenderWithPainter; - const QRegion toBePainted = !inRenderWithPainter ? d->prepareToRender(sourceRegion, renderFlags) - : sourceRegion; -@@ -5159,6 +5170,10 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, - if (!inRenderWithPainter && (opacity < 1.0 || (target->devType() == QInternal::Printer))) { - d->render_helper(painter, targetOffset, toBePainted, renderFlags); - d->extra->inRenderWithPainter = inRenderWithPainter; -+ -+ // Patch: save and restore dirtyOpaqueChildren field. -+ d->dirtyOpaqueChildren = oldDirtyOpaqueChildren; -+ - return; - } - -@@ -5190,6 +5205,9 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, - d->setSharedPainter(oldPainter); - - d->extra->inRenderWithPainter = inRenderWithPainter; -+ -+ // Patch: save and restore dirtyOpaqueChildren field. -+ d->dirtyOpaqueChildren = oldDirtyOpaqueChildren; - } - - static void sendResizeEvents(QWidget *target) -@@ -8769,7 +8787,8 @@ bool QWidget::event(QEvent *event) - case QEvent::KeyPress: { - QKeyEvent *k = (QKeyEvent *)event; - bool res = false; -- if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? -+ // Patch: Enable Ctrl+Tab and Ctrl+Shift+Tab / Ctrl+Backtab handle in-app. -+ if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier))) { //### Add MetaModifier? - if (k->key() == Qt::Key_Backtab - || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier))) - res = focusNextPrevChild(false); -diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp -index 704142fe5c..7c4340e459 100644 ---- a/src/widgets/util/qsystemtrayicon.cpp -+++ b/src/widgets/util/qsystemtrayicon.cpp -@@ -709,6 +709,10 @@ void QSystemTrayIconPrivate::updateMenu_sys_qpa() - if (menu) { - addPlatformMenu(menu); - qpa_sys->updateMenu(menu->platformMenu()); -+ -+ // Patch: Create a rich os x tray icon (pixel-perfect, theme switching). -+ } else { -+ qpa_sys->updateMenu(nullptr); - } - } - -diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp -index 2e2a042bf1..472e37722b 100644 ---- a/src/widgets/widgets/qabstractscrollarea.cpp -+++ b/src/widgets/widgets/qabstractscrollarea.cpp -@@ -640,15 +640,22 @@ scrolling range. - QSize QAbstractScrollArea::maximumViewportSize() const - { - Q_D(const QAbstractScrollArea); -- int hsbExt = d->hbar->sizeHint().height(); -- int vsbExt = d->vbar->sizeHint().width(); -+ // Patch: Count the sizeHint of the bar only if it is displayed. -+ //int hsbExt = d->hbar->sizeHint().height(); -+ //int vsbExt = d->vbar->sizeHint().width(); - - int f = 2 * d->frameWidth; - QSize max = size() - QSize(f + d->left + d->right, f + d->top + d->bottom); -- if (d->vbarpolicy == Qt::ScrollBarAlwaysOn) -+ -+ // Patch: Count the sizeHint of the bar only if it is displayed. -+ if (d->vbarpolicy == Qt::ScrollBarAlwaysOn) { -+ int vsbExt = d->vbar->sizeHint().width(); - max.rwidth() -= vsbExt; -- if (d->hbarpolicy == Qt::ScrollBarAlwaysOn) -+ } -+ if (d->hbarpolicy == Qt::ScrollBarAlwaysOn) { -+ int hsbExt = d->hbar->sizeHint().height(); - max.rheight() -= hsbExt; -+ } - return max; - } - -diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp -index daf9f00c46..57499dc4a4 100644 ---- a/src/widgets/widgets/qwidgetlinecontrol.cpp -+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp -@@ -40,6 +40,11 @@ - #include - #include - #include -+ -+// Patch: Enable Ctrl+key and Ctrl+Shift+key in all locales except German. -+// See https://github.com/telegramdesktop/tdesktop/pull/1185. -+#include -+ - #ifndef QT_NO_ACCESSIBILITY - #include "qaccessible.h" - #endif -@@ -1882,11 +1887,21 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) - } - - // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards -- if (unknown && !isReadOnly() -- && event->modifiers() != Qt::ControlModifier -- && event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)) { -+ -+ // Patch: Enable Ctrl+key and Ctrl+Shift+key in all locales except German. -+ // See https://github.com/telegramdesktop/tdesktop/pull/1185. -+ bool skipCtrlAndCtrlShift = false; -+ if (QGuiApplication::inputMethod()->locale().language() == QLocale::German) { -+ if (event->modifiers() == Qt::ControlModifier -+ || event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) { -+ skipCtrlAndCtrlShift = true; -+ } -+ } -+ if (unknown && !isReadOnly() && !skipCtrlAndCtrlShift) { - QString t = event->text(); -- if (!t.isEmpty() && t.at(0).isPrint()) { -+ -+ // Patch: Enable ZWJ and ZWNJ characters to be in text input. -+ if (!t.isEmpty() && (t.at(0).isPrint() || t.at(0).unicode() == 0x200C || t.at(0).unicode() == 0x200D)) { - insert(t); - #ifndef QT_NO_COMPLETER - complete(event->key()); -diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp -index deca002bf5..8a2023f503 100644 ---- a/src/widgets/widgets/qwidgettextcontrol.cpp -+++ b/src/widgets/widgets/qwidgettextcontrol.cpp -@@ -71,6 +71,11 @@ - #include - #include - #include -+ -+// Patch: Enable Ctrl+key and Ctrl+Shift+key in all locales except German. -+// See https://github.com/telegramdesktop/tdesktop/pull/1185. -+#include -+ - #include - #include - #include -@@ -1343,13 +1348,24 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e) - process: - { - // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards -- if (e->modifiers() == Qt::ControlModifier -- || e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { -+ -+ // Patch: Enable Ctrl+key and Ctrl+Shift+key in all locales except German. -+ // See https://github.com/telegramdesktop/tdesktop/pull/1185. -+ bool skipCtrlAndCtrlShift = false; -+ if (QGuiApplication::inputMethod()->locale().language() == QLocale::German) { -+ if (e->modifiers() == Qt::ControlModifier -+ || e->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) { -+ skipCtrlAndCtrlShift = true; -+ } -+ } -+ if (skipCtrlAndCtrlShift) { - e->ignore(); - return; - } - QString text = e->text(); -- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { -+ -+ // Patch: Enable ZWJ and ZWNJ characters to be in text input. -+ if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t') || text.at(0).unicode() == 0x200C || text.at(0).unicode() == 0x200D)) { - if (overwriteMode - // no need to call deleteChar() if we have a selection, insertText - // does it already diff --git a/docs/building-cmake.md b/docs/building-linux.md similarity index 97% rename from docs/building-cmake.md rename to docs/building-linux.md index f518c5dcbc..ce55f38c04 100644 --- a/docs/building-cmake.md +++ b/docs/building-linux.md @@ -1,4 +1,4 @@ -## Build instructions for CMake using Docker +## Build instructions for Linux using Docker ### Obtain your API credentials diff --git a/docs/building-xcode.md b/docs/building-mac.md similarity index 99% rename from docs/building-xcode.md rename to docs/building-mac.md index 8e6680ac8b..982883b0fc 100644 --- a/docs/building-xcode.md +++ b/docs/building-mac.md @@ -1,4 +1,4 @@ -## Build instructions for Xcode 12 +## Build instructions for macOS ### Prepare folder diff --git a/docs/building-xcode-mas.md b/docs/building-mas.md similarity index 85% rename from docs/building-xcode-mas.md rename to docs/building-mas.md index f3a1ad4719..cb8ca52ed2 100644 --- a/docs/building-xcode-mas.md +++ b/docs/building-mas.md @@ -1,6 +1,6 @@ -## Build instructions for Xcode 10.1 +## Build instructions for Mac App Store -**NB** These are used for Mac App Store build, after the [Building using Xcode][xcode] instructions. +**NB** These are used for Mac App Store build, after the [Build for macOS][mac] instructions. ### Prepare breakpad diff --git a/docs/building-osx.md b/docs/building-osx.md deleted file mode 100644 index 8636bc89f4..0000000000 --- a/docs/building-osx.md +++ /dev/null @@ -1,294 +0,0 @@ -## Build instructions for Xcode 10.1 - -**NB** These are outdated, please refer to [Building using Xcode][xcode] instructions. - -### Prepare folder - -Choose a folder for the future build, for example **/Users/user/TBuild**. It will be named ***BuildPath*** in the rest of this document. All commands will be launched from Terminal. - -### Obtain your API credentials - -You will require **api_id** and **api_hash** to access the Telegram API servers. To learn how to obtain them [click here][api_credentials]. - -### Download libraries - -Download [**libiconv-1.15**](http://www.gnu.org/software/libiconv/#downloading) and unpack to ***BuildPath*/Libraries/libiconv-1.15** - -### Clone source code and prepare libraries - -Go to ***BuildPath*** and run - - MAKE_THREADS_CNT=-j8 - MACOSX_DEPLOYMENT_TARGET=10.10 - - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install automake cmake fdk-aac git lame libass libtool libvorbis libvpx ninja opus sdl shtool texi2html theora wget x264 xvid yasm pkg-config - - sudo xcode-select -s /Applications/Xcode.app/Contents/Developer - - git clone --recursive https://github.com/telegramdesktop/tdesktop.git - - mkdir ThirdParty - cd ThirdParty - - git clone https://github.com/desktop-app/patches.git - cd patches - git checkout 7df6fdd - cd ../ - git clone https://chromium.googlesource.com/external/gyp - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git - export PATH="$PWD/depot_tools:$PATH" - cd gyp - git checkout 9f2a7bb1 - git apply ../patches/gyp.diff - ./setup.py build - sudo ./setup.py install - cd ../.. - - cd Libraries - - git clone https://github.com/desktop-app/patches.git - cd patches - git checkout 7df6fdd - cd ../ - - git clone https://git.tukaani.org/xz.git - cd xz - git checkout v5.2.5 - mkdir build - cd build - CFLAGS='-Werror=unguarded-availability-new' CPPFLAGS='-Werror=unguarded-availability-new' cmake -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.10 .. - make $MAKE_THREADS_CNT - cd ../.. - - git clone https://github.com/desktop-app/zlib.git - cd zlib - CFLAGS="-mmacosx-version-min=10.10 -Werror=unguarded-availability-new" LDFLAGS="-mmacosx-version-min=10.10" ./configure - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone -b v4.0.1-rc2 https://github.com/mozilla/mozjpeg.git - cd mozjpeg - cmake -B build . \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DWITH_JPEG8=ON \ - -DPNG_SUPPORTED=OFF - cmake --build build $MAKE_THREADS_CNT - sudo cmake --install build - cd .. - - git clone https://github.com/openssl/openssl openssl_1_1_1 - cd openssl_1_1_1 - git checkout OpenSSL_1_1_1-stable - ./Configure no-tests darwin64-x86_64-cc -static -mmacosx-version-min=10.10 - make build_libs $MAKE_THREADS_CNT - cd .. - - git clone https://github.com/xiph/opus - cd opus - git checkout v1.3 - ./autogen.sh - CFLAGS="-mmacosx-version-min=10.10 -Werror=unguarded-availability-new" CPPFLAGS="-mmacosx-version-min=10.10 -Werror=unguarded-availability-new" LDFLAGS="-mmacosx-version-min=10.10" ./configure - make $MAKE_THREADS_CNT - sudo make install - cd .. - - cd libiconv-1.15 - CFLAGS="-mmacosx-version-min=10.10 -Werror=unguarded-availability-new" CPPFLAGS="-mmacosx-version-min=10.10 -Werror=unguarded-availability-new" LDFLAGS="-mmacosx-version-min=10.10" ./configure --enable-static - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg - cd ffmpeg - git checkout release/3.4 - CFLAGS=`freetype-config --cflags` - LDFLAGS=`freetype-config --libs` - PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig - - ./configure --prefix=/usr/local \ - --extra-cflags="-mmacosx-version-min=10.10 -Werror=unguarded-availability-new" \ - --extra-cxxflags="-mmacosx-version-min=10.10 -Werror=unguarded-availability-new" \ - --extra-ldflags="-mmacosx-version-min=10.10" \ - --enable-protocol=file --enable-libopus \ - --disable-programs \ - --disable-doc \ - --disable-network \ - --disable-everything \ - --enable-hwaccel=h264_videotoolbox \ - --enable-hwaccel=hevc_videotoolbox \ - --enable-hwaccel=mpeg1_videotoolbox \ - --enable-hwaccel=mpeg2_videotoolbox \ - --enable-hwaccel=mpeg4_videotoolbox \ - --enable-decoder=aac \ - --enable-decoder=aac_at \ - --enable-decoder=aac_fixed \ - --enable-decoder=aac_latm \ - --enable-decoder=aasc \ - --enable-decoder=alac \ - --enable-decoder=alac_at \ - --enable-decoder=flac \ - --enable-decoder=gif \ - --enable-decoder=h264 \ - --enable-decoder=hevc \ - --enable-decoder=mp1 \ - --enable-decoder=mp1float \ - --enable-decoder=mp2 \ - --enable-decoder=mp2float \ - --enable-decoder=mp3 \ - --enable-decoder=mp3adu \ - --enable-decoder=mp3adufloat \ - --enable-decoder=mp3float \ - --enable-decoder=mp3on4 \ - --enable-decoder=mp3on4float \ - --enable-decoder=mpeg4 \ - --enable-decoder=msmpeg4v2 \ - --enable-decoder=msmpeg4v3 \ - --enable-decoder=opus \ - --enable-decoder=pcm_alaw \ - --enable-decoder=pcm_alaw_at \ - --enable-decoder=pcm_f32be \ - --enable-decoder=pcm_f32le \ - --enable-decoder=pcm_f64be \ - --enable-decoder=pcm_f64le \ - --enable-decoder=pcm_lxf \ - --enable-decoder=pcm_mulaw \ - --enable-decoder=pcm_mulaw_at \ - --enable-decoder=pcm_s16be \ - --enable-decoder=pcm_s16be_planar \ - --enable-decoder=pcm_s16le \ - --enable-decoder=pcm_s16le_planar \ - --enable-decoder=pcm_s24be \ - --enable-decoder=pcm_s24daud \ - --enable-decoder=pcm_s24le \ - --enable-decoder=pcm_s24le_planar \ - --enable-decoder=pcm_s32be \ - --enable-decoder=pcm_s32le \ - --enable-decoder=pcm_s32le_planar \ - --enable-decoder=pcm_s64be \ - --enable-decoder=pcm_s64le \ - --enable-decoder=pcm_s8 \ - --enable-decoder=pcm_s8_planar \ - --enable-decoder=pcm_u16be \ - --enable-decoder=pcm_u16le \ - --enable-decoder=pcm_u24be \ - --enable-decoder=pcm_u24le \ - --enable-decoder=pcm_u32be \ - --enable-decoder=pcm_u32le \ - --enable-decoder=pcm_u8 \ - --enable-decoder=pcm_zork \ - --enable-decoder=vorbis \ - --enable-decoder=wavpack \ - --enable-decoder=wmalossless \ - --enable-decoder=wmapro \ - --enable-decoder=wmav1 \ - --enable-decoder=wmav2 \ - --enable-decoder=wmavoice \ - --enable-encoder=libopus \ - --enable-parser=aac \ - --enable-parser=aac_latm \ - --enable-parser=flac \ - --enable-parser=h264 \ - --enable-parser=hevc \ - --enable-parser=mpeg4video \ - --enable-parser=mpegaudio \ - --enable-parser=opus \ - --enable-parser=vorbis \ - --enable-demuxer=aac \ - --enable-demuxer=flac \ - --enable-demuxer=gif \ - --enable-demuxer=h264 \ - --enable-demuxer=hevc \ - --enable-demuxer=m4v \ - --enable-demuxer=mov \ - --enable-demuxer=mp3 \ - --enable-demuxer=ogg \ - --enable-demuxer=wav \ - --enable-muxer=ogg \ - --enable-muxer=opus - - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone git://repo.or.cz/openal-soft.git - cd openal-soft - git checkout v1.19 - cd build - CFLAGS='-Werror=unguarded-availability-new' CPPFLAGS='-Werror=unguarded-availability-new' cmake -D ALSOFT_EXAMPLES=OFF -D LIBTYPE:STRING=STATIC -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.10 .. - make $MAKE_THREADS_CNT - sudo make install - cd ../.. - - git clone https://chromium.googlesource.com/crashpad/crashpad.git - cd crashpad - git checkout feb3aa3923 - git apply ../patches/crashpad.diff - cd third_party/mini_chromium - git clone https://chromium.googlesource.com/chromium/mini_chromium - cd mini_chromium - git checkout 7c5b0c1ab4 - git apply ../../../../patches/mini_chromium.diff - cd ../../gtest - git clone https://chromium.googlesource.com/external/github.com/google/googletest gtest - cd gtest - git checkout d62d6c6556 - cd ../../.. - - build/gyp_crashpad.py -Dmac_deployment_target=10.10 - ninja -C out/Debug - ninja -C out/Release - cd .. - - git clone git://code.qt.io/qt/qt5.git qt5_6_2 - cd qt5_6_2 - perl init-repository --module-subset=qtbase,qtimageformats - git checkout v5.6.2 - git submodule update qtbase qtimageformats - cd qtbase - git apply ../../patches/qtbase_5_6_2.diff - cd .. - - ./configure -prefix "/usr/local/desktop-app/Qt-5.6.2" -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -no-openssl -securetransport -nomake examples -nomake tests -platform macx-clang -I "/usr/local/include" LIBJPEG_LIBS="/usr/local/lib/libjpeg.a" ZLIB_LIBS="/usr/local/lib/libz.a" - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone --recursive https://github.com/desktop-app/tg_owt.git - cd tg_owt - mkdir out - cd out - mkdir Debug - cd Debug - cmake -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DTG_OWT_SPECIAL_TARGET=osx \ - -DTG_OWT_LIBJPEG_INCLUDE_PATH=/usr/local/include \ - -DTG_OWT_OPENSSL_INCLUDE_PATH=`pwd`/../../../openssl_1_1_1/include \ - -DTG_OWT_OPUS_INCLUDE_PATH=/usr/local/include/opus \ - -DTG_OWT_FFMPEG_INCLUDE_PATH=`pwd`/../../../ffmpeg ../.. - ninja - cd .. - mkdir Release - cd Release - cmake -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DTG_OWT_SPECIAL_TARGET=osx \ - -DTG_OWT_LIBJPEG_INCLUDE_PATH=/usr/local/include \ - -DTG_OWT_OPENSSL_INCLUDE_PATH=`pwd`/../../../openssl_1_1_1/include \ - -DTG_OWT_OPUS_INCLUDE_PATH=/usr/local/include/opus \ - -DTG_OWT_FFMPEG_INCLUDE_PATH=`pwd`/../../../ffmpeg ../.. - ninja - cd ../../.. - -### Building the project - -Go to ***BuildPath*/tdesktop/Telegram** and run (using [your **api_id** and **api_hash**](#obtain-your-api-credentials)) - - ./configure.sh -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH -D DESKTOP_APP_USE_PACKAGED=OFF -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF - -Then launch Xcode, open ***BuildPath*/tdesktop/out/Telegram.xcodeproj** and build for Debug / Release. - -[api_credentials]: api_credentials.md diff --git a/docs/building-qmake.md b/docs/building-qmake.md deleted file mode 100644 index 79348b4dd1..0000000000 --- a/docs/building-qmake.md +++ /dev/null @@ -1,137 +0,0 @@ -Building via qmake -================== - -**NB** These are outdated, please refer to [Building using CMake][cmake] instructions. - -The following commands assume the following environment variables are set: - - * `$srcdir`: The directory into which the source has been downloaded and - unpacked. - * `_qtver`: The Qt version being used (eg: `5.6.2`). - * `$pkgdir`: The directory into which installable files are places. This is - `/` for local installations, or can be different directory when preparing a - redistributable package. - -Either set them accordingly, or replace them in the below commands as desired. - -The following sources should be downloaded and unpacked into `$srcdir`: - - * This repository (either `master` or a specific tag). - * `git clone git://code.qt.io/qt/qt5.git` - * `git clone git+https://chromium.googlesource.com/breakpad/breakpad breakpad` - * `git clone git+https://chromium.googlesource.com/linux-syscall-support breakpad-lss` - * telegramdesktop.desktop (The intention is to include this file inside the - source package at some point): - `https://aur.archlinux.org/cgit/aur.git/plain/telegramdesktop.desktop?h=telegram-desktop` - * tg.protocol: `https://aur.archlinux.org/cgit/aur.git/plain/tg.protocol?h=telegram-desktop` - -Preparation ------------ - - cd "$srcdir/tdesktop" - - mkdir -p "$srcdir/Libraries" - - local qt_patch_file="$srcdir/tdesktop/Telegram/Patches/qtbase_${_qtver//./_}.diff" - local qt_dir="$srcdir/Libraries/qt${_qtver//./_}" - if [ "$qt_patch_file" -nt "$qt_dir" ]; then - rm -rf "$qt_dir" - git clone git://code.qt.io/qt/qt5.git - cd "$qt_dir" - perl init-repository --module-subset=qtbase,qtimageformats - git checkout v$_qtver - cd qtimageformats - git checkout v$_qtver - cd ../qtbase - git checkout v$_qtver - git apply "$qt_patch_file" - fi - - if [ ! -h "$srcdir/Libraries/breakpad" ]; then - ln -s "$srcdir/breakpad" "$srcdir/Libraries/breakpad" - ln -s "$srcdir/breakpad-lss" "$srcdir/Libraries/breakpad/src/third_party/lss" - fi - - sed -i 's/CUSTOM_API_ID//g' "$srcdir/tdesktop/Telegram/Telegram.pro" - - ( - echo "DEFINES += TDESKTOP_DISABLE_AUTOUPDATE" - echo "DEFINES += TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME" - ) >> "$srcdir/tdesktop/Telegram/Telegram.pro" - -Building --------- - - - # Build patched Qt - cd "$qtdir" - ./configure -prefix "$srcdir/qt" -release -opensource -confirm-license -qt-zlib \ - -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb \ - -qt-xkbcommon-x11 -no-opengl -no-gtkstyle -static -nomake examples -nomake tests - make module-qtbase module-qtimageformats - make module-qtbase-install_subtargets module-qtimageformats-install_subtargets - - export PATH="$srcdir/qt/bin:$PATH" - - # Build breakpad - cd "$srcdir/Libraries/breakpad" - ./configure - make - - # Build codegen_style - mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_style/Debug" - cd "$srcdir/tdesktop/Linux/obj/codegen_style/Debug" - qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_style/codegen_style.pro - make - - # Build codegen_numbers - mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug" - cd "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug" - qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro - make - - # Build MetaLang - mkdir -p "$srcdir/tdesktop/Linux/DebugIntermediateLang" - cd "$srcdir/tdesktop/Linux/DebugIntermediateLang" - qmake CONFIG+=debug "../../Telegram/MetaLang.pro" - make - - # Build Telegram Desktop - mkdir -p "$srcdir/tdesktop/Linux/ReleaseIntermediate" - cd "$srcdir/tdesktop/Linux/ReleaseIntermediate" - - qmake CONFIG+=release "../../Telegram/Telegram.pro" - make - -Installation ------------- - - - install -dm755 "$pkgdir/usr/bin" - install -m755 "$srcdir/tdesktop/Linux/Release/Telegram" "$pkgdir/usr/bin/telegram-desktop" - - install -d "$pkgdir/usr/share/applications" - install -m644 "$srcdir/telegramdesktop.desktop" "$pkgdir/usr/share/applications/telegramdesktop.desktop" - - install -d "$pkgdir/usr/share/kde4/services" - install -m644 "$srcdir/tg.protocol" "$pkgdir/usr/share/kde4/services/tg.protocol" - - local icon_size icon_dir - for icon_size in 16 32 48 64 128 256 512; do - icon_dir="$pkgdir/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps" - - install -d "$icon_dir" - install -m644 "$srcdir/tdesktop/Telegram/SourceFiles/art/icon${icon_size}.png" "$icon_dir/telegram-desktop.png" - done - -Notes ------ - -These instructions are based on the [ArchLinux package][arch-package] for -telegram-desktop. - -In case these instructions are at some point out of date, the above may serve -as an update reference. - -[arch-package]: https://aur.archlinux.org/packages/telegram-desktop/ -[cmake]: building-cmake.md diff --git a/docs/building-qtcreator.md b/docs/building-qtcreator.md deleted file mode 100644 index 71fe151e17..0000000000 --- a/docs/building-qtcreator.md +++ /dev/null @@ -1,193 +0,0 @@ -## Build instructions for Qt Creator 3.5.1 under Ubuntu 12.04 - -**NB** These are outdated, please refer to [Building using CMake][cmake] instructions. - -### Prepare - -* Install git by command **sudo apt-get install git** in Terminal -* Install g++ by command **sudo apt-get install g++** in Terminal -* Install Qt Creator from [**Downloads page**](https://www.qt.io/download/) - -You need to install g++ version 4.9 manually by such commands - -* sudo add-apt-repository ppa:ubuntu-toolchain-r/test -* sudo apt-get update -* sudo apt-get install gcc-4.9 g++-4.9 -* sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 21 -* sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 21 - -### Prepare folder - -Choose a folder for the future build, for example **/home/user/TBuild** There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app. - -### Clone source code - -By git – in Terminal go to **/home/user/TBuild** and run - - git clone --recursive https://github.com/telegramdesktop/tdesktop.git - -### Prepare libraries - -Install dev libraries - - sudo apt-get install libexif-dev liblzma-dev libz-dev libssl-dev libappindicator-dev libunity-dev - -#### zlib 1.2.8 - -http://www.zlib.net/ > Download [**zlib source code, version 1.2.8, zipfile format**](http://zlib.net/zlib128.zip) - -Extract to **/home/user/TBuild/Libraries** - -##### Building library - -In Terminal go to **/home/user/TBuild/Libraries/zlib-1.2.8** and run: - - ./configure - make - sudo make install - -Install audio libraries - -#### Opus codec - -In Terminal go to **/home/user/TBuild/Libraries** and run - - git clone https://github.com/xiph/opus - cd opus - git checkout v1.2-alpha2 - ./autogen.sh - ./configure - make - sudo make install - -#### FFmpeg - -In Terminal go to **/home/user/TBuild/Libraries** and run - - git clone git://anongit.freedesktop.org/git/libva - cd libva - ./autogen.sh --enable-static - make - sudo make install - cd .. - - git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg - cd ffmpeg - git checkout release/3.2 - - sudo apt-get update - sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texi2html zlib1g-dev - sudo apt-get install yasm - - ./configure --prefix=/usr/local --disable-programs --disable-doc --disable-everything --enable-protocol=file --enable-libopus --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=aasc --enable-decoder=flac --enable-decoder=gif --enable-decoder=h264 --enable-decoder=h264_vdpau --enable-decoder=mp1 --enable-decoder=mp1float --enable-decoder=mp2 --enable-decoder=mp2float --enable-decoder=mp3 --enable-decoder=mp3adu --enable-decoder=mp3adufloat --enable-decoder=mp3float --enable-decoder=mp3on4 --enable-decoder=mp3on4float --enable-decoder=mpeg4 --enable-decoder=mpeg4_vdpau --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=opus --enable-decoder=pcm_alaw --enable-decoder=pcm_alaw_at --enable-decoder=pcm_f32be --enable-decoder=pcm_f32le --enable-decoder=pcm_f64be --enable-decoder=pcm_f64le --enable-decoder=pcm_lxf --enable-decoder=pcm_mulaw --enable-decoder=pcm_mulaw_at --enable-decoder=pcm_s16be --enable-decoder=pcm_s16be_planar --enable-decoder=pcm_s16le --enable-decoder=pcm_s16le_planar --enable-decoder=pcm_s24be --enable-decoder=pcm_s24daud --enable-decoder=pcm_s24le --enable-decoder=pcm_s24le_planar --enable-decoder=pcm_s32be --enable-decoder=pcm_s32le --enable-decoder=pcm_s32le_planar --enable-decoder=pcm_s64be --enable-decoder=pcm_s64le --enable-decoder=pcm_s8 --enable-decoder=pcm_s8_planar --enable-decoder=pcm_u16be --enable-decoder=pcm_u16le --enable-decoder=pcm_u24be --enable-decoder=pcm_u24le --enable-decoder=pcm_u32be --enable-decoder=pcm_u32le --enable-decoder=pcm_u8 --enable-decoder=pcm_zork --enable-decoder=vorbis --enable-decoder=wavpack --enable-decoder=wmalossless --enable-decoder=wmapro --enable-decoder=wmav1 --enable-decoder=wmav2 --enable-decoder=wmavoice --enable-encoder=libopus --enable-hwaccel=h264_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=mpeg4_vaapi --enable-hwaccel=mpeg4_vdpau --enable-parser=aac --enable-parser=aac_latm --enable-parser=flac --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=opus --enable-parser=vorbis --enable-demuxer=aac --enable-demuxer=flac --enable-demuxer=gif --enable-demuxer=h264 --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=ogg --enable-demuxer=wav --enable-muxer=ogg --enable-muxer=opus - - make - sudo make install - -#### PortAudio 19 - -[Download portaudio sources](http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz) from **http://www.portaudio.com/download.html**, extract to **/home/user/TBuild/Libraries**, go to **/home/user/TBuild/Libraries/portaudio** and run - - ./configure - make - sudo make install - -#### OpenAL Soft - -In Terminal go to **/home/user/TBuild/Libraries** and run - - git clone git://repo.or.cz/openal-soft.git - -then go to **/home/user/TBuild/Libraries/openal-soft/build** and run - - sudo apt-get install cmake - cmake -D LIBTYPE:STRING=STATIC .. - make - sudo make install - -#### OpenSSL - -In Terminal go to **/home/user/TBuild/Libraries** and run - - git clone https://github.com/openssl/openssl - cd openssl - git checkout OpenSSL_1_0_1-stable - ./config - make - sudo make install - -#### libxkbcommon (required for Fcitx Qt plugin) - -In Terminal go to **/home/user/TBuild/Libraries** and run - - sudo apt-get install xutils-dev bison python-xcbgen - git clone https://github.com/xkbcommon/libxkbcommon.git - cd libxkbcommon - ./autogen.sh --disable-x11 - make - sudo make install - -#### Qt 5.6.2, slightly patched - -In Terminal go to **/home/user/TBuild/Libraries** and run - - git clone git://code.qt.io/qt/qt5.git qt5_6_2 - cd qt5_6_2 - perl init-repository --module-subset=qtbase,qtimageformats - git checkout v5.6.2 - cd qtimageformats && git checkout v5.6.2 && cd .. - cd qtbase && git checkout v5.6.2 && cd .. - -##### Apply the patch - - cd qtbase && git apply ../../../tdesktop/Telegram/Patches/qtbase_5_6_2.diff && cd .. - -##### Building library - -Install some packages for Qt (see **/home/user/TBuild/Libraries/qt5_6_2/qtbase/src/plugins/platforms/xcb/README**) - - sudo apt-get install libxcb1-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-util0-dev libxrender-dev libasound-dev libpulse-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-randr0-dev libx11-xcb-dev libffi-dev - -In Terminal go to **/home/user/TBuild/Libraries/qt5_6_2** and there run - - ./configure -prefix "/usr/local/tdesktop/Qt-5.6.2" -release -force-debug-info -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -no-gtkstyle -static -openssl-linked -nomake examples -nomake tests - make -j4 - sudo make install - -building (**make** command) will take really long time. - -#### Google Breakpad - -In Terminal go to **/home/user/TBuild/Libraries** and run - - git clone https://chromium.googlesource.com/breakpad/breakpad - git clone https://chromium.googlesource.com/linux-syscall-support breakpad/src/third_party/lss - cd breakpad - ./configure - make - sudo make install - -### Building Telegram codegen utilities - -In Terminal go to **/home/user/TBuild/tdesktop** and run - - mkdir -p Linux/obj/codegen_style/Debug - cd Linux/obj/codegen_style/Debug - /usr/local/tdesktop/Qt-5.6.2/bin/qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_style/codegen_style.pro - make - mkdir -p ../../codegen_numbers/Debug - cd ../../codegen_numbers/Debug - /usr/local/tdesktop/Qt-5.6.2/bin/qmake CONFIG+=debug ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro - make - -### Building Telegram Desktop - -* Launch Qt Creator, all projects will be taken from **/home/user/TBuild/tdesktop/Telegram** -* Tools > Options > Build & Run > Qt Versions tab > Add > File System /usr/local/tdesktop/Qt-5.6.2/bin/qmake > **Qt 5.6.2 (Qt-5.6.2)** > Apply -* Tools > Options > Build & Run > Kits tab > Desktop (default) > change **Qt version** to **Qt 5.6.2 (Qt-5.6.2)** > Apply -* Open MetaLang.pro, configure project with paths **/home/user/TBuild/tdesktop/Linux/DebugIntermediateLang** and **/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateLang** and build for Debug -* Open Telegram.pro, configure project with paths **/home/user/TBuild/tdesktop/Linux/DebugIntermediate** and **/home/user/TBuild/tdesktop/Linux/ReleaseIntermediate** and build for Debug, if GeneratedFiles are not found click **Run qmake** from **Build** menu and try again -* Open Updater.pro, configure project with paths **/home/user/TBuild/tdesktop/Linux/DebugIntermediateUpdater** and **/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateUpdater** and build for Debug -* Release Telegram build will require removing **CUSTOM_API_ID** definition in Telegram.pro project and may require changing paths in **/home/user/TBuild/tdesktop/Telegram/FixMake.sh** or **/home/user/TBuild/tdesktop/Telegram/FixMake32.sh** for static library linking fix, static linking applies only on second Release build (first uses old Makefile) - -[cmake]: building-cmake.md diff --git a/docs/building-msvc-x64.md b/docs/building-win-x64.md similarity index 99% rename from docs/building-msvc-x64.md rename to docs/building-win-x64.md index e6d65c63d8..039a94caa2 100644 --- a/docs/building-msvc-x64.md +++ b/docs/building-win-x64.md @@ -1,4 +1,4 @@ -# Build instructions for Visual Studio 2019 for 64 bit +# Build instructions for Windows 64-bit - [Prepare folder](#prepare-folder) - [Install third party software](#install-third-party-software) diff --git a/docs/building-msvc.md b/docs/building-win.md similarity index 99% rename from docs/building-msvc.md rename to docs/building-win.md index 706d6bc497..df9d177f34 100644 --- a/docs/building-msvc.md +++ b/docs/building-win.md @@ -1,4 +1,4 @@ -# Build instructions for Visual Studio 2019 +# Build instructions for Windows - [Prepare folder](#prepare-folder) - [Install third party software](#install-third-party-software) diff --git a/docs/building-xcode-old.md b/docs/building-xcode-old.md deleted file mode 100644 index a2d88b8844..0000000000 --- a/docs/building-xcode-old.md +++ /dev/null @@ -1,228 +0,0 @@ -## Build instructions for Xcode 10.1 - -**NB** These are outdated, please refer to [Building using Xcode][xcode] instructions. - -### Download libraries - -Download [**libiconv-1.15**](http://www.gnu.org/software/libiconv/#downloading) and unpack to ***BuildPath*/Libraries/macold/libiconv-1.15** - -### Clone source code and prepare libraries - -Go to ***BuildPath*** and run - - MAKE_THREADS_CNT=-j4 - MACOSX_DEPLOYMENT_TARGET=10.6 - - git clone --recursive https://github.com/telegramdesktop/tdesktop.git - - cd Libraries/macold - - git clone https://github.com/llvm/llvm-project.git llvm - cd llvm - git checkout release/7.x - - cd ../../ - mkdir libcxxabi - cd libcxxabi - - LDFLAGS="-isysroot / -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/" cmake -G "Unix Makefiles" -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.6 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/macold -DLLVM_PATH=../llvm -DLIBCXXABI_LIBCXX_PATH=../llvm/libcxx -DLIBCXXABI_LIBCXX_INCLUDES=../llvm/libcxx/include ../llvm/libcxxabi/ - make $MAKE_THREADS_CNT - sudo make install - cd ../ - - mkdir libcxx - cd libcxx - - LDFLAGS="-isysroot / -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/" cmake -G "Unix Makefiles" -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.6 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/macold -DLIBCXX_ENABLE_SHARED:BOOL=NO -DLIBCXX_CXX_ABI:STRING=libstdc++ -DLIBCXX_CXX_ABI_INCLUDE_PATHS="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1/" -DLLVM_PATH=../llvm/ ../llvm/libcxx/ - make $MAKE_THREADS_CNT - sudo make install - cd ../ - - git clone https://github.com/telegramdesktop/zlib.git - cd zlib - prefix=/usr/local/macold CFLAGS="-mmacosx-version-min=10.6" LDFLAGS="-mmacosx-version-min=10.6" ./configure - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone https://github.com/openssl/openssl - cd openssl - git checkout OpenSSL_1_0_1-stable - ./Configure --install_prefix=/usr/local/macold darwin64-x86_64-cc -static -mmacosx-version-min=10.6 - make build_libs $MAKE_THREADS_CNT - cd .. - - git clone https://github.com/xiph/opus - cd opus - git checkout v1.3 - ./autogen.sh - CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6" LDFLAGS="-mmacosx-version-min=10.6" ./configure --prefix=/usr/local/macold - make $MAKE_THREADS_CNT - sudo make install - cd .. - - cd libiconv-1.15 - CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6 -nostdinc++" LDFLAGS="-mmacosx-version-min=10.6" ./configure --enable-static --prefix=/usr/local/macold - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg - cd ffmpeg - git checkout release/3.4 - CFLAGS=`freetype-config --cflags` - LDFLAGS=`freetype-config --libs` - PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig - - ./configure --prefix=/usr/local/macold \ - --extra-cflags="-mmacosx-version-min=10.6" \ - --extra-cxxflags="-mmacosx-version-min=10.6" \ - --extra-ldflags="-mmacosx-version-min=10.6" \ - --enable-protocol=file --enable-libopus \ - --disable-programs \ - --disable-doc \ - --disable-network \ - --disable-everything \ - --enable-decoder=aac \ - --enable-decoder=aac_at \ - --enable-decoder=aac_fixed \ - --enable-decoder=aac_latm \ - --enable-decoder=aasc \ - --enable-decoder=alac \ - --enable-decoder=alac_at \ - --enable-decoder=flac \ - --enable-decoder=gif \ - --enable-decoder=h264 \ - --enable-decoder=hevc \ - --enable-decoder=mp1 \ - --enable-decoder=mp1float \ - --enable-decoder=mp2 \ - --enable-decoder=mp2float \ - --enable-decoder=mp3 \ - --enable-decoder=mp3adu \ - --enable-decoder=mp3adufloat \ - --enable-decoder=mp3float \ - --enable-decoder=mp3on4 \ - --enable-decoder=mp3on4float \ - --enable-decoder=mpeg4 \ - --enable-decoder=msmpeg4v2 \ - --enable-decoder=msmpeg4v3 \ - --enable-decoder=opus \ - --enable-decoder=pcm_alaw \ - --enable-decoder=pcm_alaw_at \ - --enable-decoder=pcm_f32be \ - --enable-decoder=pcm_f32le \ - --enable-decoder=pcm_f64be \ - --enable-decoder=pcm_f64le \ - --enable-decoder=pcm_lxf \ - --enable-decoder=pcm_mulaw \ - --enable-decoder=pcm_mulaw_at \ - --enable-decoder=pcm_s16be \ - --enable-decoder=pcm_s16be_planar \ - --enable-decoder=pcm_s16le \ - --enable-decoder=pcm_s16le_planar \ - --enable-decoder=pcm_s24be \ - --enable-decoder=pcm_s24daud \ - --enable-decoder=pcm_s24le \ - --enable-decoder=pcm_s24le_planar \ - --enable-decoder=pcm_s32be \ - --enable-decoder=pcm_s32le \ - --enable-decoder=pcm_s32le_planar \ - --enable-decoder=pcm_s64be \ - --enable-decoder=pcm_s64le \ - --enable-decoder=pcm_s8 \ - --enable-decoder=pcm_s8_planar \ - --enable-decoder=pcm_u16be \ - --enable-decoder=pcm_u16le \ - --enable-decoder=pcm_u24be \ - --enable-decoder=pcm_u24le \ - --enable-decoder=pcm_u32be \ - --enable-decoder=pcm_u32le \ - --enable-decoder=pcm_u8 \ - --enable-decoder=pcm_zork \ - --enable-decoder=vorbis \ - --enable-decoder=wavpack \ - --enable-decoder=wmalossless \ - --enable-decoder=wmapro \ - --enable-decoder=wmav1 \ - --enable-decoder=wmav2 \ - --enable-decoder=wmavoice \ - --enable-encoder=libopus \ - --enable-parser=aac \ - --enable-parser=aac_latm \ - --enable-parser=flac \ - --enable-parser=h264 \ - --enable-parser=hevc \ - --enable-parser=mpeg4video \ - --enable-parser=mpegaudio \ - --enable-parser=opus \ - --enable-parser=vorbis \ - --enable-demuxer=aac \ - --enable-demuxer=flac \ - --enable-demuxer=gif \ - --enable-demuxer=h264 \ - --enable-demuxer=hevc \ - --enable-demuxer=m4v \ - --enable-demuxer=mov \ - --enable-demuxer=mp3 \ - --enable-demuxer=ogg \ - --enable-demuxer=wav \ - --enable-muxer=ogg \ - --enable-muxer=opus - - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone git://repo.or.cz/openal-soft.git - cd openal-soft - git checkout v1.19 - cd build - LDFLAGS="/usr/local/macold/lib/libc++.a /usr/local/macold/lib/libc++abi.a -isysroot / -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/" cmake -D ALSOFT_EXAMPLES=OFF -D LIBTYPE:STRING=STATIC -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.6 -D CMAKE_INSTALL_PREFIX:STRING=/usr/local/macold .. - make $MAKE_THREADS_CNT - sudo make install - cd ../.. - - git clone https://github.com/telegramdesktop/libexif-0.6.20.git - cd libexif-0.6.20 - CFLAGS="-mmacosx-version-min=10.6" CPPFLAGS="-mmacosx-version-min=10.6 -nostdinc++" LDFLAGS="-mmacosx-version-min=10.6" ./configure --prefix=/usr/local/macold - make $MAKE_THREADS_CNT - sudo make install - cd .. - - git clone https://chromium.googlesource.com/crashpad/crashpad.git - cd crashpad - git checkout feb3aa3923 - git apply ../../../tdesktop/Telegram/Patches/macold/crashpad.diff - cd third_party/mini_chromium - git clone https://chromium.googlesource.com/chromium/mini_chromium - cd mini_chromium - git checkout 7c5b0c1ab4 - git apply ../../../../../../tdesktop/Telegram/Patches/macold/mini_chromium.diff - cd ../../gtest - git clone https://chromium.googlesource.com/external/github.com/google/googletest gtest - cd gtest - git checkout d62d6c6556 - cd ../../../ - - build/gyp_crashpad.py -Dmac_deployment_target=10.6 - ninja -C out/Debug - ninja -C out/Release - cd .. - - CurDir=`pwd` - - git clone git://code.qt.io/qt/qt5.git qt5_3_2 - cd qt5_3_2 - perl init-repository --module-subset=qtbase,qtimageformats - git checkout v5.3.2 - cd qtimageformats && git checkout v5.3.2 && git apply ../../../../tdesktop/Telegram/Patches/macold/qtimageformats_5_3_2.diff && cd .. - cd qtbase && git checkout v5.3.2 && git apply ../../../../tdesktop/Telegram/Patches/macold/qtbase_5_3_2.diff && cd .. - - OPENSSL_LIBS="$CurDir/openssl/libssl.a $CurDir/openssl/libcrypto.a" ./configure -prefix "/usr/local/macold/Qt-5.3.2" -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -openssl-linked -I "$CurDir/openssl/include" -I "/usr/local/macold/include/c++/v1" -no-glib -nomake examples -nomake tests -platform macx-g++ - - make $MAKE_THREADS_CNT - sudo make install - cd .. - -[xcode]: building-xcode.md