Commit Graph

41299 Commits

Author SHA1 Message Date
Tor Arne Vestbø
3018c48f32 qmake: Parse -framework link lines the same way the linker does
[ChangeLog][qmake] The syntax 'LIBS += -frameworkFoo', or
'LIBS += "-framework Foo"' is no longer supported. Use the
canonical 'LIBS += -framework Foo' instead.

Change-Id: I50fd02dbfa155a0b95859734486a92bd448e87c2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-04 13:09:26 +00:00
Tor Arne Vestbø
d3be61d965 Fix unused function warning for prefixFromQtCoreLibraryHelper
Change-Id: Iedbe0e9363b6bd97071b38aa1d4546777b34139d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-04 13:09:24 +00:00
David Faure
91a869671e CMake: generate moc files for headers using Q_NAMESPACE_EXPORT too
Commit f66c1db16c introduced Q_NAMESPACE_EXPORT and cmake automoc
needs to be told to trigger moc creation for headers using that.

The default value for this variable, from cmake's
Modules/CMakeGenericSystem.cmake is
  set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE")
But it makes more sense to set this here than in upstream cmake, anyway,
given that changes to this list happen here in qtbase.

Change-Id: I07c85fd0bb5e03e98df7687a8663e28620e1fdb6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-04 15:03:53 +02:00
Tor Arne Vestbø
bb65ac8097 Modernize QWindowSystemInterface::handleCloseEvent
The base WindowSystemEvent has had an eventAccepted flag since 2014.

Change-Id: Ia0aa795083cd98ece83a4c1cc010d3a25e2489fd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-10-04 14:59:52 +02:00
Kavindra Palaraja
9a9bdebb92 docs: Mark QPair and QLatin1Char as reentrant
Change-Id: I7d37eb13809a6fa4d1c2c74fd8aea35bdf235996
Fixes: QTBUG-78552
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-10-04 14:47:59 +02:00
Robert Loehning
de182ea0be Add libfuzzer test for QTextDocument::setMarkdown()
Change-Id: I729d4a3bb276523011a6f17a800e72aa34540e47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-10-04 14:47:59 +02:00
Albert Astals Cid
3afe4a402c Convert a few sizeof(array)/sizeof(element0) fors to range fors
Increases readability

Change-Id: I81ea915517fd2cd6bc2780f37ba8d8097c63f44b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-10-04 09:00:24 +02:00
Qt Forward Merge Bot
74a33df026 Merge "Merge remote-tracking branch 'origin/5.13' into 5.14" 2019-10-04 01:01:43 +02:00
Qt Forward Merge Bot
e9f10dfe8c Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: I31c1c469c00016f1bd21ecfab39794df372e56f2
2019-10-04 01:01:31 +02:00
Joerg Bornemann
5ab8efd66a Make conflicting targets check less strict
People tend to "turn off debug and release builds" by just not building
one of the variants. For example, Qt's own rcc is built in release only,
however it is configured for debug_and_release with the same TARGET for
both.

Let qmake complain about conflicting TARGETs only we're about to build
all of those conflicting targets, i.e. if build_all is set.

Change-Id: I0448bf5cb421e2d801d3cc30e0d80353fba0d999
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-10-03 20:28:03 +02:00
Joerg Bornemann
ce5dc31932 Fix needless resolution of -l LIBS entries on Windows
Do not resolve -l entries to absolute file paths for libraries in the
default search paths.

This restores behavior from 5.12.0 (commit 2327944d) for Windows
system libraries.

Fixes: QTBUG-78827
Change-Id: Ic2d4626df87308dd635afc1ab5c4b8191d3d2831
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-10-03 20:27:48 +02:00
Shawn Rutledge
85f9fa7fab Stop using QTime as a timer in QIBaseDriver::close()
This is probably still the wrong thing to do here, though.

Change-Id: I4ff76393dde0b9ad9eb4a5e0d35fb6125d141901
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-10-03 18:09:40 +02:00
Thiago Macieira
9328058071 Fix crash when running QtCore: Stack is misaligned on x86-64
When our ELF entry point function is started by the kernel, the stack is
aligned at 16 bytes. However, the stack is expected to be off by 8, due
to a preceding CALL instruction which didn't exist. This cauases a crash
further down as the compiler may generate aligned stack access.

