diff --git a/basis/ui/backend/cocoa/views/non-retina/non-retina.factor b/basis/ui/backend/cocoa/views/non-retina/non-retina.factor new file mode 100644 index 0000000000..4cc904c2b8 --- /dev/null +++ b/basis/ui/backend/cocoa/views/non-retina/non-retina.factor @@ -0,0 +1,7 @@ +USING: cocoa.subclassing ; +IN: ui.backend.cocoa.views.non-retina + +CLASS: BaseFactorView < NSOpenGLView NSTextInput +[ + +] diff --git a/basis/ui/backend/cocoa/views/retina/retina.factor b/basis/ui/backend/cocoa/views/retina/retina.factor new file mode 100644 index 0000000000..3fcdc730fe --- /dev/null +++ b/basis/ui/backend/cocoa/views/retina/retina.factor @@ -0,0 +1,13 @@ +USING: alien.c-types cocoa cocoa.subclassing core-text kernel +math namespaces opengl ; +IN: ui.backend.cocoa.views.retina + +CLASS: BaseFactorView < NSOpenGLView NSTextInput +[ + METHOD: void prepareOpenGL [ + self 1 -> setWantsBestResolutionOpenGLSurface: + self -> backingScaleFactor dup 1.0 > [ + gl-scale-factor set-global t retina? set-global + ] [ drop ] if + ] +] diff --git a/basis/ui/backend/cocoa/views/views.factor b/basis/ui/backend/cocoa/views/views.factor index 82b44d22ac..052a6a8d65 100644 --- a/basis/ui/backend/cocoa/views/views.factor +++ b/basis/ui/backend/cocoa/views/views.factor @@ -5,9 +5,9 @@ arrays assocs cocoa cocoa.application cocoa.classes cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.types cocoa.views combinators core-foundation.strings core-graphics core-graphics.types core-text io.encodings.utf8 kernel locals -math math.rectangles namespaces opengl sequences threads -ui.gadgets ui.gadgets.private ui.gadgets.worlds ui.gestures -ui.private ; +math math.order math.rectangles namespaces opengl sequences +system-info threads ui.gadgets ui.gadgets.private +ui.gadgets.worlds ui.gestures ui.private vocabs vocabs.parser ; IN: ui.backend.cocoa.views : send-mouse-moved ( view event -- ) @@ -146,7 +146,12 @@ CONSTANT: selector>action H{ selector>action at [ swap world-focus parents-handle-gesture? t ] [ drop f f ] if* ; -CLASS: FactorView < NSOpenGLView NSTextInput +<< +os-version { 10 7 0 } after=? "retina" "non-retina" ? +"ui.backend.cocoa.views." prepend use-vocab +>> + +CLASS: FactorView < BaseFactorView [ ! Rendering METHOD: void drawRect: NSRect rect [ self window [ draw-world ] when* ] @@ -305,13 +310,6 @@ CLASS: FactorView < NSOpenGLView NSTextInput METHOD: NSInteger conversationIdentifier [ self alien-address ] - METHOD: void prepareOpenGL [ - self 1 -> setWantsBestResolutionOpenGLSurface: - self -> backingScaleFactor dup 1.0 > [ - gl-scale-factor set-global t retina? set-global - ] [ drop ] if - ] - ! Initialization METHOD: void updateFactorGadgetSize: id notification [