Commit Graph

31445 Commits

Author SHA1 Message Date
Marc Mutz
494ee2aa8d QThreadPool: supersede cancel() with tryTake()
The cancel() function added in 5b11e43e for Qt 5.5 suffers from a
number of problems:

First, if runnable->autoDelete() is true, then the function suffers
from the ABA problem (see documentation written for trytake()).

Second, if runnable->autoDelete() is false, due to cancel() throwing
away crucial information instead of returning it, the caller cannot
know whether the runnable was canceled (and thus has to be deleted),
wasn't found or is currently executing (and thus mustn't be deleted),
or has finished executing (and can be used to extract the result).

Deprecate this dangerous API and replace it with the much more useful
Private::stealRunnable(), promoted to public API and renamed to
tryTake() for consistency with the rest of Qt.

Described the various caveats in the function's documentation.

[ChangeLog][QtCore][QThreadPool] The cancel() function suffers from
several subtle issues and has been replaced with a new tryTake()
function.

Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-22 16:37:07 +00:00
Allan Sandfeld Jensen
beaf33983e Fix wrong access to qMemRotateFunctions
Since this table was restructured in 7c401397a4 and changed to
being indexed bitwidth and not format, NEON-enabled builds have
been writing to an undefined place after the table.

Discovered by compiler warnings on CI.

