src/video/wayland/SDL_waylanddatamanager.h
author Ryan C. Gordon
Mon, 23 Jan 2017 12:06:10 -0500
changeset 10837 c2f241c2f6ad
parent 10737 3406a0f8b041
child 11382 2c50e79b19e0
permissions -rw-r--r--
audio: Fix same bug as last commit, but for _mm_bslli_si128 vs _mm_slli_si128.
slouken@10583
     1
/*
slouken@10583
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
slouken@10583
     4
slouken@10583
     5
  This software is provided 'as-is', without any express or implied
slouken@10583
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@10583
     7
  arising from the use of this software.
slouken@10583
     8
slouken@10583
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@10583
    10
  including commercial applications, and to alter it and redistribute it
slouken@10583
    11
  freely, subject to the following restrictions:
slouken@10583
    12
slouken@10583
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@10583
    14
     claim that you wrote the original software. If you use this software
slouken@10583
    15
     in a product, an acknowledgment in the product documentation would be
slouken@10583
    16
     appreciated but is not required.
slouken@10583
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@10583
    18
     misrepresented as being the original software.
slouken@10583
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@10583
    20
*/
slouken@10583
    21
slouken@10583
    22
#include "../../SDL_internal.h"
slouken@10583
    23
slouken@10583
    24
#ifndef _SDL_waylanddatamanager_h
slouken@10583
    25
#define _SDL_waylanddatamanager_h
slouken@10583
    26
slouken@10583
    27
#include "SDL_waylandvideo.h"
slouken@10583
    28
#include "SDL_waylandwindow.h"
slouken@10583
    29
slouken@10583
    30
#define TEXT_MIME "text/plain;charset=utf-8"
slouken@10583
    31
#define FILE_MIME "text/uri-list"
slouken@10583
    32
slouken@10583
    33
typedef struct {
slouken@10583
    34
    char *mime_type;
slouken@10583
    35
    void *data;
slouken@10583
    36
    size_t length;
slouken@10583
    37
    struct wl_list link;
slouken@10583
    38
} SDL_MimeDataList;
slouken@10583
    39
slouken@10583
    40
typedef struct {
slouken@10583
    41
    struct wl_data_source *source;
slouken@10583
    42
    struct wl_list mimes;
slouken@10583
    43
} SDL_WaylandDataSource;
slouken@10583
    44
slouken@10583
    45
typedef struct {
slouken@10583
    46
    struct wl_data_offer *offer;
slouken@10583
    47
    struct wl_list mimes;
slouken@10583
    48
    void *data_device;
slouken@10583
    49
} SDL_WaylandDataOffer;
slouken@10583
    50
slouken@10583
    51
typedef struct {
slouken@10583
    52
    struct wl_data_device *data_device;
slouken@10583
    53
    SDL_VideoData *video_data;
slouken@10583
    54
slouken@10583
    55
    /* Drag and Drop */
slouken@10583
    56
    uint32_t drag_serial;
slouken@10583
    57
    SDL_WaylandDataOffer *drag_offer;
slouken@10583
    58
    SDL_WaylandDataOffer *selection_offer;
slouken@10583
    59
slouken@10583
    60
    /* Clipboard */
slouken@10583
    61
    uint32_t selection_serial;
slouken@10583
    62
    SDL_WaylandDataSource *selection_source;
slouken@10583
    63
} SDL_WaylandDataDevice;
slouken@10583
    64
slouken@10583
    65
extern const char* Wayland_convert_mime_type(const char *mime_type);
slouken@10583
    66
slouken@10583
    67
/* Wayland Data Source - (Sending) */
slouken@10583
    68
extern SDL_WaylandDataSource* Wayland_data_source_create(_THIS);
slouken@10583
    69
extern ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source, 
slouken@10583
    70
                                        const char *mime_type, int fd);
slouken@10583
    71
extern int Wayland_data_source_add_data(SDL_WaylandDataSource *source,
slouken@10583
    72
                                        const char *mime_type, 
slouken@10583
    73
                                        const void *buffer, 
slouken@10583
    74
                                        size_t length);
slouken@10583
    75
extern SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source,
slouken@10583
    76
                                             const char *mime_type);
slouken@10583
    77
extern void* Wayland_data_source_get_data(SDL_WaylandDataSource *source,
slouken@10583
    78
                                          size_t *length,
slouken@10583
    79
                                          const char *mime_type,
slouken@10583
    80
                                          SDL_bool null_terminate);
slouken@10583
    81
extern void Wayland_data_source_destroy(SDL_WaylandDataSource *source);
slouken@10583
    82
slouken@10583
    83
/* Wayland Data Offer - (Receiving) */
slouken@10583
    84
extern void* Wayland_data_offer_receive(SDL_WaylandDataOffer *offer,
slouken@10583
    85
                                        size_t *length,
slouken@10583
    86
                                        const char *mime_type,
slouken@10583
    87
                                        SDL_bool null_terminate);
slouken@10583
    88
extern SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer,
slouken@10583
    89
                                            const char *mime_type);
slouken@10583
    90
extern int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer,
slouken@10583
    91
                                       const char *mime_type);
slouken@10583
    92
extern void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer);
slouken@10583
    93
slouken@10583
    94
/* Clipboard */
slouken@10583
    95
extern int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device);
slouken@10583
    96
extern int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device,
slouken@10583
    97
                                             SDL_WaylandDataSource *source);
slouken@10583
    98
extern int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device,
slouken@10583
    99
                                          uint32_t serial);
slouken@10583
   100
#endif /* _SDL_waylanddatamanager_h */
slouken@10583
   101
slouken@10583
   102
/* vi: set ts=4 sw=4 expandtab: */
slouken@10583
   103
slouken@10583
   104
slouken@10583
   105