mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +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:
+2
-2
@@ -172,7 +172,7 @@ func (c *Click) Events(q event.Queue) []ClickEvent {
|
||||
if c.pressed {
|
||||
break
|
||||
}
|
||||
if e.Source == pointer.Mouse && e.Buttons != pointer.ButtonLeft {
|
||||
if e.Source == pointer.Mouse && e.Buttons != pointer.ButtonPrimary {
|
||||
break
|
||||
}
|
||||
if !c.entered {
|
||||
@@ -341,7 +341,7 @@ func (d *Drag) Events(cfg unit.Metric, q event.Queue, axis Axis) []pointer.Event
|
||||
|
||||
switch e.Type {
|
||||
case pointer.Press:
|
||||
if !(e.Buttons == pointer.ButtonLeft || e.Source == pointer.Touch) {
|
||||
if !(e.Buttons == pointer.ButtonPrimary || e.Source == pointer.Touch) {
|
||||
continue
|
||||
}
|
||||
if d.dragging {
|
||||
|
||||
@@ -64,7 +64,7 @@ func mouseClickEvents(times ...time.Duration) []event.Event {
|
||||
press := pointer.Event{
|
||||
Type: pointer.Press,
|
||||
Source: pointer.Mouse,
|
||||
Buttons: pointer.ButtonLeft,
|
||||
Buttons: pointer.ButtonPrimary,
|
||||
}
|
||||
events := make([]event.Event, 0, 2*len(times))
|
||||
for _, t := range times {
|
||||
|
||||
Reference in New Issue
Block a user