1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef __nsClipboardWaylandAsync_h_
9 #define __nsClipboardWaylandAsync_h_
12 #include <gdk/gdkwayland.h>
15 #include "mozilla/Mutex.h"
16 #include "nsIThread.h"
17 #include "mozilla/UniquePtr.h"
18 #include "nsClipboard.h"
19 #include "nsWaylandDisplay.h"
21 class nsRetrievalContextWaylandAsync
: public nsRetrievalContext
{
23 nsRetrievalContextWaylandAsync();
25 // Successful call of GetClipboardData()/GetClipboardText() needs to be paired
26 // with ReleaseClipboardData().
27 virtual const char* GetClipboardData(const char* aMimeType
,
28 int32_t aWhichClipboard
,
29 uint32_t* aContentLength
) override
;
30 virtual const char* GetClipboardText(int32_t aWhichClipboard
) override
;
31 virtual void ReleaseClipboardData(const char* aClipboardData
) override
;
33 // GetTargets() uses clipboard data internally so it can't be used between
34 // GetClipboardData()/GetClipboardText() and ReleaseClipboardData() calls.
35 virtual GdkAtom
* GetTargets(int32_t aWhichClipboard
,
36 int* aTargetNum
) override
;
38 void TransferAsyncClipboardData(ClipboardDataType aDataType
,
39 int aClipboardRequestNumber
,
42 bool HasSelectionSupport(void) override
{ return true; }
45 bool WaitForClipboardContent();
48 int mClipboardRequestNumber
;
49 bool mClipboardDataReceived
;
51 uint32_t mClipboardDataLength
;
52 mozilla::Mutex mMutex
;
55 #endif /* __nsClipboardWayland_h_ */