Last attempt at fixing OSX cursor movement.

This commit is contained in:
UnknownShadow200 2015-11-01 14:53:22 +11:00
parent 61745c33c5
commit e16c34c90e
2 changed files with 9 additions and 18 deletions

View File

@ -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 ) {

View File

@ -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 );
}
}