Search code examples
macoscursorscreenzoomingshow-hide

CGDisplayHideCursor, CGDisplayShowCursor and CGWindowListCreateImage problem when screen is zoomed


I am developing a Desktop application in which I am reading the screen buffer data and create image out of it. I use the call glReadPixels to read the screen data.

  1. If I do not want to show the cursor in the image created from screen buffer, I hide the cursor using the call CGDisplayHideCursor before creating the image from screen buffer.

  2. If I want to show the cursor in the image created from screen buffer, I enable use the call CGDisplayShowCursor before creating the image from screen buffer.

This works fine in normal scenario. But, if I try this when the screen is zoomed:

  1. Cursor is shown in the image created from the screen even if I hide it.
  2. Two cursors are shown in the image created from the screen even if I show the cursor.

What is the problem here?


Solution

  • I could solve it using CGCursorIsDrawnInFramebuffer which tells if the cursor is included in the buffer or not.