[Gtk-sharp-list] grabbing a screenshot from C#?

David Huseby dave at linuxprogrammer.org
Fri Apr 6 12:04:54 EDT 2007


Hi all,

I was looking at the source code for the gnome-screenshot app in the
gnome-utils package to see how they take a screenshot of the entire desktop
and get it into a Pixbuf.

The code basically goes like this (pseudo-C-code):

GdkWindow *root = gdk_window_foreign_new(GDK_ROOT_WINDOW());
gdk_drawable_get_size(...)
gdk_window_get_origin(...)
GdkPixbuf *screenshot = gdk_pixbuf_get_from_drawable(NULL, root, NULL, ...);

I'd like to be able to do this from my Gtk#/Gdk# application but I can't
seem to figure out the equivalent function of the GDK_ROOT_WINDOW() call.

I see that I can use Pixbuf.CreateFromDrawable() to do the same thing as the
gdk_pixbuf_get_from_drawable().

Does anybody know how to get the Gdk root window (i.e. desktop window)?

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20070406/20a80576/attachment.html 


More information about the Gtk-sharp-list mailing list