Change-Id: I109cd19a8dd703bdafdf13afd3f96ebeaa0e6de5
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-02-22 14:36:56 +00:00
Marc Mutz
7c647edae9 QTypeInfo: don't treat enums and (extended) integral types as complex
We fully specialize QTypeInfo for most C++ built-in types,
but enums and extended integral types (like GCC's int128_t)
were not covered.

Now that we depend on <type_traits>, we can stop pessimizing
enums and extended integral types in QVector and QVLA by
defaulting QTypeInfo::isComplex to true for such types.

Fix a test that checked that enums were complex types. This should
have been a XFAIL test. Enums are not complex types.

Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-22 09:21:57 +00:00
Marc Mutz
19085350fb Do not use QTypeInfo::isStatic anymore
... except in QList.

When dafa3618 introduced isRelocatable and QTypeInfoQuery, the
intention was to decouple the memory layout of QList from the
reallocation optimizations in QVector. This never happened, as
QVector (and QVarLengthArray) continue to use isStatic to this
day.

Fix by porting both QVector and QVLA to QTypeInfoQuery and
isRelocatable.

Change-Id: I6951f2cf21f0cbb24e2dbd38f80f1bd82007d394
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 08:04:12 +00:00
Marc Mutz
4df229ce50 QArrayDataOps: don't use value-initialization
... but default-initialization instead.

This bug may have rendered the diverse Qt::Uninitialized ctors
we have in Qt containers ineffective.

Change-Id: I5a369fa8527f19b6f8cc1a9f36512f6a0058839a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 08:03:46 +00:00
Tor Arne Vestbø
53c0568924 macOS: Make sure NSResizableWindowMask is set when toggling fullscreen
Instead of setting the mask in toggleFullScreen(), which is only hit
when going to fullscreen via our own API, we do it in the window
notification callbacks, which also includes going to full screen via
the native macOS title bar buttons. This allows making customized
windows without Qt::WindowMaximizeButtonHint full screen with the
full geometry of the screen.

Change-Id: I63c3e4582ea7c4fe8c0008265793c5f656b830b2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-22 07:58:20 +00:00
Marc Mutz
adca47cbc1 QTzTimeZonePrivate: introduce PosixZone class
... as a replacement for QPair<QString, int>, and move some
repsonsibilities into it.

This avoids the repeated use of the magic number INT_MIN to indicate
absence of an offset and does away with the confusing .first and
.second, replacing them instead with proper names, .name and .offset.

Change-Id: I0f6906467b8efa16bed2bf5677f2bbbd534da1ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:58:19 +00:00
Tor Arne Vestbø
c585802e94 QWindow: Remove "_q_foreignWinId" dynamic property
The platform plugins reading this out of the QWindow was a layering
violation, and propagates the notion that a window can shape shift
into representing a new native handle, while none of the platform
plugins support this.

A foreign QWindow is created via the factory function fromWinId(),
at which point we can pass the WId all the way to the platform
plugin as function arguments, where the platform will create a
corresponding platform-window.

The platform window can then answer the question of whether or
not it's representing a foreign window, which determines a few
behavioral changes here and there, as well as supplying the
native window handle back for QWindow::winId();

[ChangeLog][QtGui][QWindow] The "_q_foreignWinId" dynamic property
is no longer set nor read.

[ChangeLog][QtGui][QPA] The function createForeignWindow() has been
added to QPlatormIntegration and is now responsible for creating
foreign windows. The function isForeignWindow() in QPlatformWindow
has been added, and platforms should implement this to return true
for windows created by createForeignWindow().

Task-number: QTBUG-58383
Change-Id: If84142f95172f62b9377eb5d2a4d792cad36010b
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-02-22 07:58:07 +00:00
Olivier Goffart
5426e689f9 Fix a race condition between QObject::connect and qRegisterMetaType
QObject::connect will extract the QArgumentType for first the signal,
then the slot. The QArgumentType with a string constructor will query
the metatype system to get the meta type id. But it might happen that
between the extraction of the signal's argument and the slot's argument,
qRegisterMetaType was called in another thread. For this reason, it's
possible that one QArgumentType has a type id while the other does not.
For this reason, we should fall back to compare the string if any of
the argument's type is 0.

Task-number: QTBUG-50901
Change-Id: I260ca662ff00a773ae519f78bb633e05fde0ea81
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:37:51 +00:00
Marc Mutz
7de8745eaa QSizePolicy: add C++14-style constexpr where possible
This is straight-forward, since, unlike with transposed(), we can
assume that every compiler that supports C++14 constexpr also supports
C++11 uniform initialization. For Clang and GCC, this is clear. For
MSVC, we might need to reconsider this, as, according to
qcompilerdetection.h, 2015 still does not support uniform
initialization (but not C++14 constexpr, either), and we don't know
what 2017 will support.

Change-Id: Idac7aa929d275645478a926896dca0dff166e114
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:12:25 +00:00
Marc Mutz
e0a9a0e217 QArrayDataOps: do not use QTypeInfo::isStatic anymore
These days, QTypeInfoQuery and isRelocatable should be used.

Change-Id: Ieac2d7fcef6b1d5466b14bbd1066901d6e751a55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:12:13 +00:00
Tor Arne Vestbø
3b38392844 testlib: Add qWaitFor to wait for predicate
Reduces duplication of logic and allows other primitives to be
built on top.

Change-Id: Ia100014cfb0c09ac2f47c3a156d0c76f0fddafa8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-02-21 14:32:28 +00:00
Marc Mutz
22a88dce03 QErrorMessage: handle all message types
The perils of adding a default: case to a switch over an enum type:
the compiler no longer warns when the enum is extended.

Provide strings for QtCriticalMsg and QtInfoMsg, too.

[ChangeLog][QtWidgets][QErrorMessage] No longer displays critical
(QtCriticalMsg) and informational (QtInfoMsg) messages as if they were
debug (QtDebugMsg) ones.

Change-Id: Id6776081be736ad92423ec016988dcd92a963cc7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-21 09:49:05 +00:00
Tor Arne Vestbø
2fbe54472e macOS: Retain foreign windows
Regression after 89842b97d7, where the retain was part of setView.

We release m_view in the destructor, regardless of how the view was
acquired, and the non-foreign window retains by being the one creating
the view.

Task-number: QTBUG-59001
Change-Id: I6d9621a63ea6ec2cee008986b0ab72ff61110ad7
Reviewed-by: René J.V. Bertin <rjvbertin@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-20 13:56:12 +00:00
Tor Arne Vestbø
3e5d5852dd windowflags: Update preview info when window state changes
Change-Id: I072939cdff0bd58779d9c163cb23e8176f3bc84a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-20 14:19:47 +00:00
Marc Mutz
8d1fc3ca4d QtGui: port the last remaining Q_FOREACH loops and add QT_NO_FOREACH
Port the last two remaining Q_FOREACH users in QtGui
to C++11 range-for and mark the library as Q_FOREACH
-free, using QT_NO_FOREACH.

Change-Id: Ie6c5eea0af4227af6ef3dc0b4da2cf62e09d8b52
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-02-20 13:51:40 +00:00
Olivier Goffart
f3a4b4258f QWidget: update the font when the screen is changed
The screen may change the dpi so the font dpi is also changed.
We must tell QWidget that the font has changed by sending the
FontChanged event to all sub widgets so they can update their
geometry.

Task-number: QTBUG-48242
Change-Id: Ibcdcc0c96429b8cd16311928298294f47a23e816
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-20 12:48:34 +00:00
Paul Olav Tvete
7057b19b89 Only define "accessibility" feature once
The "accessibility" feature was defined globally for qtbase, but also
in src/gui. The definitions could end up with different values.

Change-Id: I1a932c3c04a5fc26b9f67eb4f5ff02e524f380e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-20 08:30:07 +00:00
Tor Arne Vestbø
5f80a7956e windowflags: Improve compound states handling
Change-Id: Iab5df40b69cf9c0e11f0e495a6b27af9c05fbd94
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-19 23:36:29 +00:00
Marc Mutz
9965e92e4f Make better use of new QStringList::join(QLatin1String) overload
It was added in Qt 5.8.

Change-Id: I7194fbfaef9219110604f3b03a893a658c996c06
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-19 08:46:00 +00:00
David Faure
cfe1a295fc qeglfskmsegldevicescreen.cpp: add errno.h include
Compilation failed with clang 3.9.1:
qeglfskmsegldevicescreen.cpp:104:27: error: use of undeclared identifier 'errno'
            qErrnoWarning(errno, "drmModeSetCrtc failed");

Change-Id: I7cf08494359092b9cdac10bb013ac56c3ddf5597
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-02-18 10:53:18 +00:00
Jarkko Koivikko
b07f71a53f Widgets: Update micro focus in QLineEdit and friends
QLineEdit, QAbstractSpinBox and QComboBox did not notify micro focus
changes to the input context.

In particular, the updates were missed during pre-edit stage.

This change adds the missing bindings to QWidget::updateMicroFocus().

Change-Id: I9a7fff962f46dbabd8fb02836c206bace115793b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-02-17 17:09:50 +00:00
Frederik Schwarzer
07745d7bfb Fix typo in apidoc.
Change-Id: Ibd71c1ed653769637aa176dfb52c4594141be8ce
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-02-17 16:47:21 +00:00
Paul Olav Tvete
d995f0fe09 Build fix for new feature -qt-no-processenvironment
Change-Id: I6d1c5d122761d239d96b943a9abf7af12195a3eb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-17 14:41:34 +00:00
Paul Olav Tvete
983ffeb9ff Build fix for -no-feature-datestring
Change-Id: I09c7bc360956aef44f4137a093b6329a08a099ee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-17 14:41:19 +00:00
Dmitry Kazakov
abc79baa70 xcb: support graphics tablets with the "uc-logic" name
Similar to support for the other Genius tablets.
https://bugs.kde.org/show_bug.cgi?id=359642

Task-number: QTBUG-52626
Change-Id: I3e2033d547d8bab4b6fb93be3a172bdce4fc5666
Reviewed-by: Dmitry Kazakov <dimula73@gmail.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-02-17 09:41:20 +00:00
Liang Qi
e5c3700a61 Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9 2017-02-17 10:36:32 +00:00
Friedemann Kleint
a81dfb32d6 Windows QPA: Call QWSI::flushWindowSystemEvents() from WM_PAINT for full update only
It was introduced by 0719142321
(macOS QML fix) for apparently historical reasons and has been found to
cause various problems:
- Flicker when using QGLWidget in a QSplitter
- (obscure) crashes due to flushing out input events in setVisible().

Task-number: QTBUG-38327
Task-number: QTBUG-39842
Change-Id: I18081da5f4645271774a51f1d6a88e778adbd6ac
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-02-17 08:22:16 +00:00
Tor Arne Vestbø
d19bd1feb6 macOS: Move NSWindow creation properties into createNSWindow()
Allows the block in recreateWindowIfNeeded() that calls createNSWindow()
to focus on how to (re)parent windows/views, while createNSWindow() takes
care of how to set up the window. Dynamic properties that may change later
on are handled in e.g. setWindowFlags().

Change-Id: Ice0e44d004bd2608b2b54e6dde0f404a1e07dc10
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2017-02-16 23:16:28 +00:00
Liang Qi
c577f6edaf Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/corelib/plugin/qlibrary_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp

Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
2017-02-16 21:51:11 +01:00
Friedemann Kleint
88788667a0 QWindowsVistaStyle: Set theme flag noContent for PE_FrameLineEdit
When the flag is not set, custom background colors for QLineEdit
will not work. Set the flag as does QWindowsXpStyle.

Task-number: QTBUG-57862
Change-Id: I6e653c2cdc8cc523673e1629bf42f833c8504431
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-02-16 19:55:35 +00:00
Marc Mutz
cad9c7cbc9 Use static initialization for QBasicAtomics
A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.

When using aggregate initialization, the guard disappears.

Amends 04d6495bf7.

Change-Id: Id9335cffdd43094cafb231fdde2523d013abe1d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-16 19:26:46 +00:00
Timur Pocheptsov
de225ccdf9 QNetworkSession - register types before connecting slots
QNetworkSession's ctor has a race condition: it 1) connects signals/slots
and also 2) registers meta-types (but after these connects). Our users apparently
have a lot of per-thread QNAMs in multiple threads (and implicitly
many QNetworkSessions on different threads too). From error logs it appears
that while one thread tries to connect signals/slots and evaluates the types
of signal and slot arguments, another thread can register this type.
If the first thread extracted signal argument types, then the second
registered this type, we can end up in a 'type mismatch' error on the first
thread with seemingly the same types in a debug message (something like
"type mismatch A::Some <-> A::Some") - they have the same name, but one
has type() == 0 and another - some non-zero type().

