Re: Scribble Example



On Sun, 13 Jul 2008 13:13:00 -0400
muppet <scott asofyet org> wrote:


On Jul 13, 2008, at 9:08 AM, zentara wrote:

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.

GdkWindow is a GObject but has no signals.  You're thinking of the  
GtkWidget::event signal.  If you want integration with the event  
system, you'll have to wrap the GdkWindow up in a GtkWidget, and  
enable an event filter.  (Oops, gdk_window_add_filter() has never been  
implemented in the bindings...)


I'm a bit confused, what's the actual goal, here?  If you just want to  
capture the contents of the other window, it seems that readonly  
access you get here is fine.  If you want something more elaborate,  
then xswallow or GtkPlug/GtkSocket may be more appropriate.

Well, the OP Mario, had an ultimate goal of using your scribble example
(mouse drag drawing) to make selections on a foreign window.

Off list, we have managed to draw to the drawing area, but as my example
showed, no mouse events could be detected. BUT Mario did find a way
to detect the foreign window mouse events by replacing the mainloop.
See attachment for the example code. But there are glitches, like the
main script buttons stopped working. Maybe you could see a way to
improve the custom mainloop in the attachment to get it working?

I tried sprinkling a bunch of 
Gtk2->main_iteration while Gtk2->events_pending;
in all the callbacks, and seemed to help a bit, but it's not
perfect.


And you are right, this is just a stupid code trick, so please don't
waste time on it, but if you see something obvious, we would appreciate
it.

Thanks,
zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/CandyGram_for_Mongo.html 

Attachment: example.tgz
Description: application/compressed-tar



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