src/video/wayland/SDL_waylanddatamanager.h
changeset 10583 974f8ebcb819
child 10737 3406a0f8b041
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/video/wayland/SDL_waylanddatamanager.h	Sun Nov 06 08:34:27 2016 -0800
     1.3 @@ -0,0 +1,105 @@
     1.4 +/*
     1.5 +  Simple DirectMedia Layer
     1.6 +  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
     1.7 +
     1.8 +  This software is provided 'as-is', without any express or implied
     1.9 +  warranty.  In no event will the authors be held liable for any damages
    1.10 +  arising from the use of this software.
    1.11 +
    1.12 +  Permission is granted to anyone to use this software for any purpose,
    1.13 +  including commercial applications, and to alter it and redistribute it
    1.14 +  freely, subject to the following restrictions:
    1.15 +
    1.16 +  1. The origin of this software must not be misrepresented; you must not
    1.17 +     claim that you wrote the original software. If you use this software
    1.18 +     in a product, an acknowledgment in the product documentation would be
    1.19 +     appreciated but is not required.
    1.20 +  2. Altered source versions must be plainly marked as such, and must not be
    1.21 +     misrepresented as being the original software.
    1.22 +  3. This notice may not be removed or altered from any source distribution.
    1.23 +*/
    1.24 +
    1.25 +#include "../../SDL_internal.h"
    1.26 +
    1.27 +#ifndef _SDL_waylanddatamanager_h
    1.28 +#define _SDL_waylanddatamanager_h
    1.29 +
    1.30 +#include "SDL_waylandvideo.h"
    1.31 +#include "SDL_waylandwindow.h"
    1.32 +
    1.33 +#define TEXT_MIME "text/plain;charset=utf-8"
    1.34 +#define FILE_MIME "text/uri-list"
    1.35 +
    1.36 +typedef struct {
    1.37 +    char *mime_type;
    1.38 +    void *data;
    1.39 +    size_t length;
    1.40 +    struct wl_list link;
    1.41 +} SDL_MimeDataList;
    1.42 +
    1.43 +typedef struct {
    1.44 +    struct wl_data_source *source;
    1.45 +    struct wl_list mimes;
    1.46 +} SDL_WaylandDataSource;
    1.47 +
    1.48 +typedef struct {
    1.49 +    struct wl_data_offer *offer;
    1.50 +    struct wl_list mimes;
    1.51 +    void *data_device;
    1.52 +} SDL_WaylandDataOffer;
    1.53 +
    1.54 +typedef struct {
    1.55 +    struct wl_data_device *data_device;
    1.56 +    SDL_VideoData *video_data;
    1.57 +
    1.58 +    /* Drag and Drop */
    1.59 +    uint32_t drag_serial;
    1.60 +    SDL_WaylandDataOffer *drag_offer;
    1.61 +    SDL_WaylandDataOffer *selection_offer;
    1.62 +
    1.63 +    /* Clipboard */
    1.64 +    uint32_t selection_serial;
    1.65 +    SDL_WaylandDataSource *selection_source;
    1.66 +} SDL_WaylandDataDevice;
    1.67 +
    1.68 +extern const char* Wayland_convert_mime_type(const char *mime_type);
    1.69 +
    1.70 +/* Wayland Data Source - (Sending) */
    1.71 +extern SDL_WaylandDataSource* Wayland_data_source_create(_THIS);
    1.72 +extern ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source, 
    1.73 +                                        const char *mime_type, int fd);
    1.74 +extern int Wayland_data_source_add_data(SDL_WaylandDataSource *source,
    1.75 +                                        const char *mime_type, 
    1.76 +                                        const void *buffer, 
    1.77 +                                        size_t length);
    1.78 +extern SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source,
    1.79 +                                             const char *mime_type);
    1.80 +extern void* Wayland_data_source_get_data(SDL_WaylandDataSource *source,
    1.81 +                                          size_t *length,
    1.82 +                                          const char *mime_type,
    1.83 +                                          SDL_bool null_terminate);
    1.84 +extern void Wayland_data_source_destroy(SDL_WaylandDataSource *source);
    1.85 +
    1.86 +/* Wayland Data Offer - (Receiving) */
    1.87 +extern void* Wayland_data_offer_receive(SDL_WaylandDataOffer *offer,
    1.88 +                                        size_t *length,
    1.89 +                                        const char *mime_type,
    1.90 +                                        SDL_bool null_terminate);
    1.91 +extern SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer,
    1.92 +                                            const char *mime_type);
    1.93 +extern int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer,
    1.94 +                                       const char *mime_type);
    1.95 +extern void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer);
    1.96 +
    1.97 +/* Clipboard */
    1.98 +extern int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device);
    1.99 +extern int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device,
   1.100 +                                             SDL_WaylandDataSource *source);
   1.101 +extern int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device,
   1.102 +                                          uint32_t serial);
   1.103 +#endif /* _SDL_waylanddatamanager_h */
   1.104 +
   1.105 +/* vi: set ts=4 sw=4 expandtab: */
   1.106 +
   1.107 +
   1.108 +