Re: Scribble Example



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.  

In my intuitive zen musings, I'm tending to think that you can't draw on it unless you
somehow make it writable from your app, or if you lay a transparent window on top
of it, and draw to your transparent window.


There are 2 foreign window types, AND A Gdk window with parent, 
and I'm wondering what the difference is?

window = Gtk2::Gdk::Window->new ($parent, $attributes_ref)
                  $parent (Gtk2::Gdk::Window or undef

window = Gtk2::Gdk::Window->foreign_new ($anid)
          Â   $anid (Gtk2::Gdk::NativeWindow)

window = Gtk2::Gdk::Window->foreign_new_for_display ($display, $anid)

Any thoughts on this?  What is the $attributes_ref? Which of the 3 window
creation methods above, the best to use to actually draw on the target foreign 
window?  
I'm hoping for a clue, or I will have to spend an afternoon experimenting. :-) 

The concept Mario had was a screenshot grabbing mouse drag which created a
dashed rectangle on a foreign area. Would that dashed rectangle be drawn on
the foreign gdk window itself, or on a transparent gdk window which you overlay over
the target?  I'm leaning toward a transparent overlay, since you would not be actually
writing to the other app's space directly, and would seem to be more secure. ??


Thanks,
zentara



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



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