-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve mouse cursor handling. #965
Conversation
Added all the standard shapes supported by GLFW. Fixed memory leak where GLFW cursors weren't being destroyed. Fixed bug where MouseCursor on window defaulted to null, not Default.
private static CursorShape MapStandardCursorShape(MouseCursor.StandardShape shape) | ||
{ | ||
switch (shape) | ||
{ | ||
case MouseCursor.StandardShape.Arrow: | ||
return CursorShape.Arrow; | ||
case MouseCursor.StandardShape.IBeam: | ||
return CursorShape.IBeam; | ||
case MouseCursor.StandardShape.Crosshair: | ||
return CursorShape.Crosshair; | ||
case MouseCursor.StandardShape.Hand: | ||
return CursorShape.Hand; | ||
case MouseCursor.StandardShape.HResize: | ||
return CursorShape.HResize; | ||
case MouseCursor.StandardShape.VResize: | ||
return CursorShape.VResize; | ||
default: | ||
throw new ArgumentOutOfRangeException(nameof(shape), shape, null); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this mapping and/or have two separate types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative would be a massive if else chain of cursor == MouseCursor.IBeam
, so I'm not sure that's preferable.
@@ -154,7 +154,7 @@ | |||
<!-- Documentation rules --> | |||
<Rule Id="SA1600" Action="Error" /> <!-- Elements must be documented --> | |||
<Rule Id="SA1601" Action="None" Intentional="true" /> <!-- Partial elements must be documented --> | |||
<Rule Id="SA1602" Action="Error" /> <!-- Enumeration items must be documented --> | |||
<Rule Id="SA1602" Action="None" /> <!-- Enumeration items must be documented --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super solid now. Very happy with this naming.
Added all the standard shapes supported by GLFW.
Fixed memory leak where GLFW cursors weren't being destroyed.
Fixed bug where MouseCursor on window defaulted to null, not Default.