From e16c34c90ef03624b7f7a5a01a686f43103467d2 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 1 Nov 2015 14:53:22 +1100 Subject: [PATCH] Last attempt at fixing OSX cursor movement. --- ClassicalSharp/Game/Game.cs | 2 +- OpenTK/Platform/MacOS/CarbonGLNative.cs | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/ClassicalSharp/Game/Game.cs b/ClassicalSharp/Game/Game.cs index f293c8255..963426b5b 100644 --- a/ClassicalSharp/Game/Game.cs +++ b/ClassicalSharp/Game/Game.cs @@ -182,7 +182,7 @@ namespace ClassicalSharp { const int ticksFrequency = 20; const double ticksPeriod = 1.0 / ticksFrequency; const double imageCheckPeriod = 30.0; - const double cameraPeriod = 1.0 / 10.0; + const double cameraPeriod = 1.0 / 120.0; double ticksAccumulator = 0, imageCheckAccumulator = 0, cameraAccumulator = 0; protected override void OnRenderFrame( FrameEventArgs e ) { diff --git a/OpenTK/Platform/MacOS/CarbonGLNative.cs b/OpenTK/Platform/MacOS/CarbonGLNative.cs index 674845ba8..6b77ac28e 100644 --- a/OpenTK/Platform/MacOS/CarbonGLNative.cs +++ b/OpenTK/Platform/MacOS/CarbonGLNative.cs @@ -220,31 +220,23 @@ namespace OpenTK.Platform.MacOS Application.WindowEventHandler = this; } - void Activate() - { + void Activate() { API.SelectWindow(window.WindowRef); } - void Show() - { - IntPtr parent = IntPtr.Zero; - + void Show() { API.ShowWindow(window.WindowRef); - API.RepositionWindow(window.WindowRef, parent, WindowPositionMethod); + API.RepositionWindow(window.WindowRef, IntPtr.Zero, WindowPositionMethod); API.SelectWindow(window.WindowRef); } - void Hide() - { + void Hide() { API.HideWindow(window.WindowRef); } - internal void SetFullscreen(AglContext context) - { + internal void SetFullscreen(AglContext context) { windowedBounds = bounds; - int width, height; - context.SetFullScreen(window, out width, out height); Debug.Print("Prev Size: {0}, {1}", Width, Height); @@ -253,13 +245,10 @@ namespace OpenTK.Platform.MacOS // TODO: if we go full screen we need to make this use the device specified. bounds = mDisplayDevice.Bounds; - - windowState = WindowState.Fullscreen; } - internal void UnsetFullscreen(AglContext context) - { + internal void UnsetFullscreen(AglContext context) { context.UnsetFullScreen(window); Debug.Print("Telling Carbon to reset window state to " + windowState.ToString()); @@ -1035,7 +1024,9 @@ namespace OpenTK.Platform.MacOS set { HIPoint point = default( HIPoint ); point.X = value.X; point.Y = value.Y; + CG.CGAssociateMouseAndMouseCursorPosition( 0 ); CG.CGDisplayMoveCursorToPoint( CG.CGMainDisplayID(), point ); + CG.CGAssociateMouseAndMouseCursorPosition( 1 ); } }