wClipboard/posix: basic delegate interface
authorilammy <a.lozovsky@gmail.com>
Sat, 8 Apr 2017 23:29:51 +0000 (02:29 +0300)
committerilammy <a.lozovsky@gmail.com>
Sun, 9 Apr 2017 00:15:49 +0000 (03:15 +0300)
commit28afbe61f9d85b30a4e435a3e922218e8bf1d9a5
tree97cdf0ea7b62cb1ce372c6f6195f70e037ff9e8a
parent6c6b122a375840372b8beeb77a28996038c5d2e5
wClipboard/posix: basic delegate interface

This is the thing which will be used by clients to request file sizes
and ranges from wClipboard and by wClipboard to report the results of
the requests to the clients.

wClipboard and the client will fill in the (currently absent) callbacks
with their implementations of the request-report interface and will be
using them accordingly.

Initially I thought that wClipbardDelegate would be dynamically
allocated by the client and set into wClipboard (as this would be the
case with a delegate interface implementation in OOP langauges), but
after some thought I ended up with storing the delegate in wClipboard
and using the 'void* custom' field for client-private data.

So the idea is for the subsystem to fill in its callbacks during
wClipboard construction and for the client to get access to
wClipboardDelegate with a getter and fill in its callbacks during its
clipboard initialization. The subsystem will use wClipboard* pointer to
access its data and the client will have its void* pointer to store its
context.
winpr/include/winpr/clipboard.h
winpr/libwinpr/clipboard/clipboard.c
winpr/libwinpr/clipboard/clipboard.h