1 /*
2 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
3 SPDX-FileCopyrightText: 2021 Francesco Sorrentino <francesco.sorr@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only
6 */
7 #pragma once
8
9 #include <QObject>
10
11 namespace Wrapland::Client
12 {
13
14 template<typename PrivateSource, typename WlSource>
send_callback(void * data,WlSource * dataSource,const char * mimeType,int32_t fd)15 void send_callback(void* data, WlSource* dataSource, const char* mimeType, int32_t fd)
16 {
17 auto d = reinterpret_cast<PrivateSource*>(data);
18 Q_ASSERT(d->source == dataSource);
19 Q_EMIT d->q->sendDataRequested(QString::fromUtf8(mimeType), fd);
20 }
21
22 template<typename PrivateSource, typename WlSource>
cancelled_callback(void * data,WlSource * dataSource)23 void cancelled_callback(void* data, WlSource* dataSource)
24 {
25 auto d = reinterpret_cast<PrivateSource*>(data);
26 Q_ASSERT(d->source == dataSource);
27 Q_EMIT d->q->cancelled();
28 }
29
30 }
31