Re: Get window screenshot on 2.18.



On Sun, 2009-10-11 at 17:08 +0300, Nikolay Zamosenchuk wrote:
> Good afternoon!
> I'm experiencing some difficulties using 2.18 release.
> 
> I'm trying to get window screenshot using such code (working on
> previous major releases, including 2.16):
> 
>        GdkWindowObject *private = (GdkWindowObject *)(window);
>        GdkPixmap *internalPixmap = ((GdkWindowPaint
> *)private->paint_stack->data)->pixmap;
>        if (internalPixmap == NULL) {
>                return NULL;
>        }
>        //
>        GdkPixmap *pixmap = gdk_pixmap_new(internalPixmap, width, height, -1);
>        GdkGC *gc = gdk_gc_new(internalPixmap);
>        //
>        gdk_draw_drawable(pixmap, gc, internalPixmap, 0, 0, 0, 0, width, height);
> 
> But I get nothing...
> Can anyone help, please?

Poking into internals like this is not supported and can break anytime.
Perhaps you can use gdk_pixbuf_get_from_drawable() instead? Seems to
work find for taking screen-shots and I just verified that it works with
GTK+ 2.18.


Sven




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