How to take screenshot of obscured window in C++ on Linux
I'm trying to figure out how to take a screenshot of a window that is currently not focused, so there is a good chance that the window will be partially or fully obscured by other windows. I've found an example here on this link Get a screenshot of a window that is cover or not visible or minimized with Xcomposite extension for X11 but I can't make it work, any time I take a screenshot I get only strange output, mostly black, like I'm accessing the wrong buffer or something. XID xid = windowID; // Checked and confirmed that the window ID is correct XGetWindowAttributes( display, windowID,