Source code

Revision control

Other Tools

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at */
#ifndef __nsClipboardWaylandAsync_h_
#define __nsClipboardWaylandAsync_h_
#include <gtk/gtk.h>
#include <gdk/gdkwayland.h>
#include <nsTArray.h>
#include "mozilla/Mutex.h"
#include "nsIThread.h"
#include "mozilla/UniquePtr.h"
#include "nsClipboard.h"
#include "nsWaylandDisplay.h"
class nsRetrievalContextWaylandAsync : public nsRetrievalContext {
// Successful call of GetClipboardData()/GetClipboardText() needs to be paired
// with ReleaseClipboardData().
virtual const char* GetClipboardData(const char* aMimeType,
int32_t aWhichClipboard,
uint32_t* aContentLength) override;
virtual const char* GetClipboardText(int32_t aWhichClipboard) override;
virtual void ReleaseClipboardData(const char* aClipboardData) override;
// GetTargets() uses clipboard data internally so it can't be used between
// GetClipboardData()/GetClipboardText() and ReleaseClipboardData() calls.
virtual GdkAtom* GetTargets(int32_t aWhichClipboard,
int* aTargetNum) override;
void TransferAsyncClipboardData(ClipboardDataType aDataType,
int aClipboardRequestNumber,
const void* aData);
bool HasSelectionSupport(void) override { return true; }
bool WaitForClipboardContent();
int mClipboardRequestNumber;
bool mClipboardDataReceived;
char* mClipboardData;
uint32_t mClipboardDataLength;
mozilla::Mutex mMutex;
#endif /* __nsClipboardWayland_h_ */