clipboard: have a way to get the content provider value asynchronously
We are looking at porting the DCV client to GTK 4. The way we used to implement clipboard with GTK3 was that the server would detect changes on the clipboard and send to the client that specific formats that are available on the clipboard without setting the data for all the formats available until needed by the client. Once needed the client would run an inner mainloop to request the data from the server to avoid blocking the mainloop of the application, which is not very nice.
As far as I understand it I could implement a GdkContentProvider
, and use the custom content provider having the specific GdkContentFormats
that are available in the server. Once the clipboard requires the data then gdk_content_provider_get_value
will be called and DCV would request the specific value data to the server. The problem is that it would mean that I would have to block the mainloop or run an inner loop to avoid blocking it while waiting for the data of the GValue as I was doing with GTK3.
Would it be acceptable to have a gdk_content_provider_get_value_async
and have this used by gdk_clipboard_write_async
?
CC: @otte