Are you really sure you're accessing the GdkWindow and not the GtkWindow ? GtkWindow *toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
[add some graphical stuff in that GtkWindow] /* and then, later on... */ GdkWindow *window = toplevel->window; if (window != NULL) { int x, y, width, height, depth; GdkPixbuf *pb; gdk_window_get_geometry (window, &x, &y, &width, &height, &depth); pb = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE (window), NULL, 0, 0, 0, 0, width, height); gdk_pixbuf_save(pb, filename, "png", NULL, "compression", "9", NULL); } ying lcs a écrit : > Luis, > > The 'window' object is from: > > gtk_window_new(GTK_WINDOW_TOPLEVEL) > > I do see it works something, while other times, I see the screenshot > get out of place (as shown in the image I attached). > > I suspect my window is obscured during the capture. > > So how can I programmatic make sure my window is not obscured before > the catpure? > > I have tried adding: > > gdk_window_raise(window); > gdk_flush(); > > > But it does not always help. > > Thank you for any more pointers. > > > > > On Thu, Mar 20, 2008 at 7:37 PM, Luis Menina <[EMAIL PROTECTED]> wrote: >> Hi, >> >> where does your "window" object come from ? Could you please give us the >> code where you initilized it ? I've tried to adapt your code in a simple >> example, and it just works... I get a screenshot of what is in the >> window, without the window decoration. >> >> Cheers, >> >> Luis >> >> ying lcs a écrit : >> >> >>> Hi, >> > >> > I have a question of using gdk_pixbuf_get_from_drawable(). I have the >> > following code which save the gdk window to a png file. >> > But something I get something which is totally not what is displayed >> > on the window. Can you please tell me what am I missing? >> > >> > GdkWindow *window ; >> > >> > if (window != NULL) { >> > >> > int x, y, width, height, depth; >> > >> > gdk_window_get_geometry( window, &x, &y, &width, &height, &depth ); >> > >> > printf (" width=%d, height=%d\n", width, height); >> > >> > /* copy the pixmap from the treeview and from the title */ >> > pb = gdk_pixbuf_get_from_drawable(NULL, >> > GDK_DRAWABLE(window), >> > NULL, 0, 0, 0, 0, width, height); >> > >> > >> > /* save the pixbuf to a png file */ >> > gdk_pixbuf_save(pb, filename, "png", NULL, >> > "compression", "9", >> > NULL); >> > } >> > >> > Thank you. >> > >> > >> > ------------------------------------------------------------------------ >> > >> > _______________________________________________ >> > gtk-app-devel-list mailing list >> > gtk-app-devel-list@gnome.org >> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list >> > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list