Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[lipstick] Emit a signal when a client closes a window. Contributes t…
…o JB#52857
  • Loading branch information
adenexter committed Feb 15, 2021
1 parent 82d9d3a commit 4a70722
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions protocol/alien-manager.xml
Expand Up @@ -205,6 +205,13 @@
</description>
</request>

<request name="terminated">
<description summary="notifies that the application terminated abnormally">
This notifies that the application associated with the surface has
terminated abnormally.
</description>
</request>

<event name="close">
<description summary="request to close this surface">
This event requests the client to destroy this surface. The client is
Expand Down
8 changes: 8 additions & 0 deletions src/compositor/alienmanager/aliensurface.cpp
Expand Up @@ -15,6 +15,7 @@
#include <QtCompositor/QWaylandSurface>

#include "lipstickcompositor.h"
#include "lipstickcompositorwindow.h"
#include "aliensurface.h"
#include "alienmanager.h"
#include "lipsticksurfaceinterface.h"
Expand Down Expand Up @@ -124,6 +125,13 @@ void AlienSurface::alien_surface_set_minimized(Resource *resource)
emit surface()->lowerRequested();
}

void AlienSurface::alien_surface_terminated(Resource *resource)
{
Q_UNUSED(resource);

disconnect(surface(), &QWaylandSurface::clientDestroyedSurface, nullptr, nullptr);
}

void AlienSurface::configure(bool hasBuffer)
{
if (hasBuffer && m_serial == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/compositor/alienmanager/aliensurface.h
Expand Up @@ -36,7 +36,7 @@ class AlienSurface : public QObject, public QWaylandSurfaceInterface, public Qt
void alien_surface_ack_configure(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE;
void alien_surface_request_state(Resource *resource, wl_array *states, uint32_t serial) Q_DECL_OVERRIDE;
void alien_surface_set_minimized(Resource *resource) Q_DECL_OVERRIDE;

void alien_surface_terminated(Resource *resource) Q_DECL_OVERRIDE;
private:
void configure(bool hasBuffer);
void sendConfigure(int width, int height);
Expand Down
2 changes: 2 additions & 0 deletions src/compositor/lipstickcompositorwindow.cpp
Expand Up @@ -47,6 +47,8 @@ LipstickCompositorWindow::LipstickCompositorWindow(int windowId, const QString &

if (surface) {
m_isAlien = surface->property("alienSurface").toBool();

connect(surface, &QWaylandSurface::clientDestroyedSurface, this, &LipstickCompositorWindow::closed);
}

connectSurfaceSignals();
Expand Down
1 change: 1 addition & 0 deletions src/compositor/lipstickcompositorwindow.h
Expand Up @@ -90,6 +90,7 @@ class LIPSTICK_EXPORT LipstickCompositorWindow : public QWaylandSurfaceItem
void committed();
void focusOnTouchChanged();
void resized();
void closed();

private slots:
void handleTouchCancel();
Expand Down

0 comments on commit 4a70722

Please sign in to comment.