FreeRDP
wlf_cliprdr.c File Reference
#include <freerdp/config.h>
#include <stdlib.h>
#include <winpr/crt.h>
#include <winpr/image.h>
#include <winpr/stream.h>
#include <winpr/clipboard.h>
#include <freerdp/log.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/channels/channels.h>
#include <freerdp/channels/cliprdr.h>
#include <freerdp/client/client_cliprdr_file.h>
#include "wlf_cliprdr.h"

Macros

#define TAG   CLIENT_TAG("wayland.cliprdr")
 
#define MAX_CLIPBOARD_FORMATS   255
 
#define mime_text_plain   "text/plain"
 
#define mime_text_utf8   mime_text_plain ";charset=utf-8"
 
#define BMP_MIME_LIST   "image/bmp", "image/x-bmp", "image/x-MS-bmp", "image/x-win-bitmap"
 

Functions

static void wlf_request_free (void *rq)
 
static wlf_request * wlf_request_new (void)
 
static void * wlf_request_clone (const void *oth)
 
static BOOL wlf_mime_is_file (const char *mime)
 
static BOOL wlf_mime_is_text (const char *mime)
 
static BOOL wlf_mime_is_image (const char *mime)
 
static BOOL wlf_mime_is_html (const char *mime)
 
static void wlf_cliprdr_free_server_formats (wfClipboard *clipboard)
 
static void wlf_cliprdr_free_client_formats (wfClipboard *clipboard)
 
static UINT wlf_cliprdr_send_client_format_list (wfClipboard *clipboard)
 
static void wfl_cliprdr_add_client_format_id (wfClipboard *clipboard, UINT32 formatId)
 
static BOOL wlf_cliprdr_add_client_format (wfClipboard *clipboard, const char *mime)
 
static UINT wlf_cliprdr_send_data_request (wfClipboard *clipboard, const wlf_request *rq)
 
static UINT wlf_cliprdr_send_data_response (wfClipboard *clipboard, const BYTE *data, size_t size)
 
BOOL wlf_cliprdr_handle_event (wfClipboard *clipboard, const UwacClipboardEvent *event)
 
static UINT wlf_cliprdr_send_client_capabilities (wfClipboard *clipboard)
 
static UINT wlf_cliprdr_send_client_format_list_response (wfClipboard *clipboard, BOOL status)
 
static UINT wlf_cliprdr_monitor_ready (CliprdrClientContext *context, const CLIPRDR_MONITOR_READY *monitorReady)
 
static UINT wlf_cliprdr_server_capabilities (CliprdrClientContext *context, const CLIPRDR_CAPABILITIES *capabilities)
 
static UINT32 wlf_get_server_format_id (const wfClipboard *clipboard, const char *name)
 
static const char * wlf_get_server_format_name (const wfClipboard *clipboard, UINT32 formatId)
 
static void wlf_cliprdr_transfer_data (UwacSeat *seat, void *context, const char *mime, int fd)
 
static void wlf_cliprdr_cancel_data (UwacSeat *seat, void *context)
 
static UINT wlf_cliprdr_server_format_list (CliprdrClientContext *context, const CLIPRDR_FORMAT_LIST *formatList)
 
static UINT wlf_cliprdr_server_format_list_response (CliprdrClientContext *context, const CLIPRDR_FORMAT_LIST_RESPONSE *formatListResponse)
 
static UINT wlf_cliprdr_server_format_data_request (CliprdrClientContext *context, const CLIPRDR_FORMAT_DATA_REQUEST *formatDataRequest)
 
static UINT wlf_cliprdr_server_format_data_response (CliprdrClientContext *context, const CLIPRDR_FORMAT_DATA_RESPONSE *formatDataResponse)
 
wfClipboard * wlf_clipboard_new (wlfContext *wfc)
 
void wlf_clipboard_free (wfClipboard *clipboard)
 
BOOL wlf_cliprdr_init (wfClipboard *clipboard, CliprdrClientContext *cliprdr)
 
