Question about gdk_window_foreign_new.
Dear all, I am using Xfce4, and I want to draw something on xfdesktop4. So I got its gdk_window, and create a cairo context on it. GdkDrawable *window; cairo_t *cc; window = gdk_window_foreign_new (netk_window_get_xid (g_list_first (netk_screen_get_windows_stacked (netk_screen_get_default ()))-data)); if (window == NULL) { g_print (wrong); return 0; } cc = gdk_cairo_create (window); But as I drew a white line on cc, the desktop window became black, with a white line on it. While xfdesktop4 was still running, menu or something worked well. Why does this happen? Thanks. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to use GtkPrint
Wednesday, August 08, 2007, 11:53:14 AM, Alexander S.Kresin [EMAIL PROTECTED] wrote: ASK could someone give me a link to any description of GtkPrint usage ASK (not the api reference), any code sample ? Doesn't anyone here use GtkPrint ? What I need to go ahead is a piece of code, which includes: open printer start a print job start a new page print few words of text, draw a line, a box end page end job close printer -- Regards, Alexander ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to use GtkPrint
On Thu, 2007-08-09 at 15:01 +0400, Alexander S.Kresin wrote: Wednesday, August 08, 2007, 11:53:14 AM, Alexander S.Kresin [EMAIL PROTECTED] wrote: ASK could someone give me a link to any description of GtkPrint usage ASK (not the api reference), any code sample ? Doesn't anyone here use GtkPrint ? gtk-demo includes working code for printing. you should have a look at it. http://svn.gnome.org/viewcvs/gtk%2B/trunk/demos/gtk-demo/ ciao, Emmanuele. -- Emmanuele Bassi, W: http://www.emmanuelebassi.net B: http://log.emmanuelebassi.net ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk-demo
Emmanuele Bassi wrote: gtk-demo includes working code for printing. you should have a look at it. I just saw this and it was the first I'd heard of gtk-demo! So this is just to point it out to anybody else like me. It's probably installed on your system. I just had to type 'gtk-demo' for it to run. It's well worth trying - thanks to the authors. Also, I tried to find any mention of it on the gtk.org site. Even googling 'gtk-demo site:gtk.org' doesn't produce a good hit. So it might be worth adding to the FAQ and the documentation links, IMHO. And the API reference etc etc :) Cheers, Dave ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk_accelerator_name gtk_accelerator_parse not symmetrical
In developing an application that allows users to define commands to be called on specific keypresses, I've noticed that accelerators involving the Shift key do not work. I've traced the problem until the functions gtk_accelerator_name gtk_accelerator_parse, that I use in my program. The program below demonstrates this: 8 /* Compile with gcc -Wall -g keycode.c -o keycode `pkg-config --cflags --libs gtk+-2.0` */ #include stdio.h #include gtk/gtk.h static gboolean keypress_cb(GtkWidget *widget,GdkEventKey *evt, gpointer data) { if (gtk_accelerator_valid(evt-keyval, evt-state)) { guintnewkeyval; GdkModifierType newmodifiers; gchar *acc; acc = gtk_accelerator_name(evt-keyval, evt-state); printf(Key code: %s (keyval = 0x%x, mod = 0x%x)\n, acc, evt-keyval, evt-state); gtk_accelerator_parse(acc, newkeyval, newmodifiers); printf(Re-parsed: keyval = 0x%x, mod = 0x%x\n, newkeyval, newmodifiers); } return FALSE; } int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *entry; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), delete-event, G_CALLBACK(gtk_main_quit), NULL); entry = gtk_entry_new(); g_signal_connect(G_OBJECT(entry), key-press-event, G_CALLBACK(keypress_cb), NULL); gtk_container_add(GTK_CONTAINER(window), entry); gtk_widget_show_all(window); gtk_main(); return 0; } 8 If a key, such as a is pressed, one gets Key code: a (keyval = 0x61, mod = 0x0) Re-parsed: keyval = 0x61, mod = 0x0 However, if Shift-A is pressed, one gets Key code: Shifta (keyval = 0x41, mod = 0x1) Re-parsed: keyval = 0x61, mod = 0x1 Note that for Shift-A the keyval is different (GDK_A versus GDK_a), but gtk_accelerator_name does not reflect that, and gtk_accelerator_parse returns the virtually impossible combination lowercase a with shift pressed. I suppose this is a bug. Still, is there some kind of workaround (except by checking if the key is a letter and manually adjusting the codes?) -- Pascal Users: To show respect for the 313th anniversary (tomorrow) of the death of Blaise Pascal, your programs will be run at half speed. Eduardo M KALINOWSKI [EMAIL PROTECTED] http://move.to/hpkb ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Libglade resource consuming question.
Hi all! Several objects within a program has a Xml buffer taken from xmlDocDumpFormatMemory (), one for each of them. Only one of those objects will be displayed at a time. Question is: Is it saved a lot a memory if I just keep the xml buffer and use glade_xml_new_from_buffer () when the object would must to be shown; or (easier from the programming point of view) rightly use glade keeping a lot of glade built trees possibly not used any more but now the xml buffer can be freed. Do I be clear ? (When doubt appears it's probably not...) Shortly: GladeXml objects with a moderate amount of widgets are very resource consuming ? or not compared against xmlDocDumpFormatMemory () result ? Thanks a lot. Carlos Savoretti. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Libglade resource consuming question.
On 8/9/07, Carlos Savoretti [EMAIL PROTECTED] wrote: Hi all! Several objects within a program has a Xml buffer taken from xmlDocDumpFormatMemory (), one for each of them. Only one of those objects will be displayed at a time. Question is: Is it saved a lot a memory if I just keep the xml buffer and use glade_xml_new_from_buffer () when the object would must to be shown; or (easier from the programming point of view) rightly use glade keeping a lot of glade built trees possibly not used any more but now the xml buffer can be freed. Do I be clear ? (When doubt appears it's probably not...) Shortly: GladeXml objects with a moderate amount of widgets are very resource consuming ? or not compared against xmlDocDumpFormatMemory () result ? Thanks a lot. Carlos Savoretti. I'm not sure if it's exactly what you're asking, but I asked a question on this list about keeping the GladeXML object and calling glade_xml_get_widget each time I need a widget. In general, that seems like a bad idea, just call glade_xml_get_widget once for each widget you need, store the pointers, and unref the GladeXML. So in your case, I think you'd free the data returned by xmlDocDumpFormatMemory as well, so the only things actually in memory are the widgets themselves. Rather than destroying them when they're not needed, just hide them, and show again when needed. -Jim ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Libglade resource consuming question.
On Thu, 2007-08-09 at 12:55 -0400, Carlos Savoretti wrote: Hi all! [...] Do I be clear ? (When doubt appears it's probably not...) Shortly: GladeXml objects with a moderate amount of widgets are very resource consuming ? or not compared against xmlDocDumpFormatMemory () result ? You can take a lot of different approaches depending on what your priorities are - parsing glade files can be time consuming as well as memory consuming. a buffer with glade file contents probably weighs around the same as a GladeXML tree - but remember - you NEVER have a GladeXML tree lying around (it only serves the purpose of creating the widget heirarcy, after that its useless). If you need to rebuild the hierarchy, you need to keep the buffer around, if you build everything at once, you can free the buffer *and the GladeXML object* and just gtk_widget_show/hide() the built widgets as needed. Cheers, -Tristan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list