214 Commits

Author SHA1 Message Date
Shawn Rutledge
4e78f559be Remove uses of QScreen::orientationUpdateMask
It has been removed in qtbase 3e12951c0b35041920989d6089ddb6c2f5c2d3d1.

Task-number: QTBUG-35427
Task-number: QTBUG-38576
Task-number: QTBUG-44569
Task-number: QTBUG-51012
Task-number: QTBUG-83055
Change-Id: I3ec0907185b237c329f4ec34148b19c5a7706c22
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-05-08 17:54:34 +02:00
Liang Qi
159ffc775b Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-04-29 13:53:45 +02:00
David Edmundson
1a7dedc2d1 Client: Don't send fake SurfaceCreated/Destroyed events
QPlatformSurface relates to the platform window, not the wl_surface.
The events are already emitted by QPlatformWindow on create/destroy.

To preserve compatibility for a previous KDE version it was faked to
emit the events when the wl_surface is created/hidden to keep behavior.
This is no longer necessary, and it has caused multiple errors, the latest
being a crash when switching between sub-menus with the Sway compositor.

[ChangeLog][QPA plugin] QWaylandWindow no longer sends fake SurfaceCreated/Destroyed events.
Use expose events to be notified when a Wayland surface appears.

Task-number: QTBUG-76324
Fixes: QTBUG-81952
Pick-to: 5.15
Change-Id: I2f003bc9da85f032a0053677fd281152099fc9eb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2020-04-28 10:33:22 +00:00
Edward Welbourne
f5e071ee2c Use Qt::SplitBehavior in preference to QString::SplitBehavior
The Qt version was added in 5.14 "for use as eventual replacement for
QString::SplitBehavior." Move another step closer to that goal.

Change-Id: Ie19f7580d75694982ac26c08ad5aabb73d830494
Reviewed-by: Johan Helsing <johanhelsing@gmail.com>
2020-02-28 15:35:54 +01:00
Johan Klokkhammer Helsing
75fd4b4669 Client: Workaround for QPlatformWindow::setVisible(true) being called twice
Fixes a crash.

Otherwise we created two shell surface objects in some cases.

Change-Id: Ieded56261061da6acf27ccabba81c8f578ca1596
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
2020-02-27 15:16:55 +01:00
Johan Klokkhammer Helsing
84209cf53b Client: Implement QPlatformWindow::startSystemResize
Task-number: QTBUG-73011
Change-Id: Ife0d9949b4d4dd7e6f16d3de88d0cb4bf4991e09
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2020-02-05 08:50:56 +01:00
Johan Klokkhammer Helsing
37b79a5968 Client: Update to new signature for startSystemMove()
In a319f4a5, we temporarily disabled the override to let qt5.git update, now we
add it back with the new signature. This means QWindow::startSystemMove now
works for Wayland.

Task-number: QTBUG-81751
Task-number: QTBUG-73011
Change-Id: I1459300d6f7fb77a9ae07bb4f5c2b80722f9b02c
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
2020-02-04 11:23:39 +01:00
Johan Klokkhammer Helsing
6111649b41 Client: Don't use deprecated handleMouseEvent version
The new version requires the button that caused the event, as well as the event
type. Instead of adding a conversion functions to and from
QWaylandInputDevice::Type to QEvent::Type, just use QEvent::Type directly, as
there is one-to-one mappings for all the event types we need.

Fixes: QTBUG-80044
Change-Id: I0f6e0e8e7f2e026a1d601f86e819affe0570a1b2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
2020-01-03 23:47:02 +01:00
Johan Klokkhammer Helsing
84c2b4802f Client: Add QWaylandWindow::mapFromWlSurface
Qt window coordinates start inside the decorations, while wl_surface
coordinates start at the first pixel of the buffer. Potentially, that would be
in the shadow, although we don't have those. So for now, it's the first pixel
of the decorations.

Change-Id: Idccf8a359035f5477d6bc9e2e03a0e9fafe16971
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
2019-12-30 12:33:29 +01:00
Qt Forward Merge Bot
1f54136d65 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I1f9418f4f5783291286417f6faf6277e0679007c
2019-12-10 03:03:32 +01:00
Johan Klokkhammer Helsing
e86d199546 Client: Always close popups when hiding a window
It's not just popups that may have popups open on them. Always close open
popups when hiding a window to prevent dangling pointers.