Now we call qRegisterMetaType before connect.

Task-number: QTBUG-50901
Change-Id: Idbb9515573e174bbc5e5bf55dc3a7911a81646ea
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-16 15:52:42 +00:00
Sergio Martins
99ce1d3d97 Take window frame into account when dragging dock widget
Dock widgets with custom titlebar are frameless by default, so this
isn't usually a problem. However, the user can override the default and
make it non-frameless (by just removing the native title bar, not the frame).

Task-number: QTBUG-58843
Change-Id: Iff7a2a719cb2f326f2f81bbfb1b53ba01a63f3e1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-16 15:33:49 +00:00
Olivier Goffart
cd2b5f1ada Resize the window when the screen's dpi changes
That's what the MSDN documentation say one should do in the handler
for WM_DPICHANGED

[ChangeLog][QtGui][Windows] Windows are now automatically resized
when they are moved on a screen to adapt to the new pixel ratio.

Task-number: QTBUG-55510
Task-number: QTBUG-48242
Change-Id: I7688f12165f76585d75686e2e94b0fc562627be2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-02-16 15:31:38 +00:00
Tor Arne Vestbø
2b34aefcf0 Lazily create QPlatformWindow for Qt::Desktop windows
QDesktopWidget only needs a QWindow to access its screen, and has no use
for the platform window. To keep old code working that may have called
winId() on the QDekstopWidget we still ensure it gets created lazily,
even if that will just create hidden fake windows on many platforms.

