コード例 #1
0
ファイル: quartzPrims.cpp プロジェクト: AaronNGray/self
uint32 CGGetDisplayCount_wrap(float x, float y, float w, float h, void* FH) {
  CGDisplayCount count;
  CGDisplayErr e = 
    w == 0.0  &&  h == 0.0
      ? CGGetDisplaysWithPoint( CGPointMake(x, y), 0, NULL, &count)
      : CGGetDisplaysWithRect(  CGRectMake(x, y, w, h), 0, NULL, &count);
  return e != CGDisplayNoErr
    ? (uint32)reportOSError(e, "CGGetDisplayCount", FH)
    : count;
}
コード例 #2
0
ファイル: quartzPrims.cpp プロジェクト: AaronNGray/self
CGDirectDisplayID CGGetDisplayAt_wrap(uint32 n, float x, float y, float w, float h, void* FH) {
  uint32 count;
  ResourceMark rm;
  CGDirectDisplayID *displays = NEW_RESOURCE_ARRAY(CGDirectDisplayID, n + 1);
  CGDisplayErr e = 
    w == 0.0  &&  h == 0.0
      ? CGGetDisplaysWithPoint( CGPointMake(x, y),      n + 1, displays, &count)
      : CGGetDisplaysWithRect(  CGRectMake(x, y, w, h), n + 1, displays, &count);
  return  e != CGDisplayNoErr  ?  (CGDirectDisplayID)reportOSError(e, "CGGetDisplayAt", FH)
  :       count < n + 1        ?  (CGDirectDisplayID)(failure(FH, "not enough displays"), NULL)
  :                               displays[n];
}
コード例 #3
0
ファイル: quartzWindow.cpp プロジェクト: ardeujho/self
static CGDirectDisplayID screen(void* w) {
  HIRect bounds;
  OSStatus err = HIWindowGetBounds((WindowRef)w, kWindowGlobalPortRgn, 
                                   kHICoordSpace72DPIGlobal, &bounds);
  if (err) {
    lprintf("HIWindowGetBounds failed: %d\n", err);
    return CGMainDisplayID();
  }
  CGDirectDisplayID display;
  CGDisplayCount displayCount;
  CGDisplayErr e = CGGetDisplaysWithRect(bounds, 1, 
                                         &display, &displayCount);
  return (displayCount && !e) ? display : CGMainDisplayID();
}