BOOL wlf_cliprdr_uninit (wfClipboard *clipboard, CliprdrClientContext *cliprdr)
 

Variables

static const char * mime_text []
 
static const char mime_png [] = "image/png"
 
static const char mime_webp [] = "image/webp"
 
static const char mime_jpg [] = "image/jpeg"
 
static const char mime_tiff [] = "image/tiff"
 
static const char mime_uri_list [] = "text/uri-list"
 
static const char mime_html [] = "text/html"
 
static const char * mime_bitmap [] = { BMP_MIME_LIST }
 
static const char * mime_image [] = { mime_png, mime_webp, mime_jpg, mime_tiff, BMP_MIME_LIST }
 
static const char mime_gnome_copied_files [] = "x-special/gnome-copied-files"
 
static const char mime_mate_copied_files [] = "x-special/mate-copied-files"
 
static const char type_FileGroupDescriptorW [] = "FileGroupDescriptorW"
 
static const char type_HtmlFormat [] = "HTML Format"
 

Macro Definition Documentation

◆ BMP_MIME_LIST

#define BMP_MIME_LIST   "image/bmp", "image/x-bmp", "image/x-MS-bmp", "image/x-win-bitmap"

◆ MAX_CLIPBOARD_FORMATS

#define MAX_CLIPBOARD_FORMATS   255

◆ mime_text_plain

#define mime_text_plain   "text/plain"

◆ mime_text_utf8

#define mime_text_utf8   mime_text_plain ";charset=utf-8"

◆ TAG

#define TAG   CLIENT_TAG("wayland.cliprdr")

FreeRDP: A Remote Desktop Protocol Implementation Wayland Clipboard Redirection

Copyright 2018 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2018 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ wfl_cliprdr_add_client_format_id()

