mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 23:55:39 +00:00
io/pointer: rename button names to reflect their meaning, not placement
For example, ButtonLeft may be the right-most button for a left-handed user.
Rename the button names to match their intended use.
This is an API change. Use the following commands to update your
projects:
$ gofmt -r 'pointer.ButtonLeft -> pointer.ButtonPrimary' -w .
$ gofmt -r 'pointer.ButtonRight -> pointer.ButtonSecondary' -w .
$ gofmt -r 'pointer.ButtonMiddle -> pointer.ButtonTertiary' -w .
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+14
-9
@@ -148,9 +148,14 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
ButtonLeft Buttons = 1 << iota
|
||||
ButtonRight
|
||||
ButtonMiddle
|
||||
// ButtonPrimary is the primary button, usually the left button for a
|
||||
// right-handed user.
|
||||
ButtonPrimary Buttons = 1 << iota
|
||||
// ButtonSecondary is the secondary button, usually the right button for a
|
||||
// right-handed user.
|
||||
ButtonSecondary
|
||||
// ButtonTertiary is the tertiary button, usually the middle button.
|
||||
ButtonTertiary
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -265,14 +270,14 @@ func (b Buttons) Contain(buttons Buttons) bool {
|
||||
|
||||
func (b Buttons) String() string {
|
||||
var strs []string
|
||||
if b.Contain(ButtonLeft) {
|
||||
strs = append(strs, "ButtonLeft")
|
||||
if b.Contain(ButtonPrimary) {
|
||||
strs = append(strs, "ButtonPrimary")
|
||||
}
|
||||
if b.Contain(ButtonRight) {
|
||||
strs = append(strs, "ButtonRight")
|
||||
if b.Contain(ButtonSecondary) {
|
||||
strs = append(strs, "ButtonSecondary")
|
||||
}
|
||||
if b.Contain(ButtonMiddle) {
|
||||
strs = append(strs, "ButtonMiddle")
|
||||
if b.Contain(ButtonTertiary) {
|
||||
strs = append(strs, "ButtonTertiary")
|
||||
}
|
||||
return strings.Join(strs, "|")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user