Change-Id: I2d05b96dfeebeaf3f1278cfef6301ef4cb855a57
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-02-16 15:30:02 +00:00
Oswald Buddenhagen
46d060f588 Overhaul .gitignore
Started-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Change-Id: I2c6fba0532549b952570ec50659934e14ea9cdd5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-16 15:11:05 +00:00
Ulf Hermann
1aaf45e106 Eliminate QT_NO_DYNAMIC_LIBRARY
The library feature already covers this. As library depends on the
dlopen compile check, we can assume dlopen to be available, also on
vxworks.

Change-Id: Idcdb07ab4688c6158651d9a5ad5e2ba126bd7d9e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-16 15:06:26 +00:00
Allan Sandfeld Jensen
a0b3294c9d Fix QRgba64 rgbBlend
The subpixel RGB alpha values were not converted from host endian to RGBA
order before being used as RGBA ordered.

Task-number: QTBUG-58619
Change-Id: I18e1c9df902c7e9001a0e511f06fc953dd7afa3e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-02-16 14:38:30 +00:00
Allan Sandfeld Jensen
fc63b7459c Don't fetch destination in RGB64 mode when not necessary
Extends the short-cut of not fetching destination to also apply to
the RGB64 painting. This saves reading and converting destination pixels
when they will be fully replaced with source pixels.

