Commit Graph

38790 Commits

Author SHA1 Message Date
Thiago Macieira
0e1623158b Fix GCC 9's warning about deprecated violation of Rule of 5
error: implicitly-declared 'QDistanceField& QDistanceField::operator=(const QDistanceField&)' is deprecated [-Werror=deprecated-copy]
note: because 'QDistanceField' has user-provided 'QDistanceField::QDistanceField(const QDistanceField&)'

Change-Id: Ie7ae7616eadf4035bec6fffd15aabc58e99632d9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-06-23 07:03:38 +00:00
Tor Arne Vestbø
674f4e6cfb QApplication: clarify and unify global static usage
Explain why there are two accessor functions for the global statics,
and use the global statics directly inside qapplication.cpp for
consistency.

Change-Id: Ibf3952052c1d0e780a8aab220a72f05af0c070a5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-06-21 14:22:00 +02:00
Tor Arne Vestbø
ed00e3093b Remove duplicate call to QApplicationPrivate::setPalette_helper
initSystemPalette() already takes care of this.

Change-Id: I6521763a74ec3ec629d9fcf05aa2a7cd71a7f26d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-06-21 14:22:00 +02:00
Tor Arne Vestbø
cbb0295f7b Remove duplicate call to QApplicationPrivate::initializeWidgetPaletteHash()
initSystemPalette() already calls this when there's a platform theme, which
is the only case where initializeWidgetPaletteHash will have an effect.

Change-Id: I814ea2bb17ef40aee769f2c36f8ef4296cfca020
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-06-21 14:22:00 +02:00
Tor Arne Vestbø
cea661d395 Squash un-needed qt_init function into callsite
Only uses a single place and avoids following the init logic through
multiple layers when trying to debug it.

Change-Id: I8fc119385edf407f69fb5431dc6584288022a7fe
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-06-21 14:22:00 +02:00
Tor Arne Vestbø
d848c3dfea Remove dead code from QApplicationPrivate::setSystemPalette
The code was added in 2005, ifdefed out already, and never used.

Change-Id: Ic5d070dd031665a4429739278851b50646694bf9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-06-21 14:22:00 +02:00
Volker Hilsheimer
cfd2cc91fd Always fill the background of a tabbed QMdiSubWindow
QMacStyle polishes QMdiSubWindows to have autoFillBackground set to
false. If the QMdiSubWindow's widget also doesn't fill the background
(like QLabel), then nobody fills the window in a tabbed QMdiArea, and
the other subwindows show through.

This change makes sure that all pixels are painted in that situations,
using the styled frame.

Fixes: QTBUG-76214
Change-Id: Iae025d15d36a8bc0d0c5838ac43c9d54944bcc83
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-06-21 13:09:46 +02:00
Timur Pocheptsov
a22a6c01f8 Revert "tst_qnetworkreply - QSKIP/disable tests that deadlock on Windows"
QSslSocket (OpenSSL backend) does not use mutex/locks during
a handshake, so we re-enable previously skipped tests.
This reverts commit 8c87a1402c.

Change-Id: I994b085f016f0eb18b3ba439a7041ea08cd3577b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-21 09:54:09 +02:00
Shawn Rutledge
82da8306bc Deal with multi-display scenarios when positioning menu popups
This is to support rare setups involving an X11 server with multiple
independent displays ("zaphod heads" on which the DISPLAY env var
is different), possibly with multiple outputs forming a virtual desktop
on each display.

