Skip to content

Commit

Permalink
Removed some dangling references instead of accessing the args
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorfdail committed Oct 21, 2024
1 parent 7c14b5d commit 75a2ced
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Blish HUD/GameServices/Input/Mouse/MouseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ private void SimulateNonCapturePressedEvent(MouseEventArgs mouseEvent) {
// we don't necessarily have to check the previous mouse state here as an additional security as this can only be happening on the enable / disable chain right now
// -> the previous state may also be a dangling leftover so it should even be safer to ignore it

if (_mouseEvent.EventType == MouseEventType.LeftMouseButtonReleased) {
var tmpState = this.State;
var tmpState = this.State;
if (mouseEvent.EventType == MouseEventType.LeftMouseButtonReleased) {
this.State = new MouseState(tmpState.X,
tmpState.Y,
tmpState.ScrollWheelValue,
Expand All @@ -201,9 +201,7 @@ private void SimulateNonCapturePressedEvent(MouseEventArgs mouseEvent) {
tmpState.XButton2);
// currently unsure if the MouseData and Flags contained any additional information about the button state maybe requires some bitmagic .. (both seem to always be 0 right now?)
HandleMouseEvent(new MouseEventArgs(MouseEventType.LeftMouseButtonPressed, mouseEvent.PointX, mouseEvent.PointY, mouseEvent.MouseData, mouseEvent.Flags, mouseEvent.Time, mouseEvent.Extra));
this.State = tmpState;
} else if (_mouseEvent.EventType == MouseEventType.RightMouseButtonReleased) {
var tmpState = this.State;
} else if (mouseEvent.EventType == MouseEventType.RightMouseButtonReleased) {
this.State = new MouseState(tmpState.X,
tmpState.Y,
tmpState.ScrollWheelValue,
Expand All @@ -214,8 +212,8 @@ private void SimulateNonCapturePressedEvent(MouseEventArgs mouseEvent) {
tmpState.XButton2);
// currently unsure if the MouseData and Flags contained any additional information about the button state maybe requires some bitmagic .. (both seem to always be 0 right now?)
HandleMouseEvent(new MouseEventArgs(MouseEventType.RightMouseButtonPressed, mouseEvent.PointX, mouseEvent.PointY, mouseEvent.MouseData, mouseEvent.Flags, mouseEvent.Time, mouseEvent.Extra));
this.State = tmpState;
}
this.State = tmpState;
}

private void HandleMouseEvent(MouseEventArgs mouseEvent) {
Expand Down

0 comments on commit 75a2ced

Please sign in to comment.