Since ARGB32 was switched to using the RGB64 drawhelpers, and ARGB32 is
particularly expensive to read, this change is important to avoid
performance regression.

Change-Id: If3a2439140d6364e8429783cfa786bd000cfab45
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-02-16 14:38:07 +00:00
Marc Mutz
0f730ef7b6 QReadWriteLock: make field 'recursive' const
It is never written after initialization, and accessed concurrently
outside mutex protection, so make sure that it never changes by
marking it as const.

Change-Id: Ib28b2e8b3067d596a95d1699165a6ebfb15fe674
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-16 14:34:22 +00:00
Tor Arne Vestbø
ef32f16fc2 macOS: Rewrite window state handling
Instead of relying on specific notifications to change the window
state we now evaluate the state based on the current window state.

This allows us to get rid of windowShouldZoom in the window delegate,
making window state handling work for foreign windows as well, and
also allows us to re-evaluate the state in more places, such as
when moving a window, which may bring it out of maximized state.

The full screen state is tracked by a helper category that doesn't
just rely on the styleFlag, but also on the full screen notifications.
This is needed as macOS will complain if you try to go in or out of
fullscreen while a transition is in effect.

The differentiation between performFoo: and foo: has been removed,
as the latter works in both cases and doesn't rely on the button
being visible/enabled.

These changes fixes many observed quirks in the window state handling
that also resulted in making it hard to write tests that relied on
the fullscreen/maximized operations always working.

Change-Id: I0538c42d9223a56f20ec9156f4939288e0750552
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-02-16 14:32:00 +00:00
Marc Mutz
f05d2764b0 QJNIHelpers: unbreak runnables counter
Adding 0 each time will obviously not produce a new identifier each
time...

Also use static initialization for QBasicAtomicInt.

A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.

When using aggregate initialization, the guard disappears.

Amends 265db5ad9b.

Change-Id: Ia71290cf26c486dcbcc74381f12cd0c4712d6019
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-16 14:30:27 +00:00
Allan Sandfeld Jensen
925a3c6529 Use native support for fp16 where available
Use F16C or ARM FP16 if available at compile time.

Configure check added because older clang compilers have F16C defines
and flags but not all the intrinsics.

Change-Id: I71f358b8fd003e70ab8fcf35097414591e485112
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-16 12:03:45 +00:00
Alexander Volkov
bee82432eb xcb: Allow to disable XInput 2 support by setting QT_XCB_NO_XI2 env var
Use of XInput 2 may result in regressions. For example we call
XISelectEvents for each window every time a device plugs/unplugs.
It causes significant delays when there are many native windows.

Change-Id: I60b799bb667d0e4bca1f9c52cdaa07b04bcc749f
Task-number: QTBUG-57013
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-02-16 09:53:50 +00:00
Marc Mutz
5486882b52 Android: De-duplicate vtables of exported private classes
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to emit
the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false-negative
dynamic_cast and catch evaluation.

Since the classes are already exported, users of these classes are
unaffected by the change, and since it's private API, we don't need to
avoid adding code to the out-of-line destructor until Qt 6.

