mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
io/pointer: delete Foremost priority
It wasn't used, and it's not clear that it is useful at all in its current form. For example, a single control with multiple handler keys (say, one for scrolling and one for clicking) will only receive priority Foremost for one of them. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -236,14 +236,11 @@ func (q *pointerQueue) Push(e pointer.Event, events *handlerEvents) {
|
|||||||
if e.Type == pointer.Release {
|
if e.Type == pointer.Release {
|
||||||
q.pointers = append(q.pointers[:pidx], q.pointers[pidx+1:]...)
|
q.pointers = append(q.pointers[:pidx], q.pointers[pidx+1:]...)
|
||||||
}
|
}
|
||||||
for i, k := range p.handlers {
|
for _, k := range p.handlers {
|
||||||
h := q.handlers[k]
|
h := q.handlers[k]
|
||||||
e := e
|
e := e
|
||||||
switch {
|
if p.pressed && len(p.handlers) == 1 {
|
||||||
case p.pressed && len(p.handlers) == 1:
|
|
||||||
e.Priority = pointer.Grabbed
|
e.Priority = pointer.Grabbed
|
||||||
case i == 0:
|
|
||||||
e.Priority = pointer.Foremost
|
|
||||||
}
|
}
|
||||||
e.Hit = q.hit(h.area, e.Position)
|
e.Hit = q.hit(h.area, e.Position)
|
||||||
e.Position = h.transform.Invert().Transform(e.Position)
|
e.Position = h.transform.Invert().Transform(e.Position)
|
||||||
|
|||||||
+2
-2
@@ -95,8 +95,8 @@ For multiple grabbing handlers, the foremost handler wins.
|
|||||||
Priorities
|
Priorities
|
||||||
|
|
||||||
Handlers know their position in a matching set of a pointer through
|
Handlers know their position in a matching set of a pointer through
|
||||||
event priorities. The Shared and Foremost priorities are for matching sets
|
event priorities. The Shared priority is for matching sets with
|
||||||
with multiple handlers; the Grabbed priority indicate exclusive access.
|
multiple handlers; the Grabbed priority indicate exclusive access.
|
||||||
|
|
||||||
Priorities are useful for deferred gesture matching.
|
Priorities are useful for deferred gesture matching.
|
||||||
|
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ const (
|
|||||||
// Shared priority is for handlers that
|
// Shared priority is for handlers that
|
||||||
// are part of a matching set larger than 1.
|
// are part of a matching set larger than 1.
|
||||||
Shared Priority = iota
|
Shared Priority = iota
|
||||||
// Foremost is like Shared, but the handler is
|
|
||||||
// the foremost in the matching set.
|
|
||||||
Foremost
|
|
||||||
// Grabbed is used for matching sets of size 1.
|
// Grabbed is used for matching sets of size 1.
|
||||||
Grabbed
|
Grabbed
|
||||||
)
|
)
|
||||||
@@ -187,8 +184,6 @@ func (p Priority) String() string {
|
|||||||
switch p {
|
switch p {
|
||||||
case Shared:
|
case Shared:
|
||||||
return "Shared"
|
return "Shared"
|
||||||
case Foremost:
|
|
||||||
return "Foremost"
|
|
||||||
case Grabbed:
|
case Grabbed:
|
||||||
return "Grabbed"
|
return "Grabbed"
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user