qt5-5.9.5.patch 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. --- qtwebengine/src/core/web_engine_context.cpp
  2. +++ qtwebengine/src/core/web_engine_context.cpp
  3. @@ -376,6 +376,13 @@
  4. parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue);
  5. }
  6. + parsedCommandLine->AppendSwitch(switches::kEnableViewport);
  7. +#if defined(Q_OS_WIN)
  8. + parsedCommandLine->AppendSwitch(switches::kDisableGpu);
  9. +#endif
  10. + parsedCommandLine->AppendSwitch(switches::kDisableWebSecurity);
  11. +
  12. +
  13. GLContextHelper::initialize();
  14. const char *glType = 0;
  15. --- qtbase/src/plugins/platforms/cocoa/qnsview.mm
  16. +++ qtbase/src/plugins/platforms/cocoa/qnsview.mm
  17. @@ -584,7 +584,7 @@
  18. return NO;
  19. if ([self isTransparentForUserInput])
  20. return NO;
  21. - return YES;
  22. + return NO;
  23. }
  24. - (NSView *)hitTest:(NSPoint)aPoint
  25. --- qtbase/src/gui/kernel/qsurfaceformat.cpp
  26. +++ qtbase/src/gui/kernel/qsurfaceformat.cpp
  27. @@ -110,6 +110,7 @@
  28. int major;
  29. int minor;
  30. int swapInterval;
  31. + QSurfaceFormat::OrientationFlags orientationFlags;
  32. };
  33. /*!
  34. @@ -736,6 +737,16 @@
  35. return d->swapInterval;
  36. }
  37. +QSurfaceFormat::OrientationFlags QSurfaceFormat::orientationFlags() const
  38. +{
  39. + return d->orientationFlags;
  40. +}
  41. +
  42. +void QSurfaceFormat::setOrientationFlags(QSurfaceFormat::OrientationFlags orientationFlags)
  43. +{
  44. + d->orientationFlags = orientationFlags;
  45. +}
  46. +
  47. Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
  48. /*!
  49. --- qtbase/src/gui/kernel/qsurfaceformat.h
  50. +++ qtbase/src/gui/kernel/qsurfaceformat.h
  51. @@ -57,7 +57,8 @@
  52. StereoBuffers = 0x0001,
  53. DebugContext = 0x0002,
  54. DeprecatedFunctions = 0x0004,
  55. - ResetNotification = 0x0008
  56. + ResetNotification = 0x0008,
  57. + UseOptimalOrientation = 0x0010
  58. };
  59. Q_ENUM(FormatOption)
  60. Q_DECLARE_FLAGS(FormatOptions, FormatOption)
  61. @@ -85,6 +86,11 @@
  62. };
  63. Q_ENUM(OpenGLContextProfile)
  64. + enum OrientationFlag {
  65. + MirrorVertically = 0x0001,
  66. + };
  67. + Q_DECLARE_FLAGS(OrientationFlags, OrientationFlag)
  68. +
  69. QSurfaceFormat();
  70. /*implicit*/ QSurfaceFormat(FormatOptions options);
  71. QSurfaceFormat(const QSurfaceFormat &other);
  72. @@ -145,6 +151,9 @@
  73. int swapInterval() const;
  74. void setSwapInterval(int interval);
  75. + QSurfaceFormat::OrientationFlags orientationFlags() const;
  76. + void setOrientationFlags(QSurfaceFormat::OrientationFlags orientationFlags);
  77. +
  78. static void setDefaultFormat(const QSurfaceFormat &format);
  79. static QSurfaceFormat defaultFormat();
  80. --- qtbase/src/plugins/platforms/windows/qwindowseglcontext.cpp
  81. +++ qtbase/src/plugins/platforms/windows/qwindowseglcontext.cpp
  82. @@ -297,11 +297,25 @@
  83. return new QWindowsEGLContext(this, context->format(), context->shareHandle());
  84. }
  85. -void *QWindowsEGLStaticContext::createWindowSurface(void *nativeWindow, void *nativeConfig, int *err)
  86. +void *QWindowsEGLStaticContext::createWindowSurface(void *nativeWindow, void *nativeConfig, const QSurfaceFormat format, int *err)
  87. {
  88. *err = 0;
  89. +
  90. + std::vector<EGLint> attrib_list;
  91. +#ifdef EGL_ANGLE_surface_orientation
  92. + if (format.testOption(QSurfaceFormat::UseOptimalOrientation)) {
  93. + EGLint surfaceOrientation = 0;
  94. + libEGL.eglGetConfigAttrib(m_display, nativeConfig, EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE, &surfaceOrientation);
  95. + if (surfaceOrientation & EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE) {
  96. + attrib_list.push_back(EGL_SURFACE_ORIENTATION_ANGLE);
  97. + attrib_list.push_back(EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE);
  98. + }
  99. + }
  100. +#endif
  101. + attrib_list.push_back(EGL_NONE);
  102. EGLSurface surface = libEGL.eglCreateWindowSurface(m_display, nativeConfig,
  103. - static_cast<EGLNativeWindowType>(nativeWindow), 0);
  104. + static_cast<EGLNativeWindowType>(nativeWindow),
  105. + &attrib_list[0]);
  106. if (surface == EGL_NO_SURFACE) {
  107. *err = libEGL.eglGetError();
  108. qWarning("%s: Could not create the EGL window surface: 0x%x", __FUNCTION__, *err);
  109. @@ -350,6 +364,14 @@
  110. format.setStereo(false);
  111. format.setSwapInterval(referenceFormat.swapInterval());
  112. +#ifdef EGL_ANGLE_surface_orientation
  113. + if (referenceFormat.testOption(QSurfaceFormat::UseOptimalOrientation)) {
  114. + EGLint surfaceOrientation = 0;
  115. + libEGL.eglGetConfigAttrib(display, config, EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE, &surfaceOrientation);
  116. + format.setOrientationFlags((surfaceOrientation & EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE) ? QSurfaceFormat::MirrorVertically : QSurfaceFormat::OrientationFlags());
  117. + }
  118. +#endif
  119. +
  120. // Clear the EGL error state because some of the above may
  121. // have errored out because the attribute is not applicable
  122. // to the surface type. Such errors don't matter.
  123. @@ -443,7 +465,7 @@
  124. }
  125. }
  126. m_format.setProfile(QSurfaceFormat::NoProfile);
  127. - m_format.setOptions(QSurfaceFormat::FormatOptions());
  128. + m_format.setOptions(m_format.options() & QSurfaceFormat::UseOptimalOrientation);
  129. QWindowsEGLStaticContext::libEGL.eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext);
  130. }
  131. QWindowsEGLStaticContext::libEGL.eglDestroySurface(m_eglDisplay, pbuffer);
  132. --- qtbase/src/plugins/platforms/windows/qwindowseglcontext.h
  133. +++ qtbase/src/plugins/platforms/windows/qwindowseglcontext.h
  134. @@ -121,7 +121,7 @@
  135. void *moduleHandle() const override { return libGLESv2.moduleHandle(); }
  136. QOpenGLContext::OpenGLModuleType moduleType() const override { return QOpenGLContext::LibGLES; }
  137. - void *createWindowSurface(void *nativeWindow, void *nativeConfig, int *err) override;
  138. + void *createWindowSurface(void *nativeWindow, void *nativeConfig, const QSurfaceFormat format, int *err) Q_DECL_OVERRIDE;
  139. void destroyWindowSurface(void *nativeSurface) override;
  140. QSurfaceFormat formatFromConfig(EGLDisplay display, EGLConfig config, const QSurfaceFormat &referenceFormat);
  141. --- qtbase/src/plugins/platforms/windows/qwindowsopenglcontext.h
  142. +++ qtbase/src/plugins/platforms/windows/qwindowsopenglcontext.h
  143. @@ -62,7 +62,7 @@ public:
  144. // If the windowing system interface needs explicitly created window surfaces (like EGL),
  145. // reimplement these.
  146. - virtual void *createWindowSurface(void * /*nativeWindow*/, void * /*nativeConfig*/, int * /*err*/) { return 0; }
  147. + virtual void *createWindowSurface(void * /*nativeWindow*/, void * /*nativeConfig*/, const QSurfaceFormat /*format*/, int * /*err*/) { return 0; }
  148. virtual void destroyWindowSurface(void * /*nativeSurface*/) { }
  149. private:
  150. --- qtbase/src/plugins/platforms/windows/qwindowswindow.cpp
  151. +++ qtbase/src/plugins/platforms/windows/qwindowswindow.cpp
  152. @@ -2414,7 +2414,7 @@
  153. #else
  154. if (!m_surface) {
  155. if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext())
  156. - m_surface = staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig, err);
  157. + m_surface = staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig, m_format, err);
  158. }
  159. return m_surface;
  160. --- qtwebengine/src/core/web_engine_settings.cpp
  161. +++ qtwebengine/src/core/web_engine_settings.cpp
  162. @@ -324,6 +324,8 @@
  163. // Override for now
  164. prefs->touch_enabled = isTouchEventsAPIEnabled();
  165. prefs->device_supports_touch = isTouchScreenAvailable();
  166. + prefs->viewport_meta_enabled = true;
  167. + prefs->shrinks_viewport_contents_to_fit = true;
  168. if (prefs->viewport_enabled) {
  169. // We need to enable the viewport options together as it doesn't really work
  170. // to enable them separately. With viewport-enabled we match Android defaults.
  171. --- qtdeclarative/src/quick/items/qquickwindow.cpp
  172. +++ qtdeclarative/src/quick/items/qquickwindow.cpp
  173. @@ -467,7 +467,13 @@
  174. QRect rect(QPoint(0, 0), devicePixelRatio * size);
  175. renderer->setDeviceRect(rect);
  176. renderer->setViewportRect(rect);
  177. - renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size));
  178. + QRectF projRect(QPoint(0, 0), size);
  179. + bool mirrorVertically = QOpenGLContext::currentContext()->format().orientationFlags() & QSurfaceFormat::MirrorVertically;
  180. + QRectF mirrored(projRect.left(),
  181. + mirrorVertically ? projRect.bottom() : projRect.top(),
  182. + projRect.width(),
  183. + mirrorVertically ? -projRect.height() : projRect.height());
  184. + renderer->setProjectionMatrixToRect(mirrored);
  185. renderer->setDevicePixelRatio(devicePixelRatio);
  186. }
  187. --- qtwebengine/src/3rdparty/chromium/base/memory/shared_memory_mac.cc
  188. +++ qtwebengine/src/3rdparty/chromium/base/memory/shared_memory_mac.cc
  189. @@ -102,7 +102,7 @@ void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
  190. // static
  191. size_t SharedMemory::GetHandleLimit() {
  192. // This should be effectively unlimited on OS X.
  193. - return 10000;
  194. + return std::numeric_limits<int>::max();
  195. }
  196. // static
  197. --- qtwebengine/src/3rdparty/chromium/net/dns/host_resolver_impl.cc
  198. +++ qtwebengine/src/3rdparty/chromium/net/dns/host_resolver_impl.cc
  199. @@ -2043,6 +2043,32 @@
  200. }
  201. }
  202. +static bool ServePlexDirect(const HostCache::Key& key,
  203. + const HostResolver::RequestInfo& info,
  204. + AddressList* addresses)
  205. +{
  206. + if (!EndsWith(info.hostname(), ".plex.direct", base::CompareCase::INSENSITIVE_ASCII))
  207. + return false;
  208. +
  209. + std::string addr_string = info.hostname().substr(0, info.hostname().find('.'));
  210. + base::ReplaceChars(addr_string, "-", ".", &addr_string);
  211. +
  212. + IPAddress ip_address;
  213. + if (!ip_address.AssignFromIPLiteral(addr_string))
  214. + return false;
  215. +
  216. + AddressFamily family = GetAddressFamily(ip_address);
  217. +
  218. + if (key.address_family != ADDRESS_FAMILY_UNSPECIFIED &&
  219. + key.address_family != family) {
  220. + // Don't return IPv6 addresses for IPv4 queries, and vice versa.
  221. + return false;
  222. + }
  223. +
  224. + *addresses = AddressList::CreateFromIPAddress(ip_address, info.port());
  225. + return true;
  226. +}
  227. +
  228. int HostResolverImpl::ResolveHelper(const Key& key,
  229. const RequestInfo& info,
  230. const IPAddress* ip_address,
  231. @@ -2079,6 +2105,11 @@
  232. return OK;
  233. }
  234. + if (ServePlexDirect(key, info, addresses)) {
  235. + MakeNotStale(stale_info);
  236. + return OK;
  237. + }
  238. +
  239. if (ServeLocalhost(key, info, addresses)) {
  240. MakeNotStale(stale_info);
  241. return OK;
  242. --- qtwebengine/src/3rdparty/chromium/cc/trees/layer_tree_settings.cc
  243. +++ qtwebengine/src/3rdparty/chromium/cc/trees/layer_tree_settings.cc
  244. @@ -16,7 +16,7 @@ LayerTreeSettings::LayerTreeSettings()
  245. gpu_memory_policy(64 * 1024 * 1024,
  246. gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
  247. ManagedMemoryPolicy::kDefaultNumResourcesLimit),
  248. - software_memory_policy(128 * 1024 * 1024,
  249. + software_memory_policy(512 * 1024 * 1024,
  250. gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
  251. ManagedMemoryPolicy::kDefaultNumResourcesLimit) {}
  252. --- a/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm
  253. +++ b/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm
  254. @@ -849,10 +849,6 @@ void QCocoaWindow::setVisible(bool visible)
  255. if (m_nsWindow) {
  256. QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
  257. - // setWindowState might have been called while the window was hidden and
  258. - // will not change the NSWindow state in that case. Sync up here:
  259. - applyWindowState(window()->windowState());
  260. -
  261. if (window()->windowState() != Qt::WindowMinimized) {
  262. if ((window()->modality() == Qt::WindowModal
  263. || window()->type() == Qt::Sheet)
  264. @@ -1111,8 +1107,7 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
  265. void QCocoaWindow::setWindowState(Qt::WindowState state)
  266. {
  267. - if (window()->isVisible())
  268. - applyWindowState(state); // Window state set for hidden windows take effect when show() is called
  269. + applyWindowState(state);
  270. }
  271. void QCocoaWindow::setWindowTitle(const QString &title)
  272. @@ -1526,6 +1521,13 @@ void QCocoaWindow::windowDidOrderOffScreen()
  273. void QCocoaWindow::windowDidOrderOnScreen()
  274. {
  275. exposeWindow();
  276. +
  277. + const Qt::WindowState expectedState = window()->windowState();
  278. + if (expectedState == Qt::WindowFullScreen && windowState() != expectedState
  279. + && !isTransitioningToFullScreen())
  280. + applyWindowState(expectedState);
  281. +
  282. + [m_view setNeedsDisplay:YES];
  283. }
  284. void QCocoaWindow::windowDidChangeOcclusionState()
  285. @@ -1993,6 +1993,9 @@
  286. switch (newState) {
  287. case Qt::WindowFullScreen:
  288. + if (!m_nsWindow.visible)
  289. + break; // Defer until window is ordered on screen
  290. +
  291. toggleFullScreen();
  292. break;
  293. case Qt::WindowMaximized: