parent
1ccd95eb00
commit
4c48722c59
6 changed files with 156 additions and 2 deletions
@ -0,0 +1,67 @@ |
||||
/*
|
||||
SPDX-FileCopyrightText: 2023 David Redondo <kde@david-redondo.de> |
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
||||
*/ |
||||
|
||||
#include "xdgsystembell_v1.h" |
||||
|
||||
#include "clientconnection.h" |
||||
#include "display.h" |
||||
#include "surface.h" |
||||
|
||||
#include <qwayland-server-xdg-system-bell-v1.h> |
||||
|
||||
namespace KWin |
||||
{ |
||||
|
||||
static constexpr int version = 1; |
||||
|
||||
class XdgSystemBellV1InterfacePrivate : public QtWaylandServer::xdg_system_bell_v1 |
||||
{ |
||||
public: |
||||
XdgSystemBellV1InterfacePrivate(XdgSystemBellV1Interface *q, Display *display); |
||||
|
||||
XdgSystemBellV1Interface *q; |
||||
Display *display; |
||||
|
||||
protected: |
||||
void xdg_system_bell_v1_ring(Resource *resource, wl_resource *surface) override; |
||||
void xdg_system_bell_v1_destroy(Resource *resource) override; |
||||
}; |
||||
|
||||
XdgSystemBellV1InterfacePrivate::XdgSystemBellV1InterfacePrivate(XdgSystemBellV1Interface *q, Display *display) |
||||
: QtWaylandServer::xdg_system_bell_v1(*display, version) |
||||
, q(q) |
||||
, display(display) |
||||
{ |
||||
} |
||||
|
||||
void XdgSystemBellV1InterfacePrivate::xdg_system_bell_v1_destroy(Resource *resource) |
||||
{ |
||||
wl_resource_destroy(resource->handle); |
||||
} |
||||
|
||||
void XdgSystemBellV1InterfacePrivate::xdg_system_bell_v1_ring(Resource *resource, wl_resource *surface_resource) |
||||
{ |
||||
if (surface_resource) { |
||||
auto surface = SurfaceInterface::get(surface_resource); |
||||
Q_EMIT q->ringSurface(surface); |
||||
return; |
||||
} |
||||
Q_EMIT q->ring(display->getConnection(resource->client())); |
||||
} |
||||
|
||||
XdgSystemBellV1Interface::XdgSystemBellV1Interface(Display *display, QObject *parent) |
||||
: QObject(parent) |
||||
, d(std::make_unique<XdgSystemBellV1InterfacePrivate>(this, display)) |
||||
{ |
||||
} |
||||
|
||||
XdgSystemBellV1Interface::~XdgSystemBellV1Interface() = default; |
||||
|
||||
void XdgSystemBellV1Interface::remove() |
||||
{ |
||||
d->globalRemove(); |
||||
} |
||||
} |
||||
@ -0,0 +1,37 @@ |
||||
/*
|
||||
SPDX-FileCopyrightText: 2023 David Redondo <kde@david-redondo.de> |
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
||||
*/ |
||||
|
||||
#pragma once |
||||
|
||||
#include "kwin_export.h" |
||||
|
||||
#include <QObject> |
||||
|
||||
#include <memory> |
||||
|
||||
namespace KWin |
||||
{ |
||||
class ClientConnection; |
||||
class Display; |
||||
class SurfaceInterface; |
||||
class XdgSystemBellV1InterfacePrivate; |
||||
|
||||
class KWIN_EXPORT XdgSystemBellV1Interface : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
XdgSystemBellV1Interface(Display *display, QObject *parent = nullptr); |
||||
~XdgSystemBellV1Interface(); |
||||
|
||||
void remove(); |
||||
Q_SIGNALS: |
||||
void ring(ClientConnection *client); |
||||
void ringSurface(SurfaceInterface *surface); |
||||
|
||||
private: |
||||
std::unique_ptr<XdgSystemBellV1InterfacePrivate> d; |
||||
}; |
||||
} |
||||
Loading…
Reference in new issue