Change-Id: I1496b069cc534f1a838dfffd15c9dc4ef9e3869e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-10-03 08:26:51 -07:00
Simon Hausmann
dcecaeb7b9 Prospective fix to stabilize tst_qwindow::isActive() on Windows 10
It is conceivable that during the try-compare loop of processing
windowing system events we loose and regain the focus. That would
explain the occasional test failure where instead of the expected 3
focus in events, we have received four.

Task-number: QTBUG-77769
Change-Id: I2221440d09a74d4d18a72f7786232b4491cf45a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 56f084781e)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-10-03 15:09:16 +00:00
Edward Welbourne
d448f2ecb8 Correct handling of -qfloat16(0)
It is finite and normal; it classifies as a zero; and it should not be > qfloat16(0).
Added tests to match.

Change-Id: I7874fb54f622b4cdf28b0894050ad3e75cf5d77c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-03 16:30:40 +02:00
Christian Ehrlicher
a978d21dac PSQL: don't recreate QSqlField in loop in QPSQLResult::record()
Move out the QSqlField variable out of the loop to avoid useless
(de)allocations of QSqlField.

Change-Id: I2c9e4c84f75e994d5eb1438839d502f6da531841
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-10-03 13:15:47 +02:00
Christian Ehrlicher
dabc33bf95 QPainter: don't print deprecated warnings for HighQualityAntialiasing
Add pragmas to not print warnings about the usage of the deprecated
warnings inside QtCore.

Change-Id: I2cd9f111cdf13cddff527ab3bac7fa80417d1445
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-10-03 13:15:47 +02:00
Christian Ehrlicher
26d626436b Widgets flowlayout example: Fix crash on startup
The flowlayout example crashes on startup because the last change
removed a c-style cast which converted -1 to ~0U ...

Fixes: QTBUG-78861
Change-Id: I0dbed4472b4f68a92b3f92763d00d28baa186f9a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-03 13:15:47 +02:00
Andy Shaw
5aa13ea144 QTreeWidget: Don't assume the selected indexes include the first column
If the first column is hidden in a QTreeWidget then when doing a drag
then the selected indexes will not include any that have a column of 0.
Therefore it has to account for this use std::unique to ensure that
there is only one instance of the selected items represented by the
selected indexes.

Fixes: QTBUG-35511
Change-Id: I39dff596959f30db7378ff946735ee2866778524
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-10-03 12:51:53 +02:00
Tor Arne Vestbø
74abe98320 qmake: Place prl files under Resources in framework bundles
The root of the framework bundle shouldn't contain random files,
and doing so will prevent the bundle from being signable.

We still look up prl files in the root, to keep backwards
compatibility.

Change-Id: Ifd0bc3c6e7924e89eec54d3ef9368dfc95ed402c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-03 11:11:20 +02:00
Tor Arne Vestbø
c9478e90ff Export lcEventDispatcher in private namespace
The category is used outside of QtCore, and needs to be exported
for shared library builds.

