Artifact c102ec574f10efe8711167f1f2856e42e0d88dca:


#lang racket
(require
 ffi/unsafe
 "base.rkt")

(define libcd-native
  (case (system-type 'os)
    [(unix macosx)
     (ffi-lib "libcdx11")]
    [(windows)
     (ffi-lib "cd")]
    [else
     (ffi-lib "libcd")]))

(define libcd-context+
  (case (system-type 'os)
    [(windows)
     (ffi-lib "cdcontextplus")]
    [else
     (ffi-lib "libcdcontextplus")]))

;; {{{ Context types

(define context:native-window
  ((get-ffi-obj "cdContextNativeWindow" libcd-native (_fun -> [context : _context]))))

(provide
 context:native-window)

;; }}}

;; {{{ Auxiliary functions

(define screen-size
  (get-ffi-obj
   "cdGetScreenSize" libcd-native
   (_fun [width/px : (_ptr o _int)] [height/px : (_ptr o _int)]
         [width/mm : (_ptr o _double)] [height/mm : (_ptr o _double)]
         -> _void
         -> (values
             width/px height/px
             width/mm height/mm))))

(provide
 screen-size)

;; }}}

;; {{{ Library initialization

((get-ffi-obj
  "cdInitContextPlus" libcd-context+
  (_fun -> _void)))

;; }}}