QMenu::popup() has been assuming that it should show on the screen where
the mouse cursor is.  That's good most of the time; but with multiple
independent screens, QGuiApplication::screenAt(pos) cannot tell us which
screen to use (it's ambiguous), but rather will choose the first screen
that _could_ contain that position (as documented).  In the example in
QTBUG-76162, the QMenu has been constructed with a QDesktopScreenWidget
as its parent specifically for the purpose of telling it which screen to
pop up on; so we need to respect that.  But QWidgetPrivate::init() sets
the QObject::parent() to null (because the widget isn't actually shown
as a child of the QDesktopScreenWidget), and QWidgetPrivate::create_sys()
sets initialScreenIndex back to -1 to provide freedom to change the
screen later; so QMenu has to remember the screen index for itself.

QMenuBarPrivate::popupAction() searches the siblings of the screen on
which the menubar is claiming to be (rather than all screens on all
displays), to find the screen containing the point at the middle of the
bottom edge of the clicked menubar item.  It then sets initialScreenIndex
so that QMenu::popup() will respect it rather than trying to decide for
itself.

Fixes: QTBUG-76162
Change-Id: I7a8f8e7aa2e9cf5340d446dc12726369ebe2589a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-06-21 11:43:46 +02:00
Allan Sandfeld Jensen
121692e540 Use Xft DPI as basis for HiDPI scaling
GNOME indicates DPI modes by setting high DPI values in Xft.DPI, so
we need to use the forced DPI setting instead of the real DPI, as basis
for QPA pixel density.

Change-Id: I6f25636383b16b89a3d5fe4c904afd079fe001aa
Fixes: QTBUG-74836
Task-number: QTBUG-65424
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-06-19 18:02:48 +02:00
Kai Koehne
29670528d8 Qt D-Bus: Document CMake commands
Task-number: QTBUG-72159
Change-Id: I4b2f29a9d976f4b81acef3170b90016d2e8b5ef8
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-06-21 11:04:05 +02:00
Rolf Eike Beer
47691260ca move ENDSESSION_* compat defines to before they are actually used
This commit amends 144d33df72.

Change-Id: Ic6bc475c9d8c3bb727ee209dbab437a18e219b6d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-06-13 11:15:49 +02:00
Thiago Macieira
0ef6150005 QCborValue::fromJsonValue: rewrite code to remove UB
Converting an out-of-range FP to integer is UB. See comment in
qnumeric_p.h.

Change-Id: Ief874765cd7b43798de3fffd15a9bfe2c5fbbc01
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-06-19 17:15:39 -07:00
Laszlo Agocs
eb144c3c4d Release program when returning from QOpenGLTextureBlitter::create()
Change-Id: I27b9496f9a58ceabc613372463543068cb432bdc
Fixes: QTBUG-60453
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-06-19 12:37:51 +02:00
Allan Sandfeld Jensen
a1634fb741 Fix controlling gdb_index from configure line
Used the wrong feature name

Change-Id: Ie32adb8bb9dd142927aea7d88aa10b9b87030681
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-06-20 09:14:24 +00:00
Frederik Gladhorn
73a19a3a10 Stabilize tst_qsplitter
This is the worst fix ever, adding one more qWait. The test has been
updated in the 5.13 branch, so there a different fix will be needed. For
now this is in line with the rest of the code.
This test is currently one of the worst offenders when it comes to flaky
tests.

Task-number: QTBUG-64639
Change-Id: Ia1e71cc948997408b9658839013c9ad098111033
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-06-19 18:32:19 +02:00
Tor Arne Vestbø
7940791f47 Report correct state change when destroying QAbstractAnimation
Change-Id: Ibe5310e20268d1baa5b329a4d02a3dc38d875008
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-20 12:46:30 +02:00
Tor Arne Vestbø
25eb0408a6 macOS: Don't capture local Q_D in QMacStyle
Change-Id: I01f14295e7e383b583931fc22e3d43151f7918b0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-06-19 16:42:47 +02:00
Timur Pocheptsov
fe6e54fb1f TLS socket: make verification callback lock-free (OpenSSL)
When our QSslSocketBackendPrivate (OpenSSL backend) was developed,
the ancient versions of OpenSSL did not have an API needed to pass
an application-specific data into verification callback. Thus the
developers resorted to the use of global variables (a list with errors)
and locks. Some of our auto-tests use QNAM and in-process server.
Whenever the client (essentially qhttpthreadeddelegate) and the server
live in different threads, any use of 'https' is dead-lock prone,
which recent events demonstrated and which were previously observed
but not understood properly (rare occasions, not always easy to
reproduce). Now we fix this for good by removing locking.

There are two places (in 5.12) where these locks are needed:

1. Before calling SSL_connect/SSL_accept (handshake) - here
   we reuse the same trick we do in PSK callback ('SSL' has
   an external data set, and it's 'this', meaning an object
   of type QSslSocketBackendPrivate).

2. The static member function 'verify', here we do not have
   'SSL', but we have our temporary 'X509_STORE', to which
   we can directly attach an external data - a pointer to
   a vector to collect verification errors.

Note, this change assumes that OpenSSL Qt is build/linked
against is at least of version 1.0.1 - we set external data
on SSL unconditionally (no version checks).

Fixes: QTBUG-76157
Change-Id: I05c98e77dfd5fb0c2c260fb6c463732facf53ffc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-17 15:21:11 +02:00
Volker Hilsheimer
c086fc7341 Report correct data when multiple volumes are mounted to the same path
We read the data into the iterator from the system, but then recreate
the QStorageInfo object based on the rootPath, and then stat, discarding
the data in the iterator.

We can overwrite the data with the information in the iterator, which
partially fixes the issue. Volume information that can only be retrieved
by stat'ing the root path, such as size information, will only be
correct for one of the entries.

Change-Id: Ie98590876d6a5f525af009f4ff5d595cbc308b3f
Fixes: QTBUG-63209
Reviewed-by: Andrius Štikonas <andrius@stikonas.eu>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-19 20:11:19 +02:00
Paul Wicking
6398588338 Doc: Fix typo in brief
Fixes: QTBUG-76512
Change-Id: I8db4288b22416c6af9aaaa72c5005b81d79bf620
Reviewed-by: Martin Smith <martin.smith@qt.io>
2019-06-19 15:18:50 +02:00
Tor Arne Vestbø
6fa5dfddf8 Don't hardcode compiler when building headers
Normal sources are built using $(CXX), which is defined in the makefile,
but can be overridden. We should do the same lazy evaluation of the
compiler for headers.

Change-Id: Ic548786bd18ed8fb7eb0b58a527615ab19000323
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-06-13 14:11:50 +02:00
Tor Arne Vestbø
d5adaacbb2 macOS: Make QMacStyle::standardPalette() reflect the platform theme
This palette isn't usually used, and the platform theme's palette is
preferred, but if a client asks for the standard palette (e.g. as
used in the styles example) we should try to report a palette that
gives the system look.

Change-Id: Ie5e58c890c13c716a9e9b5093b954a737e550dee
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-06-19 11:43:14 +02:00
Friedemann Kleint
6d61b10f65 High DPI: Fix crash in QWindow::mapFromGlobal()
With Web Engine, QQuickWidget or similar, the code can hit on the offscreen
window, when its handle is null. Add a check.

Amends 3af7b27917.

Fixes: QTBUG-76440
Change-Id: I123633d18386efd3dbfb22aad6072e4f0877a62e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-19 08:34:01 +02:00
Frederik Gladhorn
a3e69954f5 Add accessibility notification role
On Linux this role is needed to make desktop notifications work.
There is no equivalent for Windows, iOS or macOS. On these platforms the
role will have no effect.

Fixes: QTBUG-76333
Change-Id: I4ef3b3321f7a0e2c09c1ce432a668428d14c52b7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2019-06-12 10:29:45 +02:00
Morten Johan Sørvig
1975a98345 macOS: prevent duplicate backing store scaling
m_requestedSize is already scaled by the QtGui scale
factor (e.g. as set by QT_SCALE_FACTOR). Multiplying
by QWindow::devicePixelRatio() then applies this factor
again.

Use QPlatformWindow::devicePixelRatio() instead, which
returns the platform scale factor.

Change-Id: I133e99d84f4718215fda9ef0cf81a113b51db2c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-06-19 13:12:59 +02:00
Richard Moe Gustavsen
084f84d112 QVector3D: fix documentation spelling error
Change-Id: Id3b97ea3ce45452e0b59986bc4fd84fd9b0d3708
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-06-19 10:25:57 +02:00
Michal Klocek
b68a9df076 Fix bogus setAttribute setter warning
Since e9e16c7464 running webengine application you can get
warning "Attribute Qt::AA_ShareOpenGLContexts must be set before
QCoreApplication is created."

WebEngine set shared open gl context on qt_call_pre_routines, so
when QCoreApplicationPrivate init() runs.

Fixes: QTBUG-76391
Change-Id: I5fc146ed70054b0c1597fe06615cea2d7a8969d8
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-06-19 08:42:35 +00:00
Tor Arne Vestbø
f344b6357e macOS: Invalidate window shadow after QNSWindowBackingStore resize
The window shadow rendered by AppKit is based on the shape/content of the
NSWindow surface. If the backingstore is partially transparent, we need
to invalidate the window shadow after each resize (and subsequent flush)
of the backingstore.

Change-Id: I451370af5a8c0c25faea26beb3faa2483a33a5cf
Fixes: QTBUG-74560
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-06-18 14:59:56 +02:00
Tim Blechmann
cf052e0737 Windows: Use UUIDs instead of function pointer to mangle window classes
Instead of using the address of a function pointer, we name-mangle window
classes by using an UUID.

This fixes a real-world problem with multiple Qt instances where for some
reasons the window function appears to be mapped to the same address.

Change-Id: Id27e8d7aa17a4db9c14559224395f49d3ecd8d78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-06-18 10:40:06 +00:00
Christian Ehrlicher
b568e93149 QSS/MenuItem: only draw checkbox if no item is available
QTBUG-66380 introduced a behavior change drawing a checkable menu item
with an icon. After this path the checkmark and icon was drawn.
Revert this regression so the stylesheet style matches the behavior of
all other styles. A checkable item should have two different icons
(QIcon::On and QIcon::Off).

Fixes: QTBUG-74655
Task-number: QTBUG-66380
Change-Id: I32ac2f397087a1c3d5d07400372109703c00c1ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-06-17 20:46:36 +02:00
Frederik Gladhorn
8e528d8bd0 iOS Accessibility: implement accessibilityElements and check indexing
Fixes: QTBUG-70683
Change-Id: I122c67a5cee22363de5c8e45dc1c83e7760162fb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-21 12:31:07 +00:00
Thiago Macieira
36c6b7ee4d Append LTCG arguments properly
If the QMAKE_CXXFLAGS already had -ffat-lto-objects, the *= wouldn't add
it it again, after our "-flto -fno-fat-lto-objects", which meant the
last one would stand.

Change-Id: Ic9cfa6256b5045caa6e6fffd15a7f6cda7aaa837
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-06-13 23:02:22 -07:00
Morten Johan Sørvig
7ae2f47214 QHighDpi: Replace fromNative()/toNative() with scale()
We need one scale() function for each type: the scale factor can be
inverted by the caller for the fromNative case. Add a generic
templated implementation which will handle simple types. Add add
specialization functions for compound types that don't have
operator*(), as well as for position types (e.g. QPoint) which account
for the origin.

There's no need for fromNativePixels() and toNativePixels() overloads
for each type; replace with generic implementations which call
scale(). Do the same thing for fromNativeLocalPosition().

Some user code is calling fromNative()/toNative() directly, so leave a
definition of those functions around for now. Also leave a couple of
one-off scaling functions which do not fit the pattern.

Also fix “narrowing conversion scaleFactor to int” warning for the
QMargins scale function.

Change-Id: Ia67accbb670a80dc1747c2e264b97aab75b1251b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-14 19:31:41 +02:00
Morten Johan Sørvig
09a2a9bc4a Cocoa: always send queued user input events
User input events will be queued if processEvents()
is called with the ExcludeUserInputEvents flag. User
code then expect that the queued events will be sent
when the corresponding exec() call returns.

We were sending queued user input event at the beginning
of processEvents(). However, the cocoa event dispatcher
also has a mode where it makes a blocking call to
[NSApp run], in which case processEvents() never returns
during event processing. This means we don’t get to call
the queued-event-sending code.

Factor out the queued-event-sending code to a new
sendQueuedUserInputEvents() function. Call it from
postedEventsSourceCallback() to make sure the queue
is emptied after the ExcludeUserInputEvents processEvents()
call is done.

Task-number: QTBUG-69687
Change-Id: I4ff554ef4d39a69356736c33a650886b56bfdb4c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-03-21 12:53:24 +01:00
Qt Forward Merge Bot
f2eadc65c3 Merge "Merge remote-tracking branch 'origin/5.12.4' into 5.12" 2019-06-17 12:29:53 +02:00
Qt Forward Merge Bot
3b27126440 Merge remote-tracking branch 'origin/5.12.4' into 5.12
Change-Id: I61c92717cf82cfe2b14a4d7cbe17f03c3634e827
2019-06-17 12:29:53 +02:00
Mårten Nordheim
d8efc8d718 QSslSocket: add and set the TLSv1.3-specific PSK callback
If this callback is not set then OpenSSL will call the callback
used for <= TLS 1.2 unconditionally when connecting. If using PSK it
will call it again later once the preshared key is needed.
We don't currently handle the TLSv1.3 PSK, but we definitely should.
But for now we can work around it - when psk_use_session_callback is
called we simply change the PSK callback to a dummy function whose only
purpose is to restore the old callback.

This is mostly done to keep behavior the same as it is now for users
(and to keep our tests running).

Later we can add a new signal and handle this new feature properly.

Task-number: QTBUG-67463
Change-Id: I4aca4ae73ec4be7c4f82a85e8864de103f35a834
Reviewed-by: Simo Fält <simo.falt@qt.io>
2019-06-12 22:59:14 +02:00
Timur Pocheptsov
515c6e7639 H2 auto-test, degrage flowControlServerSide
our powerful VMs die/time out on 30 requests, use 10 only.

Change-Id: Ibf3ceedeac1839f9a88f88def844c7d61786b94f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-12 15:31:10 +02:00
Mårten Nordheim
d53b8b77bc tst_qsslsocket: fix racy test
In this threaded setup the server can sometimes have the data before it
calls "waitForReadyRead", what happens then is that we fail the wait and
as a result the test fails overall.

Let's check if we actually got some data after all and then continue if
we did. Since both the client and the server currently wait the same
amount of time (2s) the max timeout for the client was increased by
0.5s so it has some time to notice that the server got the message.

Change-Id: Ib5915958853413047aa5a7574712585bcae28f79
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e79b1dcdf5)
Reviewed-by: Simo Fält <simo.falt@qt.io>
2019-06-12 11:24:08 +00:00
Timur Pocheptsov
8c87a1402c tst_qnetworkreply - QSKIP/disable tests that deadlock on Windows
We use global object to store errors found by q_X509Callback.
Thus, we also use a lock/mutex. It would appear all tests
involving in-process server and QNAM are prone to intermittent
failures on our Windows VMs - it's always about timeouts due
to the client socket (QNAM) locking and the server socket blocking
main thread while trying to acquire the same lock.

