Skip to content

Instantly share code, notes, and snippets.

@eHammarstrom
Created July 5, 2020 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eHammarstrom/cf465d20690368dc1f5f9a7aaa482ff1 to your computer and use it in GitHub Desktop.
Save eHammarstrom/cf465d20690368dc1f5f9a7aaa482ff1 to your computer and use it in GitHub Desktop.
use gdk::prelude::*;
use gdk::DisplayManager;
fn main() {
println!("Hello, world!");
gdk::init();
let display_manager = DisplayManager::get();
let display = display_manager.get_default_display()
.expect("Found no display");
let screen = display.get_default_screen();
let root_window = screen.get_root_window()
.expect("Unable to retrieve root window");
let root_surface = WindowExtManual::offscreen_window_get_surface(&root_window)
.expect("Unable to retrieve root surface");
let root_pixbuf =
gdk::pixbuf_get_from_surface(&root_surface, 0, 0,
screen.get_width(), screen.get_height());
println!("{:?}", root_pixbuf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment