Refactor: Use switch statement

This commit is contained in:
Unrud 2023-02-23 01:09:03 +01:00
parent 79a88dc676
commit 6f03281fc7
4 changed files with 52 additions and 65 deletions

View file

@ -237,13 +237,14 @@ func (p *portalController) PointerButton(button PointerButton, press bool) error
return errors.New("dbus connection closed")
}
var btn int32
if button == PointerButtonLeft {
switch button {
case PointerButtonLeft:
btn = btnLeft
} else if button == PointerButtonMiddle {
case PointerButtonMiddle:
btn = btnMiddle
} else if button == PointerButtonRight {
case PointerButtonRight:
btn = btnRight
} else {
default:
return errors.New("unsupported pointer button")
}
state := btnReleased