And the clipboards lives on...
- From: "Freddie Unpenstein" <fredderic excite com>
- To: gtk-app-devel-list gnome org
- Subject: And the clipboards lives on...
- Date: Wed, 23 Mar 2005 08:09:01 -0500 (EST)
I'm wondering if anyone could give me pointers on placing some text in the clipboard, without it vanishing as
soon as the program closes.
I write these two little test applications to see if I could put some text into the clipboard, and then read
it back out again...
// test program to read that data back again
GtkClipboard *clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
char *text = gtk_clipboard_wait_for_text(clip);
write(1, text, strlen(text));
Reading the clipboard works just fine. If I copy something in another program, the above snippet prints it
out just fine.
// test program to write data to the clipboard
GtkClipboard *clip =
gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
char bufr[] = "Please come home...";
int len = strlen(bufr);
gtk_clipboard_set_text(clip, bufr, len);
gtk_clipboard_store(clip);
// give me time to check that it went in okay
g_timeout_add(10000, gtk_main_quit, NULL);
gtk_main();
This one stores the text in the clipboard just fine, but as soon as the 10 seconds are over and the program
quits, the text dissapears.
As I read the API, gtk_clipboard_store() is supposed to make the clipboard contents remain after the
application has finished. I assume I'm missing something... Probably something fairly simple. ;)
Any help would be much appreciated... Yes again... :)
Fredderic
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]