widget/gtk/nsClipboardWayland.h
author André Bargull <andre.bargull@gmail.com>
Tue, 05 Dec 2017 04:24:41 -0800
changeset 401144 8b6bb4335d4bb4e47045921aebe730113e9bd693
parent 398753 86b56bad2991ef010d48e38b2ad70ddc142a9e6b
child 404382 1f5f5fe0abea007f339aa361970fd75ab0b84589
permissions -rw-r--r--
Bug 1422415 - Part 2: Call _sprintf_l with C-locale to ensure result doesn't contain locale-dependent decimal separator. r=Waldo

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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 http://mozilla.org/MPL/2.0/. */

#ifndef __nsClipboardWayland_h_
#define __nsClipboardWayland_h_

#include "nsIClipboard.h"
#include <gtk/gtk.h>
#include <gdk/gdkwayland.h>
#include <nsTArray.h>

class nsRetrievalContextWayland : public nsRetrievalContext
{
public:
    nsRetrievalContextWayland();

    virtual const char* GetClipboardData(const char* aMimeType,
                                         int32_t aWhichClipboard,
                                         uint32_t* aContentLength) override;
    virtual void ReleaseClipboardData(const char* aClipboardData) override;

    virtual GdkAtom* GetTargets(int32_t aWhichClipboard,
                                int* aTargetNum) override;

    void SetDataOffer(wl_data_offer *aDataOffer);
    void AddMIMEType(const char *aMimeType);
    void ResetMIMETypeList(void);
    void ConfigureKeyboard(wl_seat_capability caps);

    void InitDataDeviceManager(wl_registry *registry, uint32_t id, uint32_t version);
    void InitSeat(wl_registry *registry, uint32_t id, uint32_t version, void *data);
    virtual ~nsRetrievalContextWayland() override;

private:
    bool                        mInitialized;
    wl_display                 *mDisplay;
    wl_seat                    *mSeat;
    wl_data_device_manager     *mDataDeviceManager;
    wl_data_offer              *mDataOffer;
    wl_keyboard                *mKeyboard;
    nsTArray<GdkAtom>           mTargetMIMETypes;
    gchar                      *mTextPlainLocale;
};

#endif /* __nsClipboardWayland_h_ */