Browse Source

Merge pull request #1428 from boombuler/fix-osx-cursor

fixed not updating cursor on osx
pull/1439/head
Nikita Tsukanov 8 years ago
committed by GitHub
parent
commit
6d77f8453f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/OSX/Avalonia.MonoMac/TopLevelImpl.cs

12
src/OSX/Avalonia.MonoMac/TopLevelImpl.cs

@ -39,6 +39,7 @@ namespace Avalonia.MonoMac
private NSTrackingArea _area;
private NSCursor _cursor;
private bool _nonUiRedrawQueued;
private bool _isMouseOver;
public CGSize PixelSize { get; set; }
@ -133,7 +134,11 @@ namespace Avalonia.MonoMac
{
ResetCursorRects();
if (_cursor != null)
{
AddCursorRect(Frame, _cursor);
if (_isMouseOver)
_cursor.Set();
}
}
static readonly NSCursor ArrowCursor = NSCursor.ArrowCursor;
@ -299,10 +304,17 @@ namespace Avalonia.MonoMac
public override void MouseExited(NSEvent theEvent)
{
_isMouseOver = false;
MouseEvent(theEvent, RawMouseEventType.LeaveWindow);
base.MouseExited(theEvent);
}
public override void MouseEntered(NSEvent theEvent)
{
_isMouseOver = true;
base.MouseEntered(theEvent);
}
void KeyboardEvent(RawKeyEventType type, NSEvent ev)
{
var code = KeyTransform.TransformKeyCode(ev.KeyCode);

Loading…
Cancel
Save