[ChangeLog][QPA plugin] Fixed a crash when re-showing a popup after hiding its
parent.

Fixes: QTBUG-80562
Change-Id: I7cdac5c7a30e0add5ebf00259401e4d74626ce96
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2019-12-06 12:53:03 +01:00
Johan Klokkhammer Helsing
b5f100975d Client: Support running with no screens
[ChangeLog][QPA plugin] The QPA plugin now supports running with no screens
attached. This is handled by adding a fake screen when the last screen is
disconnected, similarly to what the other QPA plugins do.

Fixes: QTBUG-79111
Change-Id: I4a0e023ae784217dd030f0c62f12487fdff4825c
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-11-12 13:34:05 +01:00
Liang Qi
aab418b27b Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/client/qwaylanddisplay.cpp
	src/client/qwaylandwindow.cpp

Change-Id: I30ddf5305b3087b93cf4d6e562fd0146dea61cc0
2019-11-05 11:35:46 +01:00
Johan Klokkhammer Helsing
8d409b0952 Client: Fix crash when showing a child window with a hidden parent
[ChangeLog][QPA plugin] Fixed a crash when showing a window with a hidden
parent.

Now we just avoid creating the subsurface, so nothing is shown. Seems to be
the same behavior as on xcb.

Fixes: QTBUG-79674
Change-Id: Ia46fcd9a0da5aad4704816a41515cb1e128ac65f
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-11-04 13:40:56 +00:00
Johan Klokkhammer Helsing
bd3dd42bd5 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/client/qwaylandwindow.cpp
	tests/auto/compositor/compositor/tst_compositor.cpp

Change-Id: Iacfcae577a4a99c847694ae3a2c6e3e9ae050817
2019-10-21 09:23:06 +02:00
Johan Klokkhammer Helsing
da9d36b394 Client: Fix 100ms freeze when applications do not swap after deliverUpdateRequest
[ChangeLog][QPA plugin] Fixed a 100 ms freeze that would occur if applications
did not draw after receiving a deliverUpdateRequest().

QtQuick does this at the start of animations. This should get rid of those
backingstore warnings (and also remove a 100ms freeze before animations start
in those instances).

Fixes: QTBUG-76813
Change-Id: Id366bf4a14f402fa44530ae46e7b66d9988c14f6
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: John Brooks <john.brooks@qt.io>
2019-10-17 08:13:27 +02:00
Qt Forward Merge Bot
19660bcc51 Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: Ie236fa47c23456b15414c3b3e89568b915979ebe
2019-10-01 03:02:06 +02:00
Johan Klokkhammer Helsing
7c4b2334a3 Client: Don't crash with long window titles using UTF-16 characters
Previously, we set the max length in QString character length, which means
UTF-16 characters (of potentially three bytes) counts as one character. The max
limit of libwayland, however, is in bytes (and the string itself is converted
to UTF-8).

Fix it by dividing the character limit by three because in the worst case each
UTF-16 character will use three bytes when UTF-8 encoded.

Fixes: QTBUG-78478
Change-Id: Idf4721894e0fe6f3cd92bdc6ada7b0ea4199ea63
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-09-25 10:54:58 +00:00
Johan Klokkhammer Helsing
26fd653154 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/client/qwaylanddatadevice.cpp
	src/client/qwaylandinputcontext.cpp
	src/client/qwaylandinputdevice.cpp
	src/client/qwaylandwindow.cpp
	src/compositor/compositor_api/compositor_api.pri
	src/compositor/compositor_api/qwaylandquickitem.cpp