Change-Id: I9bba477d37b823146eaec4e1e53197651f09c013
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-03 09:11:18 +00:00
Edward Welbourne
b4efdd3769 Reorganise the qfloat16 auto-test
Its limits() test was rather large and had some overlap with an older
qNan() test, that needed some clean-up (it combined qfloat16 values
with double and float values in ways that caused qfloat16 to be
promoted to another type, so we weren't testing qfloat16).

Renamed the qNan() test to qNaN(), separated out the parts of it that
actually tested infinity. Moved various parts of limits() to these and
rationalised the result. Split out a properties() test from limits()
for the properties of the qfloat16 type that are supplied by its
numeric_limits. Split out a data-driven finite() test to cover some
repeated code that was in limits() and extended it to test more
values. Added more tests of isNormal().

Fixed my earlier UK-ish spelling of "optimise", in the process, and
identify the processor rather than the virtualization as the context
where the compiler errs.

Change-Id: I8133da6fb7995ee20e5802c6357d611c8c0cba73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-03 11:09:47 +02:00
Paul Olav Tvete
2e068c7f2a Add TriangleFan pipeline topology
Triangle fan drawing is only supported on some platforms. The feature
flag QRhi::TriangleFanTopology is set accordingly.

In general, TriangleStrip topology will be more efficient on most GPUs.
However, if polygon data is already stored as triangle fans, the CPU
savings may be more significant.

Change-Id: I9704fad751d2119eac8791074f58942dd9315601
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-10-03 09:38:32 +02:00
Laszlo Agocs
5bc972a411 rhi: vulkan: Disable vkmemalloc's own synchronization
No need for those mutexes.

Task-number: QTBUG-78908
Change-Id: I60c32df1f8729098f1894eff7c71e7fbcbd23ecf
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-10-03 09:38:01 +02:00
Laszlo Agocs
f1c7814a55 rhi: Remove QVectors from the data description structs as well
As usual, keep some QVector overloads around to allow Qt Quick to compile.

Color attachments and vertex input bindings get an at(index) type of
accessor, unlike any other of similar lists. This is because there the
index is significant, and sequential iteration is not the only type of
operation that is performed. Sometimes a lookup based on an index will
be needed as well.

Task-number: QTBUG-78883
Change-Id: I3882941f09e94ee2f179e0e9b8161551f0d5dae7
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-03 09:37:48 +02:00
Mårten Nordheim
1a8f4a3c8f GSSAPI: strengthen configure test and make it a library
This way we can actually filter out times in sitatuations where it
proved to not be available and as a library we can simply "use" it.

Added in the pkgConfig source as well to make sure we can pick it up
on systems where it has a different name.

Fixes: QTBUG-78765
Change-Id: I4754923ddafd9274105e4f93d66a4039872e310c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: André Klitzing <aklitzing@gmail.com>
2019-10-03 08:55:01 +02:00
Andy Shaw
7d73d4b9a9 Remove the unregistered recognizer from the main list
This amends 1320b2f644 to keep the
behavior of removing from the main list but without re-introducing the
memory leak.

Fixes: QTBUG-77770
Change-Id: I91fa6cb71fab8d60baa35417fdb34322af11dbbb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-10-03 05:43:51 +00:00
Shawn Rutledge
ad86c2f0ab Quiet several more warnings about QWheelEvent deprecations
We want to ensure that the qt4D and qt4O members are still initialized
the same way whenever deprecated constructors are used; and we want to
be able to verify it using qDebug.  So we merely suppress these
warnings.

Change-Id: Ic2e5f0dd6feeabe81f06f9c31693c550ac0781e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-02 23:11:09 +02:00
BogDan Vatra
c8b07f7da3 Android: Do not extract QML assets data
Instead to extract the assets QML file, we create a .rcc bundle file
which is register by android qpa plugin before the it invokes the main
function. Thsi way we avoid extracting the QML files from assets as they
can be accessed directly from resources.

[ChangeLog][Android] Instead of bundling QML resources in assets
and extracting them on first start, Qt now creates an .rcc file
and register it before invoking the main function.

Change-Id: Icb2fda79d82c5af102cc9a0276ff26bb0d1599e8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-10-02 15:00:35 +00:00
BogDan Vatra
fb09a8bfcf Android: rework assets support
The new version fix QDirIterators and it lists all the files and dirs.

Change-Id: I5a30eedb61ab2397a84365d00f308cda0c194de2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-10-02 18:00:29 +03:00
Andy Shaw
e02293a76d Always update the pressed position when pressing on an item
If there is an item already selected then the pressed position needs to
be updated regardless when selecting a new one even if it is not made
current as this will be used to determine the drag distance.
Otherwise it will start a drag within one pixel of moving due to the
fact it is doing it relative to the first item to be pressed rather than
the last.

Fixes: QTBUG-78797
Change-Id: I853041b278b2e92ccf20660f7ced945fef72527a
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-10-02 14:14:08 +02:00
Edward Welbourne
2d8b80bb9c QList: make cast from ptrdiff_t to int explicit
Amends ffc2d57223.

Fixes: QTBUG-78235
Change-Id: Ie91d8d71c92bb62e3268847407b7b252c382d700
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-10-02 08:38:31 +00:00
Rolf Eike Beer
72d62144ab tslib plugin: remove debug print on old tslib versions
This introduces a dependency on ts_get_eventpath(), which is only
available in tslib 1.15 and newer. This raises the required version to
an unneeded level, so just drop the debug message if the API is not
available.

Change-Id: I4a1cd7abec8d139e70555506d9d21edacf0f4d71
Fixes: QTBUG-78867
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>
2019-10-01 10:36:24 +02:00
Andy Shaw
beff780506 Android: Turn off rpath support as the platform does not support it
Fixes: QTBUG-57909
Change-Id: I3ffe8ad25b97c6d29ea925707a3878d0e47ec9ac
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-10-01 10:36:24 +02:00
BogDan Vatra
fcb78b5000 Android: Fix plugins naming
Android 5 doesn't extract the files from libs folder unless they are prefixed with "lib".
This patch sets a proper name for the plugin which will make gdb happy and it will also
avoid any name clashes.
If we rename the plugins when we copy them, gdb won't find them, therefore it can't load their
symbols.
On Android all the libs are in a single folder, so to make sure we don't have any name clashes,
we are prefixing the plugin name with it's relative path to qt folder (we replace / with _).

Fixes: QTBUG-78616
Change-Id: I7e0e67d65448532769d69f46b1856c029e2cf5cb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-10-01 11:36:24 +03:00
Laszlo Agocs
9e59024bf8 rhi: Speed up buffer and texture tracking
Task-number: QTBUG-78862
Change-Id: If278bd55530081cbbdbab8dd6e14d86e28da558e
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-30 20:07:53 +02:00
Laszlo Agocs
7000b66f7e Remove QVector in the API of QRhiResource subclasses
Forcing users to go through a QVector, when in practice they almost
always want to source the data from an initializer list, a QVarLengthArray,
or a plain C array, is not ideal. Especially since we can reason about
the maximum number of elements in the vast majority of use cases for all
the affected lists. QRhiResource is also not copyable so we do not need
the usual machinery offered by containers. So switch to a
QVarLengthArray.

Note that a resource is not a container. The only operations we are
interested in is to be able to source data either via an initializer
list or by iterating on something, and to be able to extract the data,
in case a user wishes to set up another resource based on the existing
one.

In some cases a QVector overload is kept for source compatibility with
other modules (Qt Quick). These may be removed in the future.

Also do a similar QVector->QVarLengthArray change in the srb-related
data in the backends.

Change-Id: I6f5b2ebd8e75416ce0cca0817bb529446a4cb664
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-30 20:07:43 +02:00
Laszlo Agocs
d4c17725ab De-d-pointer QRhiShaderResourceBinding
Sad to see this go since the d pointer pattern with implicit sharing
would have been perfect for this class, had this been a public API.

However, as binary compatibility will not be a concern for QRhi classes,
it is wasteful to allocate memory on every QRhiShaderResourceBinding.
This allows users, such as Qt Quick, to use QRhiShaderResourceBinding as
a cheap, simple, value class, without having to invent their own
alternatives in performance critical places.

The change brings a not insignficant improvement in certain qmlbench scenes
(the ones with thousands of unbatched geometry nodes).

Change-Id: I6d1dced6498d9ad625f90ead78bc0a417ea99ed8
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-30 20:07:36 +02:00
Laszlo Agocs
e1ed2c3864 Share and enable shader disk cache in QRhi OpenGL backend
The expectation for it is to function identically to what we get with
QOpenGLShaderProgram. (same environment variables, same logging
categories, etc.).

QOpenGLProgramBinaryCache is now shared between the QOpenGL convenience
classes (like QOpenGLShaderProgram) and QRhi. To achieve more modularity
and to prepare for QOpenGLShaderProgram and friends moving out of QtGui,
this class cannot depend on QOpenGLShader* anymore. This involves adding
some minor conversions between QRhi and QOpenGL enums for example.

Change-Id: I2f4664e074823ea536281aea8006a6db159a7381
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-30 20:07:28 +02:00
Liang Qi
6f9a215cc4 Merge "Merge remote-tracking branch 'origin/5.13' into 5.14" 2019-09-30 20:07:25 +02:00
Edward Welbourne
4bd6cd1992 Featurize support for signaling NaN
One of our compilers for emscripten coerces all signaling NaNs to
quiet ones, so won't do any actual signaling. Anyone relying on them
to do so shall be disappointed, so it's better that they know about it
at compile-time - or, at least, have the ability to find it out.

Put the signaling NaN producers (and remaining (test) code using them)
under the control of a feature that's disabled when numeric_limits
claims double has no signaling NaN. Assume the bootstrap library
doesn't need signaling NaNs. Sadly, until C++20 <bit>, there's no
contexpr way to test that alleged signalling and quiet NaNs are
actually distinct.

Added some auto-tests for signaling NaN, including that it's distinct
from quiet NaN. Any platform on which the last fails should disable
this feature.

Task-number: QTBUG-77967
Change-Id: I57e9d14bfe276732cd313887adc9acc354d88f08
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-09-30 20:05:42 +02:00
Liang Qi
99cdd5fc67 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/corelib/global/qrandom.cpp
	src/corelib/io/qfileinfo.cpp
	src/corelib/kernel/qeventdispatcher_win.cpp
	src/corelib/kernel/qeventdispatcher_win_p.h
	src/gui/text/qfontdatabase.cpp
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
	src/plugins/platforms/windows/qwindowsglcontext.cpp
	src/testlib/qtestcase.cpp

Done-With: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Done-With: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I4893212471aa24be804c989a581810e2f714545c
2019-09-30 14:43:02 +02:00
Laszlo Agocs
86876744f0 Ensure drawable size atomicity within a frame
Revert surfacePixelSize() to be a getter only. With Metal this will
mean returning the "live" layer size (and so not the
layer.drawableSize), which is in line with what we expect with other
backends.

Instead, we leave it to the swapchain's buildOrResize() to "commit"
the size by setting drawableSize on the layer. With typical
application or Qt Quick logic this ensures that layer.drawableSize is
set once and stays static until we get to process the next resize - on
the rendering thread.

This of course would still mean that there was a race when a client
queries surfacePixelSize() to set the depth-stencil buffer size that
is associated with a swapchain. (because that must happen before
calling buildOrResize() according to the current semantics)

That can however be solved in a quite elegant way, it turns out,
because we already have a flag that indicates if a QRhiRenderBuffer is
used in combination with (and only in combination with) a
swapchain. If we simply say that setting the UsedWithSwapChainOnly
flag provides automatic sizing as well (so no setPixelSize() call is
needed), clients can simply get rid of the problematic
surfacePixelSize() query and everything works.

Task-number: QTBUG-78641
Change-Id: Ib1bfc9ef8531bcce033d1f1e5d4d5b4984d6d69f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-29 22:16:55 +02:00
Laszlo Agocs
08a601035c rhi: gl: Remove fake uniform buffer offset alignment requirement
Change-Id: I5408e53f90c1c19836c400659bac15a8690c6ae8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-09-28 22:13:14 +00:00
Laszlo Agocs
cd5a0bc735 rhi: Always enable debug info printing from manual tests
It can be important to see for example the adapter enumeration that is
printed when qt.rhi.general is enabled. Make it enabled by default in
the tests.

Change-Id: I7bd073781e176d9b17b5386c548e9f8a2e16c10f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-29 00:12:53 +02:00
Laszlo Agocs
46201f0e82 QVarLengthArray: Avoid int vs. size_t warnings in operator=
Change-Id: I879b62c55e4211d3e4e1a18f6699f26e3f5de1f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-29 00:11:42 +02:00
Tor Arne Vestbø
72dd9de283 macOS: Avoid automatic resizing of layers by fixing them to top-left
When a layer is resized, e.g. during a window resize, the contents of
the layer may lag behind if the client doesn't fill the layer in
response to the window resize and corresponding expose event.

The default behavior is for Core Animation to stretch the content
to fill the layer, but this results in the content "jumping" back
and forth when the content then picks up the new size and fills
the layer.

Instead we tell Core Animation to fix the content to the top left
corner. If a layer is sized up without a corresponding layer contents
update this will result in missing/transparent pixels in the bottom
or right part of the layer, explicitly showing what the result of
the missing paint is. During debugging we also highlight this area
by adding a magenta background color to the layer.

Conversely, if the layer is sized down we don't need to resize it,
we can just keep the fixed top left position, and the content will
stay in place during the resize. This allows for optimizations
during window resizing, where we don't need to allocate new
buffers if the old buffer is larger than the new one.

Change-Id: I265b57e3a0ddff8bbcda3af5d670cd8c3b00b181
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-28 15:35:14 +00:00
Tor Arne Vestbø
4fade3c3b8 macOS: Resolve layer contents scale based on DPR
Change-Id: I32de4610a2aebbc7e0adcad9bb3440683cae5906
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-09-28 11:00:06 +02:00
Tor Arne Vestbø
cefd214b1b macOS: Improve layer delegate setup
We should detect the cases where there's already a delegate, and
setting up the delegate before the layer is added makes sense.

Change-Id: I67896cbc96d11ce9a3826fd8aa0e5e104a83a21c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-09-28 11:00:02 +02:00
Tor Arne Vestbø
fd49d5e315 macOS: Flesh out and clarify layer setup
Change-Id: I10d972254c02de8789e64c8503861d51764a1633
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-09-28 10:59:58 +02:00