Clipboard details



Hi,

Here's the scheme I am currently implementing. Please comment on it.


* The clipboard server

This is a currently per-display object[1] that works by transporting
monikers between data sources and targets. Here is the interface:
		/**
		 * setClipboard:
		 * @pasting_moniker:
		 * @linking_moniker:
		 *
		 * Set the curent clipboard state. The clipboard
		 * server will own a new reference on the monikers.
		 * Three events will also be fired by the aggregated
		 * EventSource:
		 *      Bonobo/Clipboard/changed (void)
		 *      Bonobo/Clipboard/changed::pasting (pasting_moniker)
		 *      Bonobo/Clipboard/changed::linking (linking_moniker)
		 */
		void setClipboard (in Moniker pasting_moniker,
				   in Moniker linking_moniker);

		/**
		 * paste:
		 *
		 * Get the current pasteing moniker. The returned
		 * moniker is already ref'd.
		 */
		Moniker paste ();

		/**
		 * link:
		 *
		 * Get the current linking moniker. The returned
		 * moniker is already ref'd.
		 */		
		Moniker link ();
	};	

So, if you are creating a data target application, you should just watch
for events and enable/disable Edit/Paste and Edit/Link here accordingly.
If you are creating a data source, you are responsible for supplying a
linking and an embedding moniker. Altough not yet documented inside the
IDL, both the linking and the embedding moniker can be NULL.

[1] Looking at the current OAFD implementation, it looks like unless you
do special magic on the client side, factories will be per-display if the
Display context is non-NULL, which I assume is automatically set by liboaf


* The X-to-Bonobo clipboard bridge

This is a special moniker ("xclipboard:") that enables you to access the X
clipboard via the PersistStream interface. I am currently looking for good
documentation on X clipboards, so right now it only works for text/plain.
Also part of this will be a background process (maybe launched by
gnome-session) that 
	1, Stores the X clipboard, the way xclipboard does
	2, If the X clipboard changes, sets the Bonobo clipboard's pasting
	   moniker to "xclipboard:"
	3, If the Bonobo clipboard changes, sets the X clipboard by
	   resolving the pasting moniker to PersistStream and saving its
	   state in text/plain, then exporting it to the X clipboard


* The Clipboard Store

This is an out-of-proc server that can be used by data sources that don't
want to manage their own pasting monikers. Managing here means making sure
the pasting moniker is resolveable after the application has exited and
also making sure that the state it represents is the exact state which was
around when the user clicked Edit/Copy (or Cut).
You use it by first filling the clipboard store with the pasting data and
then setting the Clipboard using the "clipboard-store:" moniker as the
pasting moniker.
The interface of ClipboardStore is:

	interface ClipboardStore : Unknown {
		
		/**
		 * fetchStream:
		 */
		void fetchStream (in PersistStream source);

		
		/**
		 * fetchStorage:
		 */
		void fetchStorage (in PersistStorage source);
	};

An alternative way would be to have the Clipboard Store also set the
Clipboard, i.e.

	void fetchStream (in Moniker linking_moniker, in PersistStream source);
	void fetchStorage (in Moniker linking_moniker, in PersistStorage source);

This might be better for two things:
	1, There could be a race condition if setting the clipboard is a
separate step, because another application might mess with the clipboard
store's data between the call to CS::fetchS* and Clipb::setClipboard.
	2, The main Bonobo Clipboard server could also implement
ClipboardStore, and do the ClipboardStore->Clipboard forwarding inside,
eliminating some CORBA round trips.


In good Gergo tradition, I have no idea how to finish this mail, so I will
stick to the good old `comments welcome' formula.


-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
A kényelmes cipők rondák.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]