SDL_waylanddatamanager.h
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef SDL_waylanddatamanager_h_
#define SDL_waylanddatamanager_h_
#include "SDL_waylandvideo.h"
#include "SDL_waylandwindow.h"
#define TEXT_MIME "text/plain;charset=utf-8"
#define FILE_MIME "text/uri-list"
typedef struct {
char *mime_type;
void *data;
size_t length;
struct wl_list link;
} SDL_MimeDataList;
typedef struct {
struct wl_data_source *source;
struct wl_list mimes;
} SDL_WaylandDataSource;
typedef struct {
struct wl_data_offer *offer;
struct wl_list mimes;
void *data_device;
} SDL_WaylandDataOffer;
typedef struct {
struct wl_data_device *data_device;
SDL_VideoData *video_data;
/* Drag and Drop */
uint32_t drag_serial;
SDL_WaylandDataOffer *drag_offer;
SDL_WaylandDataOffer *selection_offer;
/* Clipboard */
uint32_t selection_serial;
SDL_WaylandDataSource *selection_source;
} SDL_WaylandDataDevice;
extern const char* Wayland_convert_mime_type(const char *mime_type);
/* Wayland Data Source - (Sending) */
extern SDL_WaylandDataSource* Wayland_data_source_create(_THIS);
extern ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source,
const char *mime_type, int fd);
extern int Wayland_data_source_add_data(SDL_WaylandDataSource *source,
const char *mime_type,
const void *buffer,
size_t length);
extern SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source,
const char *mime_type);
extern void* Wayland_data_source_get_data(SDL_WaylandDataSource *source,
size_t *length,
const char *mime_type,
SDL_bool null_terminate);
extern void Wayland_data_source_destroy(SDL_WaylandDataSource *source);
/* Wayland Data Offer - (Receiving) */
extern void* Wayland_data_offer_receive(SDL_WaylandDataOffer *offer,
size_t *length,
const char *mime_type,
SDL_bool null_terminate);
extern SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer,
const char *mime_type);
extern int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer,
const char *mime_type);
extern void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer);
/* Clipboard */
extern int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device);
extern int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device,
SDL_WaylandDataSource *source);
extern int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device,
uint32_t serial);
#endif /* SDL_waylanddatamanager_h_ */
/* vi: set ts=4 sw=4 expandtab: */
Wayland_data_source_send
ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source, const char *mime_type, int fd)
Wayland_data_device_set_selection
int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device, SDL_WaylandDataSource *source)
Wayland_data_offer_has_mime
SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, const char *mime_type)
SDL_waylandwindow.h
SDL_MimeDataList::mime_type
char * mime_type
Definition: SDL_waylanddatamanager.h:34
SDL_MimeDataList::length
size_t length
Definition: SDL_waylanddatamanager.h:36
SDL_WaylandDataSource::source
struct wl_data_source * source
Definition: SDL_waylanddatamanager.h:41
SDL_WaylandDataDevice
Definition: SDL_waylanddatamanager.h:51
SDL_WaylandDataDevice::selection_source
SDL_WaylandDataSource * selection_source
Definition: SDL_waylanddatamanager.h:62
Wayland_data_source_has_mime
SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source, const char *mime_type)
device
static SDL_AudioDeviceID device
Definition: loopwave.c:37
Wayland_data_offer_destroy
void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer)
Wayland_data_source_destroy
void Wayland_data_source_destroy(SDL_WaylandDataSource *source)
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
Wayland_data_device_set_serial
int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device, uint32_t serial)
SDL_WaylandDataOffer
Definition: SDL_waylanddatamanager.h:45
SDL_WaylandDataDevice::drag_serial
uint32_t drag_serial
Definition: SDL_waylanddatamanager.h:56
source
GLsizei GLsizei GLchar * source
Definition: SDL_opengl_glext.h:677
Wayland_data_source_create
SDL_WaylandDataSource * Wayland_data_source_create(_THIS)
SDL_WaylandDataDevice::selection_serial
uint32_t selection_serial
Definition: SDL_waylanddatamanager.h:61
Wayland_data_offer_add_mime
int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer, const char *mime_type)
SDL_WaylandDataOffer::data_device
void * data_device
Definition: SDL_waylanddatamanager.h:48
SDL_WaylandDataDevice::video_data
SDL_VideoData * video_data
Definition: SDL_waylanddatamanager.h:53
SDL_waylandvideo.h
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
buffer
GLuint buffer
Definition: SDL_opengl_glext.h:533
Wayland_convert_mime_type
const char * Wayland_convert_mime_type(const char *mime_type)
uint32_t
unsigned int uint32_t
Definition: SDL_config_windows.h:63
SDL_WaylandDataDevice::data_device
struct wl_data_device * data_device
Definition: SDL_waylanddatamanager.h:52
SDL_MimeDataList::data
void * data
Definition: SDL_waylanddatamanager.h:35
SDL_WaylandDataDevice::selection_offer
SDL_WaylandDataOffer * selection_offer
Definition: SDL_waylanddatamanager.h:58
SDL_WaylandDataOffer::offer
struct wl_data_offer * offer
Definition: SDL_waylanddatamanager.h:46
SDL_VideoData
Definition: SDL_androidvideo.h:35
Wayland_data_device_clear_selection
int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device)
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:669
Wayland_data_offer_receive
void * Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, size_t *length, const char *mime_type, SDL_bool null_terminate)
Wayland_data_source_add_data
int Wayland_data_source_add_data(SDL_WaylandDataSource *source, const char *mime_type, const void *buffer, size_t length)
Wayland_data_source_get_data
void * Wayland_data_source_get_data(SDL_WaylandDataSource *source, size_t *length, const char *mime_type, SDL_bool null_terminate)
SDL_WaylandDataDevice::drag_offer
SDL_WaylandDataOffer * drag_offer
Definition: SDL_waylanddatamanager.h:57
fd
GLuint64 GLenum GLint fd
Definition: gl2ext.h:1508
SDL_WaylandDataSource
Definition: SDL_waylanddatamanager.h:40
SDL_MimeDataList
Definition: SDL_waylanddatamanager.h:33