c55de7b70b
Currently, the committed signal is emitted after the client has called wl_surface.commit. However, this breaks with synchronized subsurfaces. Notably, Firefox splits a web page in a bunch of smaller layers, which can be backed by wl_subsurface objects. All the subsurfaces are in the sync mode. If a layer needs to be repainted, Firefox will commit the corresponding subsurface with a frame callback. Since the committed signal is emitted when the wl_surface.commit request is invoked, kwin will schedule a new frame immediately. Meaning, that it is quite likely that firefox will have old contents. The right thing to do would be to schedule a frame when all the ancestors of the layer subsurface have been committed. This change re-jitters the commit logic so the committed signal is emitted when a new state is applied to the surface. It also slightly cleans up how SubSurfaceInterface::parentCommit() is called. It will be nice to cleanup the commit logic further by calling the surface role's commit hook unconditionally, i.e. not check whether it's a subsurface. But doing so may result in infinite recursions. How to clean up that is still TBD.
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "subcompositor_interface.h"
|
|
#include "surfacerole_p.h"
|
|
|
|
#include <QPoint>
|
|
#include <QPointer>
|
|
|
|
#include "qwayland-server-wayland.h"
|
|
|
|
namespace KWaylandServer
|
|
{
|
|
|
|
class SubCompositorInterfacePrivate : public QtWaylandServer::wl_subcompositor
|
|
{
|
|
public:
|
|
SubCompositorInterfacePrivate(Display *display, SubCompositorInterface *q);
|
|
|
|
SubCompositorInterface *q;
|
|
|
|
protected:
|
|
void subcompositor_destroy(Resource *resource) override;
|
|
void subcompositor_get_subsurface(Resource *resource, uint32_t id,
|
|
struct ::wl_resource *surface_resource,
|
|
struct ::wl_resource *parent_resource) override;
|
|
};
|
|
|
|
class SubSurfaceInterfacePrivate : public SurfaceRole, public QtWaylandServer::wl_subsurface
|
|
{
|
|
public:
|
|
static SubSurfaceInterfacePrivate *get(SubSurfaceInterface *subsurface);
|
|
|
|
SubSurfaceInterfacePrivate(SubSurfaceInterface *q, SurfaceInterface *surface,
|
|
SurfaceInterface *parent, ::wl_resource *resource);
|
|
|
|
void commit() override;
|
|
void parentCommit();
|
|
|
|
SubSurfaceInterface *q;
|
|
QPoint position = QPoint(0, 0);
|
|
QPoint pendingPosition = QPoint(0, 0);
|
|
SubSurfaceInterface::Mode mode = SubSurfaceInterface::Mode::Synchronized;
|
|
QPointer<SurfaceInterface> surface;
|
|
QPointer<SurfaceInterface> parent;
|
|
bool hasPendingPosition = false;
|
|
|
|
protected:
|
|
void subsurface_destroy_resource(Resource *resource) override;
|
|
void subsurface_destroy(Resource *resource) override;
|
|
void subsurface_set_position(Resource *resource, int32_t x, int32_t y) override;
|
|
void subsurface_place_above(Resource *resource, struct ::wl_resource *sibling_resource) override;
|
|
void subsurface_place_below(Resource *resource, struct ::wl_resource *sibling_resource) override;
|
|
void subsurface_set_sync(Resource *resource) override;
|
|
void subsurface_set_desync(Resource *resource) override;
|
|
};
|
|
|
|
} // namespace KWaylandServer
|