aboutsummaryrefslogtreecommitdiff
path: root/android-qemu2-glue/qemu-clipboard-agent-impl.cpp
blob: 0e7cf67dcaef478809507e5e4b32b2da09bda098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2016 The Android Open Source Project
//
// This software is licensed under the terms of the GNU General Public
// License version 2, as published by the Free Software Foundation, and
// may be copied, distributed, and modified under those terms.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

#include "android/emulation/control/clipboard_agent.h"

#include "android/emulation/ClipboardPipe.h"

static void set_guest_clipboard_callback(
        void(*cb)(const uint8_t*, size_t)) {
    android::emulation::ClipboardPipe::setGuestClipboardCallback(cb);
}

static void set_guest_clipboard_contents(const uint8_t* buf, size_t len) {
    android::emulation::ClipboardPipe* pipe =
        android::emulation::ClipboardPipe::Service::getPipeInstance();
    if (pipe) {
        pipe->setGuestClipboardContents(buf, len);
    }
}

static const QAndroidClipboardAgent clipboardAgent = {
    .setGuestClipboardCallback = set_guest_clipboard_callback,
    .setGuestClipboardContents = set_guest_clipboard_contents
};

extern "C" const QAndroidClipboardAgent* const gQAndroidClipboardAgent =
    &clipboardAgent;