Change-Id: Ice0d8c7d869c9c46113d6ee6ba3adf895a71d58f
2019-09-16 08:17:12 +02:00
Qt Forward Merge Bot
7a7c60d4b6 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I5d587b79b96d2b44f1975419a658c259c63fa30d
2019-09-08 11:32:16 +02:00
Qt Forward Merge Bot
d9e2ca7e1e Merge remote-tracking branch 'origin/5.12.5' into 5.12
Change-Id: Ic73262146f51a9e7f4ffab46511654ad70c4f514
2019-09-07 13:10:03 +02:00
Pavel Tumakaev
c3960e5997 Fix deadlock in QWaylandWindow::waitForFrameSync
Calling the QOpenGLContext::swapBuffers from
QGuiApplicationPrivate::processExposeEvent in some cases leads to
recursive calls of QWaylandWindow::waitForFrameSync. Since the
mWaitingForFrameCallback check in WaylandWindow::waitForFrameSync
is performed after the mutex is locked, the QMutexLocker tries to lock the
mFrameSyncMutex mutex in every recursive call, that leads to a deadlock.
This patch moves the performing of the mWaitingForFrameCallback check
before locking the mutex.

Change-Id: Ia2d834b7dd03fcd91bbe29a3a897b4db2d155527
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-09-04 14:38:29 +03:00
Johan Klokkhammer Helsing
b7aaa2782a Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/client/qwaylandinputdevice.cpp
	src/client/qwaylandwindow.cpp

Change-Id: Ifd64debc484197829d2fe412afa98c29b382efa5
2019-09-03 07:24:14 +02:00
Johan Klokkhammer Helsing
090cf5c4b5 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/client/qwaylandinputdevice.cpp
	src/client/qwaylandintegration.cpp
	src/client/qwaylandwindow_p.h
	src/shared/qwaylandxkb.cpp

Change-Id: Ibac7998502351e93c71c9b786536298657afe3d0
2019-08-29 14:11:20 +02:00
Paul Olav Tvete
2bb9acf847 Merge remote-tracking branch 'qt/5.12' into 5.12.5
Conflicts:
	src/client/qwaylandwindow.cpp

Change-Id: I89fefe5bfc247eeaad3981850efa0faaab3cb145
2019-08-23 09:57:20 +02:00
David Edmundson
b4ee20efff Client: Make handleUpdate aware of exposure changes
The wl_surface can be destroyed whilst a render is happening. Calling
wl_surface::frame after the window is reset can crash as wl_surface is
null.

Fixes: QTBUG-77747
Change-Id: I139a9b234cb6acba81d6c1d5fa58629904a25053
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-08-21 17:59:21 +01:00
Johan Klokkhammer Helsing
ec510cb38c Client: Emit wl_surface lifetime signals on QWaylandWindow
Recent changes in QtBase means QtWayland will have to follow the convention of
the rest of the QPA plugins and have QPlatformSurfaceEvent::SurfaceCreated and
SurfaceAboutToBeDestroyed follow the QPlatformWindow (QWaylandWindow) lifetime
and not the lifetime of wl_surface.

Some users were depending on those events to get notified about wl_surface
changes and used QPlatformNativeInterface in order to get the window's
underlying wl_surfaces in responses to the events.

The good news is that QPlatformNativeInterface is private (QPA) API, so we can
provide an alternative by exposing new private API, which is what this patch
does.

The QWaylandWindow::wlSurfaceDestroyed signal already exists in the dev branch
(introduced in 04be9cf380), so this is a backport of that signal as well as an
addition of a new QWaylandWindow::wlSurfaceCreated signal.

Task-number: QTBUG-76324
Change-Id: Ibc5748474cd52f5b9461fd1ad6cef973491174b1
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
2019-08-19 14:13:50 +02:00
Paul Olav Tvete
254c76aba1 Merge remote-tracking branch 'qt/5.13' into dev
Change-Id: Ief5f30fc1dbd0e6531b19e723057b06e9bd419b4
2019-08-16 12:10:28 +02:00
Paul Olav Tvete
b58991121d Merge remote-tracking branch 'qt/5.12' into 5.13
Conflicts:
	src/compositor/configure.json
	sync.profile
	tests/auto/auto.pro

Change-Id: Ia6d1512aa9ad49ac7f92ae88f23026dc0ee2ccc5
2019-08-14 16:14:55 +02:00
Paul Olav Tvete
94b8d9deda Fix expose event compression
For shells that do not send configure events when exposed:
If setGeometry() was called before the window was initialized, Qt would
not mark the window as mapped, and the window would never become
visible.

Change-Id: Ic933cbbff20702424129c11264215181330cc7d1
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-08-13 11:54:41 +02:00
Qt Forward Merge Bot
7bc96702f4 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Id4304c7244dd1580d5bb18451e3dda5dabe6bcb3
2019-07-16 03:00:14 +02:00
Qt Forward Merge Bot
a5801f3f36 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	.qmake.conf

