Reputation: 321
I am trying to take a screenshot of the root window in gtk4. This is how I do it in gtk3--
GdkWindow *root_win = gdk_get_default_root_window();
gint width = gdk_window_get_width(root_win);
gint height = gdk_window_get_height(root_win);
cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
width, height);
/*.........................*/
cairo_surface_write_to_png(surface, "image.png");
But gdk_get_default_root_window
function has been removed in gtk4. How to take a screen shot in Gtk4? Please do not recommend x11.
Upvotes: 2
Views: 107