Hi, I’m using gtkmm4, I need to create a screenshot of the main widget, which inherit Gtk::ApplicationWidget.
I’m afraid this gtk3 code is using deprecated API:
GdkPixbuf * get_screenshot(){
GdkPixbuf *screenshot;
GdkWindow *root_window;
gint x_orig, y_orig;
gint width, height;
root_window = gdk_get_default_root_window ();
gdk_drawable_get_size (root_window, &width, &height);
gdk_window_get_origin (root_window, &x_orig, &y_orig);
screenshot = gdk_pixbuf_get_from_drawable (NULL, root_window, NULL,
x_orig, y_orig, 0, 0, width, height);
return screenshot;
}
What would be the best way to do it in gtkmm4?