The real fix is to get rid of global variable/locking, we'll
have it later (quite a change and requires a lot of accuracy).

Task-number: QTBUG-76247
Change-Id: Iffc90d9e16783f17f62e836e01c35f22681bdd39
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
 (cherry picked from commit 91ab70d17f)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2019-06-12 13:52:14 +00:00
Val Doroshchuk
9b6928b7cc Fix crash when app is going to shutdown but conf manager is requested
If the app is finished and going to shutdown,
qNetworkConfigurationManagerPrivate() returns nullptr.

Change-Id: I01915021d8698802b3a1d0dee43203cd3d4aba74
Task-number: QTBUG-76090
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-12 08:26:54 +00:00
Paul Wicking
93642992ae Doc: Correct documentation of QFuture::cancel
Fixes: QTBUG-76305
Change-Id: I192a7f0bc2c15e532bc6d51c7e9c39561ae3436c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-06-11 11:11:43 +00:00
Andy Shaw
7932c99a31 Update SQLite to 3.28.0
[ChangeLog][Third-Party Code] Updated bundled SQLite to version 3.28.0

Change-Id: I3561ec3bcf80fe6062ccab27f1008dfda66e1187
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2019-06-05 21:00:57 +02:00
Vova Mshanetskiy
1ade5ea41a QAndroidInputContext: Improve compatibility with virtual keyboards
This commit improves QAndroidInputContext's conformance to Android's
InputConnection interface and/or consistency of it's behavior with
Android's native EditText control.

