Accepting request 754286 from home:Vogtinator:qt5.14

Qt 5.14.0 RC1

OBS-URL: https://build.opensuse.org/request/show/754286
OBS-URL: https://build.opensuse.org/package/show/KDE:Qt:5.14/libqt5-qtwayland?expand=0&rev=5
This commit is contained in:
Luca Beltrame
2019-12-05 09:41:18 +00:00
committed by Git OBS Bridge
parent 2b8b1516e6
commit f1a402d71f
5 changed files with 142 additions and 6 deletions

View File

@@ -0,0 +1,122 @@
From 8a200369acf25841cb4fbfbc6b3866d851388306 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Thu, 28 Nov 2019 02:31:17 +0100
Subject: [PATCH] Avoid animating single frame cursors
Currently to determine if a cursor is animated or not we check the
cursor theme delay.
This doesn't work in practice as by default many cursor themes have a
delay of 50 set even if they don't animate.
This comes from xcursorgen which specifies a delay of 50ms if there
isn't anything set in the config.
(https://github.com/freedesktop/xcursorgen/blob/master/xcursorgen.c#L92)
Given many themes will have a delay we should also check the number of
images in a given cursor.
In order to do that without a double lookup QWaylandCursor needed to
return the native wl_cursor, not wl_cursor_image and move the relevant
logic.
Change-Id: Ie782ace8054910ae76e61cab33ceca0377194929
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
---
src/client/qwaylandcursor.cpp | 12 ++----------
src/client/qwaylandcursor_p.h | 3 +--
src/client/qwaylandinputdevice.cpp | 16 ++++++++++++----
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/client/qwaylandcursor.cpp b/src/client/qwaylandcursor.cpp
index 4356b23a..1d3d88be 100644
--- a/src/client/qwaylandcursor.cpp
+++ b/src/client/qwaylandcursor.cpp
@@ -219,7 +219,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
return nullptr;
}
-::wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation)
+::wl_cursor *QWaylandCursorTheme::cursor(Qt::CursorShape shape)
{
struct wl_cursor *waylandCursor = nullptr;
@@ -237,15 +237,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
return nullptr;
}
- int frame = wl_cursor_frame(waylandCursor, millisecondsIntoAnimation);
- ::wl_cursor_image *image = waylandCursor->images[frame];
- ::wl_buffer *buffer = wl_cursor_image_get_buffer(image);
- if (!buffer) {
- qCWarning(lcQpaWayland) << "Could not find buffer for cursor";
- return nullptr;
- }
-
- return image;
+ return waylandCursor;
}
QWaylandCursor::QWaylandCursor(QWaylandDisplay *display)
diff --git a/src/client/qwaylandcursor_p.h b/src/client/qwaylandcursor_p.h
index a4605f3d..751ffa68 100644
--- a/src/client/qwaylandcursor_p.h
+++ b/src/client/qwaylandcursor_p.h
@@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme
public:
static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName);
~QWaylandCursorTheme();
- ::wl_cursor_image *cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation = 0);
+ ::wl_cursor *cursor(Qt::CursorShape shape);
private:
enum WaylandCursor {
@@ -129,7 +129,6 @@ public:
void setPos(const QPoint &pos) override;
static QSharedPointer<QWaylandBuffer> cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor);
- struct wl_cursor_image *cursorImage(Qt::CursorShape shape);
private:
QWaylandDisplay *mDisplay = nullptr;
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index a4098edd..d812918e 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -283,8 +283,8 @@ void QWaylandInputDevice::Pointer::updateCursorTheme()
if (!mCursor.theme)
return; // A warning has already been printed in loadCursorTheme
- if (auto *arrow = mCursor.theme->cursorImage(Qt::ArrowCursor)) {
- int arrowPixelSize = qMax(arrow->width, arrow->height); // Not all cursor themes are square
+ if (auto *arrow = mCursor.theme->cursor(Qt::ArrowCursor)) {
+ int arrowPixelSize = qMax(arrow->images[0]->width, arrow->images[0]->height); // Not all cursor themes are square
while (scale > 1 && arrowPixelSize / scale < cursorSize())
--scale;
} else {
@@ -326,12 +326,20 @@ void QWaylandInputDevice::Pointer::updateCursor()
// Set from shape using theme
uint time = seat()->mCursor.animationTimer.elapsed();
- if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape, time)) {
+
+ if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) {
+ int frame = wl_cursor_frame(waylandCursor, time);
+ ::wl_cursor_image *image = waylandCursor->images[frame];
+
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
+ if (!buffer) {
+ qCWarning(lcQpaWayland) << "Could not find buffer for cursor" << shape;
+ return;
+ }
int bufferScale = mCursor.themeBufferScale;
QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale;
QSize size = QSize(image->width, image->height) / bufferScale;
- bool animated = image->delay > 0;
+ bool animated = waylandCursor->image_count > 1 && image->delay > 0;
getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated);
return;
}
--
2.23.0

View File

@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Wed Dec 4 14:38:13 UTC 2019 - Fabian Vogt <fabian@ritter-vogt.de>
- Update to 5.14.0-rc:
* New bugfix release
* No changelog available
* For more details please see:
* For more details about Qt 5.14 please see:
https://wiki.qt.io/New_Features_in_Qt_5.14
- Add patch to address performance regression (kde#412924):
* 0001-Avoid-animating-single-frame-cursors.patch
-------------------------------------------------------------------
Tue Nov 12 13:03:32 UTC 2019 - Fabian Vogt <fabian@ritter-vogt.de>

View File

@@ -19,11 +19,11 @@
%define qt5_snapshot 0
%define libname libQt5WaylandCompositor5
%define base_name libqt5
%define real_version 5.14.0-beta3
%define real_version 5.14.0-rc
%define so_version 5.14.0
%define tar_version qtwayland-everywhere-src-5.14.0-beta3
%define tar_version qtwayland-everywhere-src-5.14.0-rc
Name: libqt5-qtwayland
Version: 5.14.0~beta3
Version: 5.14.0~rc
Release: 0
Summary: Qt 5 Wayland Addon
License: LGPL-2.1-with-Qt-Company-Qt-exception-1.1 or LGPL-3.0-only
@@ -31,6 +31,8 @@ Group: Development/Libraries/X11
Url: https://www.qt.io
Source: https://download.qt.io/development_releases/qt/5.14/%{real_version}/submodules/%{tar_version}.tar.xz
Source1: baselibs.conf
# PATCH-FIX-UPSTREAM
Patch1: 0001-Avoid-animating-single-frame-cursors.patch
# PATCH-FIX-OPENSUSE
Patch100: fix-return-nonvoid-function.patch
BuildRequires: fdupes

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:890c362c8d9e23d8b927b402999d2cb497ce30635c77d0fdb87b66d3943650e0
size 543084

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:25beeafb0965610a07b5e3c25739cd3a3ce7b2d3b02b3705ed6616a483e0e969
size 546284