Thanks for your example, again. I changed a few lines and now you can receive events from the foreign window. The disadvantage of this method is that you don't reach the Gtk2 MainLoop anymore so the buttons are not drawn for example but i didn't investigate in this direction ;-) Here are my changes (the complete files are attached): $window->show_all(); #~ Gtk2->main; my $mainloop = Glib::MainLoop->new (undef, 0); Glib::Idle->add (\&my_callback, undef, 0); $mainloop->run; ##################################### sub my_callback { my $event = Gtk2::Gdk::Event->get; warn "event ".$event->type."\n" if defined($event); return TRUE; } ##################################### ##################################### sub delete_event { #~ Gtk2->main_quit; $mainloop->quit; return FALSE; } thanks, mario Am Sonntag, den 13.07.2008, 09:08 -0400 schrieb zentara:
On Sat, 12 Jul 2008 08:53:51 -0400 zentara <zentara1 sbcglobal net> wrote:On Fri, 11 Jul 2008 23:50:37 -0400 muppet <scott asofyet org> wrote:On Jul 10, 2008, at 8:09 AM, Mario Kemper wrote:Now i know to draw on a canvas. Do you have any ideas on how i can draw on a foreign window?A GdkWindow isa GdkDrawable, so stuff like Gtk2::Gdk::Drawable::draw_rectangle(), draw_line(), draw_drawable(), etc, should all Just Work.Hi, In my experimenting around, If I have the xid of the foreign window, I can use Gtk2::Gdk::Window->foreign_new($xid) to get the low level window and take a screenshot. But to actually draw on that foreign window, seems to be more difficult.Hi, this is the result of my experiments. I can write to the gdk foreign window, and even move it, but I can't scribble to it with the mouse. The problem seems to be you can't assign events to the gdk window from another window, so the mouse is useless on it. Is there a trick I'm missing? There are 2 attachments. One is the target script called Z, and the other launches it, starts itself, then tries to manipulate the gdk window. Thanks, zentara -- I'm not really a human, but I play one on earth. http://zentara.net/CandyGram_for_Mongo.html _______________________________________________ gtk-perl-list mailing list gtk-perl-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Attachment:
example.tar.gz
Description: application/compressed-tar