* Composing region is now completely independent from cursor and
selection, as required by InputConnection documentation. Also, Qt will
now never clear composing region (i.e. call finishComposingText())
without receiving a command to do so from the keyboard. This is
important for the following reasons:

- Some keyboards misbehave if we change composing region without
  receiving a command from them. Notably, Samsung Keyboard does
  (QTBUG-68822).

- Due to asynchronous nature of interaction between QAndroidInputContext
  and the keyboard, when user drags cursor handle quickly, the keyboard
  may call setComposingRegion() to mark a word, which is no longer under
  the cursor. This was causing text corruption (QTBUG-43156,
  QTBUG-59958). Also SwiftKey makes such calls when user presses Enter
  key (QTBUG-57819).

- For similar reasons selecting a word with a double-tap could cause
  text corruption. The keyboard may call setComposingRegion() in
  response to the first tap after the second tap has been processed and
  the word has already been already selected.

This is achieved by keeping track of start and end of composing region
independently from the editor. Whenever possible (i.e. when there is no
selection and the cursor is inside composing region), the composing text
is represented as preedit text inside editor. And whenever that is
imposible, the editor is told to commit, but QAndroidInputContext keeps
information about composing region internally to be able to correctly
interract with the keyboard.

* deleteSurroundingText() has been re-written to work correctly when
there are selection and/or composing region. Some keyboards (e.g Ginger
Keyboard) do call deleteSurroundingText() when there is non-empty
composing region.

