I’m fairly new to the whole GTK game and want to create an algorithm to take screen shot of all monitors.
I was thinking something along these lines:
gdk_display_manager_list_displays- each display can have multiple screens (screens means monitors?) so use
gdk_display_get_n_screensto get monitors per display from1 - get root gtk window of all screens from
2 - create new Pixbuf for each root gtk window for each screen from
3withgdk_pixbuf_new - fill each pixbuf from
4withgdk_pixbuf_get_from_drawablefor each respective root window from3for each respective screen from2for each respective display from1(may need togdk_drawable_get_sizeandgdk_window_get_originfor each for args to pixbuf) gdk_pixbuf_get_pixelsfor each pixbuf
Is this a workable solution?
Advertisement
Answer
If you are sure cRootWin is not NULL and cWidth and cHeight are greater than 0 then you should check for some additional problem mentioned by the doc.
A wild guess is your program does not have enough memory to store the pixmap (typically 6 Mb). I would try to allocate the 12 Mb just to see if this is the case.