[Gtk-sharp-list] Rewriting Clipboard Manager in .NET

Philip Van Hoof spamfrommailing@freax.org
08 Jun 2003 12:05:05 +0200


Bleh, looks like this is going to be a lot more difficult :-\

Almost "nothing" of Gtk.Clipboard works the way it should work 


I also don't how I can receive the "TARGETS" target and then for each
target extract the target-Atom out of the SelectionData.Data. In C I
could make a cast but mono tells me that it cannot cast nor find the
size of an unmanaged type.



Example:

The "most" simple version of getting the clipboard ...

public override void CollectCurrent ()
{
	this.clipboard = Clipboard.Get (Atom.Intern("CLIPBOARD", false));
	SelectionData clipboardtargets = this.clipboard.WaitForContents
		(Atom.Intern ("COMPOUND_TEXT", false));
	System.Console.WriteLine(clipboardtargets.Data);

}

Gives this :

(./Bin/ClipboardManagerDaemon.exe:12136): Gtk-CRITICAL **: file
gtkclipboard.c: line 877 (gtk_clipboard_wait_for_contents): assertion
`clipboard != NULL' failed
 
Unhandled Exception: System.ArgumentNullException: Argument cannot be
null
Parameter name: src
in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x20)
[0x400a51b6]
in (unmanaged) /usr/lib/libmono.so.0 [0x400babce]
in <0x00014> 00 System.Runtime.InteropServices.Marshal:Copy
(intptr,byte[],int,int)
in <0x0003e> 00 Gtk.SelectionData:get_Data ()
in <0x000a6> 00
Clipboard.Manager.Daemon.DefaultClipboardManager:CollectCurrent ()
in <0x00047> 00 Clipboard.Manager.Daemon.Daemon:.ctor ()
in <0x00025> 00 Clipboard.Manager.Daemon.Daemon:Main (string[])
 

So IMHO there is still "a lot" work to do :( 



There are also no Atom types like GDK_CLIPBOARD, GDK_PRIMARY .. so I
have to create each using Atom.Intern("CLIPBOARD", false) ... but I can
live with that :-\


bleh


-- 
Philip Van Hoof, Software Developer @ Cronos
home: me at freax dot org
work: Philip dot VanHoof at cronos dot be
http://www.freax.be, http://www.freax.eu.org