static void wfl_cliprdr_add_client_format_id ( wfClipboard *  clipboard,
UINT32  formatId 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_clipboard_free()

void wlf_clipboard_free ( wfClipboard *  clipboard)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_clipboard_new()

wfClipboard* wlf_clipboard_new ( wlfContext wlc)

FreeRDP: A Remote Desktop Protocol Implementation Wayland Clipboard Redirection

Copyright 2018 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2018 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_add_client_format()

static BOOL wlf_cliprdr_add_client_format ( wfClipboard *  clipboard,
const char *  mime 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_cancel_data()

static void wlf_cliprdr_cancel_data ( UwacSeat *  seat,
void *  context 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_free_client_formats()

static void wlf_cliprdr_free_client_formats ( wfClipboard *  clipboard)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_free_server_formats()

static void wlf_cliprdr_free_server_formats ( wfClipboard *  clipboard)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_handle_event()

BOOL wlf_cliprdr_handle_event ( wfClipboard *  clipboard,
const UwacClipboardEvent *  event 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_init()

BOOL wlf_cliprdr_init ( wfClipboard *  clipboard,
CliprdrClientContext *  cliprdr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_monitor_ready()

static UINT wlf_cliprdr_monitor_ready ( CliprdrClientContext *  context,
const CLIPRDR_MONITOR_READY monitorReady 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_send_client_capabilities()

static UINT wlf_cliprdr_send_client_capabilities ( wfClipboard *  clipboard)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_send_client_format_list()

static UINT wlf_cliprdr_send_client_format_list ( wfClipboard *  clipboard)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_send_client_format_list_response()

static UINT wlf_cliprdr_send_client_format_list_response ( wfClipboard *  clipboard,
BOOL  status 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the caller graph for this function:

◆ wlf_cliprdr_send_data_request()

static UINT wlf_cliprdr_send_data_request ( wfClipboard *  clipboard,
const wlf_request *  rq 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_send_data_response()

static UINT wlf_cliprdr_send_data_response ( wfClipboard *  clipboard,
const BYTE data,
size_t  size 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the caller graph for this function:

◆ wlf_cliprdr_server_capabilities()

static UINT wlf_cliprdr_server_capabilities ( CliprdrClientContext *  context,
const CLIPRDR_CAPABILITIES capabilities 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_server_format_data_request()

static UINT wlf_cliprdr_server_format_data_request ( CliprdrClientContext *  context,
const CLIPRDR_FORMAT_DATA_REQUEST formatDataRequest 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_server_format_data_response()

static UINT wlf_cliprdr_server_format_data_response ( CliprdrClientContext *  context,
const CLIPRDR_FORMAT_DATA_RESPONSE formatDataResponse 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_server_format_list()

static UINT wlf_cliprdr_server_format_list ( CliprdrClientContext *  context,
const CLIPRDR_FORMAT_LIST formatList 
)
static

Called when the clipboard changes server side.

Clear the local clipboard offer and replace it with a new one that announces the formats we get listed here.

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_server_format_list_response()

static UINT wlf_cliprdr_server_format_list_response ( CliprdrClientContext *  context,
const CLIPRDR_FORMAT_LIST_RESPONSE formatListResponse 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the caller graph for this function:

◆ wlf_cliprdr_transfer_data()

static void wlf_cliprdr_transfer_data ( UwacSeat *  seat,
void *  context,
const char *  mime,
int  fd 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_cliprdr_uninit()

BOOL wlf_cliprdr_uninit ( wfClipboard *  clipboard,
CliprdrClientContext *  cliprdr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_get_server_format_id()

static UINT32 wlf_get_server_format_id ( const wfClipboard *  clipboard,
const char *  name 
)
static
Here is the caller graph for this function:

◆ wlf_get_server_format_name()

static const char* wlf_get_server_format_name ( const wfClipboard *  clipboard,
UINT32  formatId 
)
static
Here is the caller graph for this function:

◆ wlf_mime_is_file()

static BOOL wlf_mime_is_file ( const char *  mime)
static
Here is the caller graph for this function:

◆ wlf_mime_is_html()

static BOOL wlf_mime_is_html ( const char *  mime)
static
Here is the caller graph for this function:

◆ wlf_mime_is_image()

static BOOL wlf_mime_is_image ( const char *  mime)
static
Here is the caller graph for this function:

◆ wlf_mime_is_text()

static BOOL wlf_mime_is_text ( const char *  mime)
static
Here is the caller graph for this function:

◆ wlf_request_clone()

static void* wlf_request_clone ( const void *  oth)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_request_free()

static void wlf_request_free ( void *  rq)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wlf_request_new()

static wlf_request* wlf_request_new ( void  )
static
Here is the caller graph for this function:

Variable Documentation

◆ mime_bitmap

const char* mime_bitmap[] = { BMP_MIME_LIST }
static

◆ mime_gnome_copied_files

const char mime_gnome_copied_files[] = "x-special/gnome-copied-files"
static

◆ mime_html

const char mime_html[] = "text/html"
static

◆ mime_image

const char* mime_image[] = { mime_png, mime_webp, mime_jpg, mime_tiff, BMP_MIME_LIST }
static

◆ mime_jpg

const char mime_jpg[] = "image/jpeg"
static

◆ mime_mate_copied_files

const char mime_mate_copied_files[] = "x-special/mate-copied-files"
static

◆ mime_png

const char mime_png[] = "image/png"
static

◆ mime_text

const char* mime_text[]
static
Initial value:
= { mime_text_plain, mime_text_utf8, "UTF8_STRING",
"COMPOUND_TEXT", "TEXT", "STRING" }
#define mime_text_utf8
Definition: wlf_cliprdr.c:44
#define mime_text_plain
Definition: wlf_cliprdr.c:43

◆ mime_tiff

const char mime_tiff[] = "image/tiff"
static

◆ mime_uri_list

const char mime_uri_list[] = "text/uri-list"
static

◆ mime_webp

const char mime_webp[] = "image/webp"
static

◆ type_FileGroupDescriptorW

const char type_FileGroupDescriptorW[] = "FileGroupDescriptorW"
static

◆ type_HtmlFormat

const char type_HtmlFormat[] = "HTML Format"
static