Skip to content
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

Merged
merged 3 commits into from
Oct 2, 2019
Merged

Conversation

PJB3005
Copy link
Member

@PJB3005 PJB3005 commented Sep 29, 2019

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.

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.
Comment on lines +1550 to +1569
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);
}
}
Copy link
Member

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?

Copy link
Member Author

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 -->
Copy link
Member

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.

Copy link
Member

@varon varon left a 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.

@varon varon merged commit 28cebb5 into opentk:master Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants