alexchandel / procfs

/proc for macOS/OS X 64-bit
GNU General Public License v2.0
68 stars 11 forks source link

Fix screenshots and replace CGDisplayBaseAddress #3

Open alexchandel opened 8 years ago

alexchandel commented 8 years ago

Apple deprecated some useful CG display functions in the 64-bit transition, including CGDisplayBaseAddress() which we use to get a pointer to the display. The horrible hack to fix the build is just to redeclare the deprecated symbols in our header. This works (for now) for the size_t functions, but calling CGDisplayBaseAddress() results in this warning getting printed:

Apr 22 14:23:18  procfs[10539] <Warning>: CGDisplayBaseAddress is obsolete and returning an empty buffer for display 0x4280500

So screenshots (i.e. cat /proc/system/hardware/displays/0/screenshot.png > ~/Desktop/scn.png) don't work, and result in some variant of Resource busy for the client.

We need to find a new way to get the display buffer. For screenshot purposes, using CGDisplayCreateImage to copy the framebuffer should suffice. (However, for users wanting to do this, we should also find a new way to stomp on the framebuffer directly)