~eliasnaur/gio

ref: v0.7.1 gio/io/event/event.go -rw-r--r-- 766 bytes
9018c071Elias Naur Revert "app: [Windows] suppress double-click behaviour for custom decorations" 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: Unlicense OR MIT

// Package event contains types for event handling.
package event

import (
	"gioui.org/internal/ops"
	"gioui.org/op"
)

// Tag is the stable identifier for an event handler.
// For a handler h, the tag is typically &h.
type Tag interface{}

// Event is the marker interface for events.
type Event interface {
	ImplementsEvent()
}

// Filter represents a filter for [Event] types.
type Filter interface {
	ImplementsFilter()
}

// Op declares a tag for input routing at the current transformation
// and clip area hierarchy. It panics if tag is nil.
func Op(o *op.Ops, tag Tag) {
	if tag == nil {
		panic("Tag must be non-nil")
	}
	data := ops.Write1(&o.Internal, ops.TypeInputLen, tag)
	data[0] = byte(ops.TypeInput)
}