     CGLSetParameter drop ;
 
 : <FactorView> ( dim pixel-format -- view )
-    [ FactorView ] 2dip <GLView> [ sync-refresh-to-screen ] keep ;
+    [ FactorView ] 2dip <GLView>
+    [ -> backingScaleFactor set-scale-factor ] keep
+    [ sync-refresh-to-screen ] keep ;
 
 : save-position ( world window -- )
     -> frame CGRect-top-left 2array >>window-loc drop ;


    METHOD: void windowDidChangeBackingProperties: id notification
    [
        notification -> object -> backingScaleFactor
        [ 1.0 > ] keep f ? gl-scale-factor set-global

        cached-lines get-global clear-assoc
    ] ;
;CLASS>


        gadget remove-preedit-info 
    ] when ;

: set-scale-factor ( n -- )
    [ 1.0 > ] keep f ? gl-scale-factor set-global
    cached-lines get-global clear-assoc ;

PRIVATE>

<CLASS: FactorView < NSOpenGLView
    COCOA-PROTOCOL: NSTextInputClient

    METHOD: void reshape [
        self window :> window