* All operations are now performed inside a batch edit (i.e.
QAndroidInputContext now calls beginBatchEdit() and endBatchEdit() on
itself) to ensure that an intermediate state is never reported to the
keyboard, whenever an operation requires more than one
QInputMethodEvent. BatchEditLock helper class was added to call
begin/endBatchEdit() in RAII style. m_blockUpdateSelection has been
removed because m_batchEditNestingLevel is now used instead of it.

* Selection start and end positions are now reported to the keyboard so
that start <= end. Some keyboards can not handle start > end.

* getTextBefore/AfterCursor() now exclude selected text from their
return values. While Android docs say "text before/after cursor", what
they really mean is "text before/after selection" because "the cursor
and the selection are one and the same thing". Some keyboards (e.g.
Gboard) were behaving incorrectly when selected text was being returned.

* getExtractedText() now tries to obtain and return the whole text from
the editor. This is to fix compatibility with some buggy keyboards
(e.g. Samsung Keyboard, Minuum) that ignore startOffset field and
assume that selectionStart and selectionEnd are absolute values. Then
they issue commands with wrong indexes in some cases.

Fixes: QTBUG-43156
Fixes: QTBUG-59958
Fixes: QTBUG-57819
Fixes: QTBUG-68822
Change-Id: I7e71f3bcfbb2c32248d653a4197293db03579a79
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-06-05 18:21:35 +03:00
Vova Mshanetskiy
e5f2be256f QAndroidInputContext: Don't allow clearing selection by dragging handles
Android's native text editing controls do not allow user to clear
selection by dragging selection handles. Qt apps should behave in the
same way.