While at it, de-inline also the empty default implementations of
virtual (non-dtor) functions.

Task-number: QTBUG-45582
Change-Id: I3e6f37eab1dee0db445f6c13638a43ca3bf6ac62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-16 05:02:34 +00:00
Tor Arne Vestbø
ee0edf1b0a QWindow: prevent window reparenting into Qt::Desktop windows
Qt::Desktop exists to support QDesktopWidget, which predates the QScreen
API. QWidget internally has checks that prevents you from reparenting a
QWidget into a QDesktopWidget, so we should have the same limitations on
the QWindow level. This allows platform plugins to implement Qt::Desktop
as simple (possibly shared) wrappers around QScreen without having to
allocate native window resources for each desktop window.

Change-Id: Ia1bac506febd3d827a6e0b8ad3bfd95be0cc7f9d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-02-15 23:00:43 +00:00
Marc Mutz
bf2160e72c Clean up QStringLiteral definition
We require lambda support in the compiler since Qt 5.7, so drop
the guard macro.

Apart from MSVC 2013, all our supported compiler also support
char16_t:

- VxWorks uses GCC 4.8, which supports char16_t since 4.5.
- ICC supports char16_t since v12.1; we require v14+.
- ONX uses a GCC which supports char16_t in the compiler,
  but is equipped with a stdlib that does not sport char16_t
  support, which is why we revoke its Q_C_UNICODE_STRINGS in
  qcompilerdetection.h. But we don't need stdlib support, we
  only need the core language feature.
  This is the only platform where this patch actually changes
  something. It removes the, rather unfair, pessimization of
  the platform which could have supported the static-storage-
  duration implementation of QStringLiteral instead of the
  fallback, which uses dynamic memory (QString::fromUtf8()).
- GCC and Clang support char16_t since 4.5 and 3.0, resp.,
  which is far below our minimum compiler requirements in
  effect since Qt 5.7.
- On Windows, MSVC supports char16_t since 2015 only, and we
  still support 2013, but on Windows, wchar_t is the same size
  as char16_t, so instead of u"str" we can fall back to L"str".

So simplify the implementation of QStringLiteral by assuming
that all these feature are present, adding noexcept to the
lambda to make noexcept() queries return true.

This allows us to guarantee:

[ChangeLog][QtCore] QStringLiteral is now guaranteed to be
evaluated at compile-time. The last platform (QNX) to use the
QString::fromUtf8() fallback has been ported to allocate the
string data statically, too.

Change-Id: I7920d7a77001e5c5550e7c7d57ceb7c51c9eb443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 20:14:56 +00:00
Marc Mutz
04d6495bf7 Make some atomic counters zero-based
A variable of static storage duration that is not zero-initialized
takes up space in the DATA segment of the executable. By making the
counters start at zero and adding the initial value afterwards, we
move them over to the BSS segment, which does not take up space in
the executable.

Wrap atomics used across function boundaries into small functions,
to avoid code duplication and to increase readability.

Change-Id: Ida6ed316ecb8fe20da62a9577161349e14de5aed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 20:14:27 +00:00
Marc Mutz
a5febadac5 QString(Ref): make toLatin1()/toLocal8Bit() null handling consistent
Systematic testing in tst_QStringApiSymmetry revealed a bug in
QStringRef::toLatin1(): a null input did not result in a null output,
but an empty one. This is fixed, for consistency with
QString::toLatin1(), and QString(Ref)::toUtf8(), which behaved
correctly already.

The same bug was found in QString(Ref)::toLocal8Bit(), which is
particularly hideous, as it's documented to fall back to toLatin1(),
which preserves null inputs. Fixed, too.

[ChangeLog][QtCore][QString] toLocal8Bit() now preserves nullness of
the input QString (outputs null QByteArray).

[ChangeLog][QtCore][QStringRef] toLocal8Bit() and toLatin1() now
preserve nullness of the input QStringRef (output null QByteArrays).

Change-Id: I7026211922c287e03d07e89edbad2987aa646e51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-15 20:12:36 +00:00