xrandr/position.go

30 lines
444 B
Go
Raw Normal View History

2023-12-18 23:08:42 +01:00
package xrandr
type Position struct {
X int `json:"x"`
Y int `json:"y"`
}
func NewPositionFromString(x, y string) *Position {
if x == "" || y == "" {
return nil
}
return NewPosition(atoi(x), atoi(y))
}
func NewPosition(x, y int) *Position {
return &Position{x, y}
}
func (p *Position) Equivalent(o *Position) bool {
if p == o {
return true
}
if (p == nil) != (o == nil) {
return false
}
return p.X == o.X && p.Y == o.Y
}