void DoInitialize(AvaloniaNativePlatformOptions options) { _options = options; _factory.Initialize(); if (_factory.MacOptions != null) { var macOpts = AvaloniaLocator.Current.GetService <MacOSPlatformOptions>(); _factory.MacOptions.ShowInDock = macOpts?.ShowInDock != false ? 1 : 0; } AvaloniaLocator.CurrentMutable .Bind <IPlatformThreadingInterface>() .ToConstant(new PlatformThreadingInterface(_factory.CreatePlatformThreadingInterface())) .Bind <IStandardCursorFactory>().ToConstant(new CursorFactory(_factory.CreateCursorFactory())) .Bind <IPlatformIconLoader>().ToSingleton <IconLoader>() .Bind <IKeyboardDevice>().ToConstant(KeyboardDevice) .Bind <IPlatformSettings>().ToConstant(this) .Bind <IWindowingPlatform>().ToConstant(this) .Bind <IClipboard>().ToConstant(new ClipboardImpl(_factory.CreateClipboard())) .Bind <IRenderLoop>().ToConstant(new RenderLoop()) .Bind <IRenderTimer>().ToConstant(new DefaultRenderTimer(60)) .Bind <ISystemDialogImpl>().ToConstant(new SystemDialogs(_factory.CreateSystemDialogs())) .Bind <PlatformHotkeyConfiguration>().ToConstant(new PlatformHotkeyConfiguration(KeyModifiers.Meta)) .Bind <IMountedVolumeInfoProvider>().ToConstant(new MacOSMountedVolumeInfoProvider()); if (_options.UseGpu) { AvaloniaLocator.CurrentMutable.Bind <IWindowingPlatformGlFeature>() .ToConstant(_glFeature = new GlPlatformFeature(_factory.ObtainGlDisplay())); } }
internal WindowBaseImpl(AvaloniaNativePlatformOptions opts, GlPlatformFeature glFeature) { _gpu = opts.UseGpu && glFeature != null; _deferredRendering = opts.UseDeferredRendering; _keyboard = AvaloniaLocator.Current.GetService <IKeyboardDevice>(); _mouse = new MouseDevice(); _cursorFactory = AvaloniaLocator.Current.GetService <IStandardCursorFactory>(); }
internal WindowImpl(IAvaloniaNativeFactory factory, AvaloniaNativePlatformOptions opts, GlPlatformFeature glFeature) : base(opts, glFeature) { _factory = factory; _opts = opts; _glFeature = glFeature; using (var e = new WindowEvents(this)) { Init(_native = factory.CreateWindow(e, _opts.UseGpu ? glFeature?.DeferredContext.Context : null), factory.CreateScreens()); } NativeMenuExporter = new AvaloniaNativeMenuExporter(_native, factory); }
public PopupImpl(IAvaloniaNativeFactory factory, AvaloniaNativePlatformOptions opts, GlPlatformFeature glFeature, IWindowBaseImpl parent) : base(opts, glFeature) { _factory = factory; _opts = opts; _glFeature = glFeature; using (var e = new PopupEvents(this)) { Init(factory.CreatePopup(e, _opts.UseGpu ? glFeature?.DeferredContext.Context : null), factory.CreateScreens()); } PopupPositioner = new ManagedPopupPositioner(new OsxManagedPopupPositionerPopupImplHelper(parent, MoveResize)); }