FreeRDP/winpr/libwinpr/clipboard/clipboard.h

76 lines
1.6 KiB
C
Raw Normal View History

2014-10-17 23:19:05 +04:00
/**
* WinPR: Windows Portable Runtime
* Clipboard Functions
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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.
*/
#ifndef WINPR_CLIPBOARD_PRIVATE_H
#define WINPR_CLIPBOARD_PRIVATE_H
#include <winpr/clipboard.h>
#include <winpr/collections.h>
typedef struct _wClipboardFormat wClipboardFormat;
typedef struct _wClipboardSynthesizer wClipboardSynthesizer;
2014-10-17 23:19:05 +04:00
struct _wClipboardFormat
{
UINT32 formatId;
char* formatName;
UINT32 numSynthesizers;
wClipboardSynthesizer* synthesizers;
};
struct _wClipboardSynthesizer
{
UINT32 syntheticId;
CLIPBOARD_SYNTHESIZE_FN pfnSynthesize;
2014-10-17 23:19:05 +04:00
};
struct _wClipboard
{
UINT64 ownerId;
/* clipboard formats */
UINT32 numFormats;
UINT32 maxFormats;
UINT32 nextFormatId;
wClipboardFormat* formats;
/* clipboard data */
UINT32 size;
2016-10-07 15:08:33 +03:00
void* data;
2014-10-17 23:19:05 +04:00
UINT32 formatId;
UINT32 sequenceNumber;
wClipboard/posix: basic file list handling Here you can see an outline of our approach to handling file lists put on the clipboard. Typical usage of wClipboard by the clients sums up to doing a ClipboardSetData() call followed by a ClipboardGetData() call with appropriate format ID passed to them. Thus for files we would expect the clients to first set the local format (like "text/uri-list") and then to get the remote format (the "FileGroupDescriptorW"). MS-RDPECLIP has a concept of locally-stored list of files on the clipboard. This is modeled by clipboard->localFiles ArrayList. We need to populate this list before we serialize it into CLIPRDR_FILELIST and send it to the server. The easiest way to achieve this is a bit hacky, but it works: we populate the file list from inside the synthesizer callback registered for text/uri-list -> FileGroupDescriptorW conversion. So the client would first set the data it received from local clipboard as "text/uri-list" format, then it gets a "FileGroupDescriptorW" format, during that conversion we will prepare to serve file content requests, and in the end we provide a FILEDESCRIPTOR array to the client as the conversion result. The client will then serialize the array into CLIPRDR_FILELIST and sent it to the server. (We cannot do serialization in WinPR as WinPR should not know about cliprdr and its data formats.) The subsystems are expected to store their private structures in the clipboard->localFiles array. POSIX subsystem uses struct posix_file which currently has bare minimum of fields: the local file name (for open() and the like) and the remote file name (the one to put into FILEDESCRIPTOR).
2017-04-09 02:29:50 +03:00
/* clipboard file handling */
wArrayList* localFiles;
UINT32 fileListSequenceNumber;
wClipboard/posix: basic file list handling Here you can see an outline of our approach to handling file lists put on the clipboard. Typical usage of wClipboard by the clients sums up to doing a ClipboardSetData() call followed by a ClipboardGetData() call with appropriate format ID passed to them. Thus for files we would expect the clients to first set the local format (like "text/uri-list") and then to get the remote format (the "FileGroupDescriptorW"). MS-RDPECLIP has a concept of locally-stored list of files on the clipboard. This is modeled by clipboard->localFiles ArrayList. We need to populate this list before we serialize it into CLIPRDR_FILELIST and send it to the server. The easiest way to achieve this is a bit hacky, but it works: we populate the file list from inside the synthesizer callback registered for text/uri-list -> FileGroupDescriptorW conversion. So the client would first set the data it received from local clipboard as "text/uri-list" format, then it gets a "FileGroupDescriptorW" format, during that conversion we will prepare to serve file content requests, and in the end we provide a FILEDESCRIPTOR array to the client as the conversion result. The client will then serialize the array into CLIPRDR_FILELIST and sent it to the server. (We cannot do serialization in WinPR as WinPR should not know about cliprdr and its data formats.) The subsystems are expected to store their private structures in the clipboard->localFiles array. POSIX subsystem uses struct posix_file which currently has bare minimum of fields: the local file name (for open() and the like) and the remote file name (the one to put into FILEDESCRIPTOR).
2017-04-09 02:29:50 +03:00
wClipboardDelegate delegate;
2014-10-17 23:19:05 +04:00
CRITICAL_SECTION lock;
};
BOOL ClipboardInitSynthesizers(wClipboard* clipboard);
2014-10-17 23:19:05 +04:00
#endif /* WINPR_CLIPBOARD_PRIVATE_H */