[ObjC] Windows rects out of CGWindowListCopyWindowInfo

Discussion in 'Mac Programming' started by Metalmorphed, Jul 20, 2010.

  1. Metalmorphed macrumors member

    Joined:
    Mar 14, 2010
    #1
    Hi,

    I got the list of windows with:
    Code:
    CFArrayRef m_WindowList;
    	m_WindowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID);
    Now I have an array of CGRects pointer:
    Code:
    CGRect* m_WindowRectList;
    Now my question is, how do I get only the window position and dimentions into the CGRect array from the m_WindowList ?

    Any help here ?

    Thanks !
    -Pablo
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Each element in the array is a dictionary. There should be in the dictionary an object for the key kCGWindowBounds. Then you can use CGRectMakeWithDictionaryRepresentation() to turn it into a CGRect.
     

Share This Page