| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #include "waylandxdgactivationv1_p.h" |
| 8 | #include <QGuiApplication> |
| 9 | |
| 10 | WaylandXdgActivationV1::WaylandXdgActivationV1() |
| 11 | : QWaylandClientExtensionTemplate<WaylandXdgActivationV1>(1) |
| 12 | { |
| 13 | initialize(); |
| 14 | } |
| 15 | |
| 16 | WaylandXdgActivationV1::~WaylandXdgActivationV1() |
| 17 | { |
| 18 | if (qGuiApp && isActive()) { |
| 19 | destroy(); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | WaylandXdgActivationV1 *WaylandXdgActivationV1::self() |
| 24 | { |
| 25 | static WaylandXdgActivationV1 *instance = new WaylandXdgActivationV1; |
| 26 | return instance; |
| 27 | } |
| 28 | |
| 29 | WaylandXdgActivationTokenV1 * |
| 30 | WaylandXdgActivationV1::requestXdgActivationToken(wl_seat *seat, struct ::wl_surface *surface, uint32_t serial, const QString &app_id) |
| 31 | { |
| 32 | auto wl = get_activation_token(); |
| 33 | auto provider = new WaylandXdgActivationTokenV1; |
| 34 | provider->init(object: wl); |
| 35 | |
| 36 | if (surface) |
| 37 | provider->set_surface(surface); |
| 38 | |
| 39 | if (!app_id.isEmpty()) |
| 40 | provider->set_app_id(app_id); |
| 41 | |
| 42 | if (seat) |
| 43 | provider->set_serial(serial, seat); |
| 44 | provider->commit(); |
| 45 | return provider; |
| 46 | } |
| 47 | |
| 48 | #include "moc_waylandxdgactivationv1_p.cpp" |
| 49 |
