Bug 1734943 [wpt PR 31170] - Correct scrolling contents cull rect, a=testonly
[gecko.git] / widget / gtk / nsClipboardWaylandAsync.h
blob40b115968628871718bbea3fd8b42996b7d55d82
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
3 */
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_
11 #include <gtk/gtk.h>
12 #include <gdk/gdkwayland.h>
13 #include <nsTArray.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 {
22 public:
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,
40 const void* aData);
42 bool HasSelectionSupport(void) override { return true; }
44 private:
45 bool WaitForClipboardContent();
47 private:
48 int mClipboardRequestNumber;
49 bool mClipboardDataReceived;
50 char* mClipboardData;
51 uint32_t mClipboardDataLength;
52 mozilla::Mutex mMutex;
55 #endif /* __nsClipboardWayland_h_ */