Change-Id: I436405677453e7df43258363c0d5c88d7b3790d0
2019-07-11 11:31:26 +02:00
Marc Mutz
4d2c78dae4 Fix compilation with C++20
Implicit capture of 'this' in [=] is deprecated in C++20.

Fix by using explicit captures.

Change-Id: Ie3a94ec60d7c56b2856d201fa3d68d0670bdd7b9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-08 17:22:27 +02:00
David Edmundson
32b338a8dc Client: Reset frame callback timer when hiding a window
If we hide a window whilst a compositor has a pending frame to show,
it's possible the compositor will not render the frame and not return
the callback.

If this happens on the next window expose we can be left with
mFrameCallbackTimedOut still true causing isExposed() to remain false
and us to not send the next buffer when we later show the window again.

Change-Id: I507410415d1a930fd5fa736412055e68fdf6c1d3
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-07-01 11:13:55 +02:00
Johan Klokkhammer Helsing
26c5d5e62b Client: Fix stuttering when the GUI thread is busy
When we did invokeMethod for handling the frame callbacks, we had to wait for
the GUI thread to finish whatever it's doing before we would stop blocking.

Fix it by clearing the frame callback timer and stop blocking immediately,
while delaying the rest of the work until it can be run on the other thread.

Fixes: QTBUG-76397
Change-Id: I343e4feac4838926b4fa2ccac2948988bc6c3bb7
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-06-20 14:04:04 +02:00
Qt Forward Merge Bot
c296df9d56 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ie2469da765326e1e2da35c0311c0405b0a691bfa
2019-06-08 03:00:51 +02:00
Johan Klokkhammer Helsing
4a9a5e2f62 Client: Don't add all windows to activePopups
Neither Qt::ToolTip nor Qt::Popup are single bits in Qt::WindowFlags, and do in
fact include Qt::Window. This meant that when we or'ed them and did a bitwise
and with QWindow::type(), we would match more types than just Qt::Popup and
Qt::ToolTip. We would for instance get any Qt::Window as well, which meant the
main window would be added to activePopups, leading to strange things
happening, such as crashes and the main window closing unexpectedly.

[ChangeLog][QPA plugin] Fixed a crash when closing multiple popups at once.

Fixes: QTBUG-76124
Change-Id: I1a6a59e161a436604a7ac8ab824396481dc99a20
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-06-05 14:12:55 +02:00
Qt Forward Merge Bot
2ce5094bda Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Ieab9f7c86371a7c047cf9b4a527fabcc541155e4
2019-06-11 03:00:05 +02:00
Marc Mutz
9f64f52e23 Eradicate Q_FOREACH loops [1/2]: trivial cases
In this patch, we port Q_FOREACH loops to C++11 ranged-for loops. All cases are
trivial in the sense that either the argument is already const or is trivially
marked as const, either by qAsConst(), or, in the case of rvalues, by storing
to a const auto temporary first.

In addition, all loop bodies are clear enough to confirm that the container we
iterate over is not changed under iteration. This does not exclude cases where
a loop is prematurely exited just after calling a modifier on the container, as
that is safe, if not especially elegant.

Change-Id: I87a63f07797437d421567d60e52305391a3c4f21
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-05-21 10:48:37 +02:00
Johan Klokkhammer Helsing
8607ca5ca2 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	src/client/qwaylanddisplay_p.h
	src/client/qwaylandwindow.cpp

Change-Id: I50eb5c83a8b81e4bdb032b68d41f429b17d0a74d
2019-05-07 12:39:12 +02:00
Liang Qi
3560ffefd2 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/client/qwaylandwindow_p.h

Change-Id: Ic4104c48267d1682bb58d6b38afc833c39515eae
2019-05-02 16:52:15 +02:00
Johan Klokkhammer Helsing
0a42470475 Client: Full implementation for frame callbacks (second try)
The Wayland plugin now takes full control over delivering update request and
implement frame callbacks for both egl and shm.

[ChangeLog][QPA plugin] The non-blocking version of eglSwapBuffers is now used, if
supported. This fixed a bug where minimized windows would block the event loop.

