As the title says, I'm working on it, but it's not going so hot. So, here's what I've got so far:
Code:
#include <gdk/gdk.h>
int main(int argc, char** argv)
{
gdk_init(&argc, &argv);
int width, height;
GdkWindow* root = gdk_get_default_root_window();
gdk_drawable_get_size(root, &width,&height);
GdkPixbuf* theImage = gdk_pixbuf_get_from_drawable(NULL,
root, gdk_colormap_get_system(),
0,0,0,0,width,height);
GdkWindowAttr newAttr;
newAttr.title = "Screenshot";
newAttr.wclass = GDK_INPUT_OUTPUT;
newAttr.window_type = GDK_WINDOW_TOPLEVEL;
GdkWindow* newWin = gdk_window_new(NULL, &newAttr, GDK_WA_TITLE);
gdk_window_show(newWin);
gdk_window_fullscreen(newWin);
gdk_draw_pixbuf(newWin, NULL, theImage, 0,0, 0,0, -1, -1,
GDK_RGB_DITHER_NONE,0,0);
system("sleep 5");
return 0;
}
The end result is always the newWin is created, it is fullscreened, but it is entirely black. Somehow, gdk_pixbuf_get_from_drawable isn't grabbing the screenshot. Can anyone spot my mistake? Although I write most of my GUI's in gtk, this is my first real venture into gdk.