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>
This commit is contained in:
parent
cb68cead89
commit
ec510cb38c
@ -210,7 +210,9 @@ void QWaylandWindow::initWindow()
|
||||
|
||||
void QWaylandWindow::initializeWlSurface()
|
||||
{
|
||||
Q_ASSERT(!isInitialized());
|
||||
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
||||
emit wlSurfaceCreated();
|
||||
}
|
||||
|
||||
bool QWaylandWindow::shouldCreateShellSurface() const
|
||||
@ -245,8 +247,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
|
||||
mShellSurface = nullptr;
|
||||
delete mSubSurfaceWindow;
|
||||
mSubSurfaceWindow = nullptr;
|
||||
if (isInitialized())
|
||||
if (isInitialized()) {
|
||||
emit wlSurfaceDestroyed();
|
||||
destroy();
|
||||
}
|
||||
mScreens.clear();
|
||||
|
||||
if (mFrameCallback) {
|
||||
|
@ -199,6 +199,10 @@ public:
|
||||
public slots:
|
||||
void applyConfigure();
|
||||
|
||||
signals:
|
||||
void wlSurfaceCreated();
|
||||
void wlSurfaceDestroyed();
|
||||
|
||||
protected:
|
||||
void surface_enter(struct ::wl_output *output) override;
|
||||
void surface_leave(struct ::wl_output *output) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user