[ChangeLog][QPA plugin] Windows that don't get frame callbacks from the
compositor within 100 ms are now set as not exposed. This should stop most
clients from rendering unnecessary frames to minimized or hidden windows.

Also, when we relied on the QPA version of requestUpdate, we would sometimes
deliver one update request while we were waiting for a frame callback. When we
implement the fallback timer ourselves we can make sure we only deliver the
fallback if there are no pending frame callbacks.

QtQuick and other applications often depend on blocking swapBuffers to throttle
animations. If the context's surface format has a non-zero swapInterval, try to
emulate a blocking swap.

Fixes: QTBUG-69077
Change-Id: I3c6964f31a16e9aff70b8ec3c5340e640a30fef2
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-04-24 12:09:30 +00:00
Liang Qi
9f450e62b9 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/client/qwaylanddisplay_p.h

Change-Id: Ie84862aa41623c11abd8f882f428054f30062c77
2019-04-16 09:46:53 +02:00
David Edmundson
637e03a6f3 Client: Avoid shadowing QPlatformWindow::windowGeometry
windowGeometry is an existing method in QPlatformWindow with an entirely
different meaning to the newly added
QWaylandWindow::windowGeometry.

This led to the existing call in resizeFromApplyConfigure calling the
wrong method.

Change-Id: Ib344cf09178e77e5b4d5427325d840346663ec9d
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-04-11 12:51:52 +00:00
Johan Klokkhammer Helsing
24be607d50 Client: Remove QWaylandWindow wl_surface inheritance
...and introduce a client-side QWaylandSurface.

The goal of this is to remove the assumption that a QWaylandWindow maps 1:1
with a wl_surface and also to be able to share implementation with the cursor
implementation and other parts of the plugin that needs to use surfaces, but
are not QWaylandWindows.

QWaylandWindow and QWaylandSurface are still tightly coupled and a lot of the
implementation remains as part of QWaylandWindow, but I'm hoping to fix this in
later patch sets.

Task-number: QTBUG-74373
Change-Id: Ia5a192c8d133847336d266f63ec216fb3639b8c5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-04-10 06:14:22 +00:00
Johan Klokkhammer Helsing
c6cb08225d Client: Don't be exposed if we want to create a sub or shell surface
Because some shells don't allow attaching buffers before configure, we need to
not be exposed until we know that we don't want a shell surface.

Change-Id: Ida7101a99f953d02cf6401e4ea8d28cfabd6e102
Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2019-04-08 07:51:16 +00:00
Qt Forward Merge Bot
5de4be4185 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I735eb66a8469216029a1225080f49bfdcd3f0732
2019-03-29 10:40:00 +01:00
Kai Koehne
3d147d01e3 Fix compilation with QT_NO_WARNING_OUTPUT
Use qCWarning instead of qWarning if logging into a category. This
fixes compilation with QT_NO_WARNING_OUPUT, but in addition also
avoids unnecessary string formatting if the category is disabled.

Fixes: QTBUG-74359
Change-Id: I0e316a833f3f7d4a9122377a1154e739bcb080b1
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-03-22 14:14:19 +00:00
Paul Olav Tvete
dfd4633804 Merge remote-tracking branch 'qt/5.13' into dev
Change-Id: I3dc204fcaa71c01a80b0c622443012eb07964431
2019-03-21 11:57:15 +01:00
Robin Burchell
df531a6f3c Client: Implement wl_pointer version 5
Version 5 adds frame events, which groups multiple pointer events together,
enabling diagonal scrolling, leave and enter without an intermediate state, and
together with the new axis_source, axis_discrete and axis_stop also adds what
needed to differentiate between wheel events and touchpad scrolling.

This patch adds scroll phases and pixel deltas to QWaylandInputDevice, and
makes sure handleWheelEvent is called accordingly.

[ChangeLog][QPA plugin] Pixel delta is now set for mouse scrolling events if
originating from an appropriate device such as a touch pad (requires compositor
support for wl_seat version 5 or later).

Fixes: QTBUG-69876
Fixes: QTBUG-63720
Change-Id: I094a1ef0365893bee135cae7e6df89fafdafa2f2
Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
2019-03-14 13:12:00 +00:00