Change-Id: I9a7c3a2aafa484eed8ff2bbd46dd48c705195291
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-06-05 17:38:32 +03:00
Vova Mshanetskiy
710435ee81 QAndroidInputContext: Fix unneeded preedit commits when dragging handles
If the cursor handle was dragged by only a few pixels, position of the
cursor did not actually change, but finishComposingText() was called
anyway. So the keyboard was thinking that nothing changed and a word is
still being composed, but the app was thinking that there is no preedit
string. This was resulting in invalid handling of following key presses.

This commit essentially inlines
QPlatformInputContext::setSelectionOnFocusObject() into
QAndroidInputContext::handleLocationChanged(). This allows us to call
finishComposingText() and to send a QInputMethodEvent only when position
of the cursur actually changes. This also allows us to add a
QInputMethodEvent::Cursor attribute into the event for consistency with
QAndroidInputContext::longPress().

Change-Id: I2fc82f138f717991f34024cdf521236845dc0adf
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-06-05 17:38:32 +03:00
Erik Kurzinger
0c18311785 Track swap interval in QXcbWindow
As per GLX_EXT_swap_control, the GLX swap interval is specified on a
per-drawable basis. However, QGLXContext only tracks it per-context
using the m_swapInterval member. If a new drawable is made current to a
context, it is still necessary to call glXSwapIntervalEXT to change the
swap interval, even if it has been previously called for the same
context with a different drawable.  However, currently,
QGLXContext::makeCurrent doesn't do this if its m_swapInterval field
matches the new swap interval. This change removes m_swapInterval from
QGLXContext, instead tracking it in QXcbWindow. This still avoids
unnecessary calls to glXSwapIntervalEXT, while ensuring the swap
interval is always set for new window drawables.

Change-Id: Idc34101476c6af618059f6f3d8925dee743994a3
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-06-13 08:20:41 -07:00
Eirik Aavitsland
1640973a82 Fix raster paint error in path joins of tightly bending bezier curves
The code for generating round line joins is optimized with a shortcut
for the inner, normally invisible joins.  For certain joins of a
tightly turning bezier, this optimization would lead to visible
painting error. Fix by avoiding the optimization if the next control
point is so close as to allow such tight turns.

As a driveby, make the angle > 90 test cheaper, since absolute
precision is not required in the optimization choice.

Fixes: QTBUG-75008
Change-Id: I293e0776003310dc36fa7f43fbcd9c25f1f8fa5d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-14 11:02:35 +02:00
Lars Knoll
dd5b829468 Raster paint engine: optimize rect clipping
More aggressively skip processing empty spans.
Tested with the qpainter benchmark on armv7; yields
small but measurable improvement.

Change-Id: Ie0ed0f824a0be7bcc2de3a9aa98ebccb0e8accae
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-06-11 09:25:55 +00:00