Skip to content

Commit cf2b1f0

Browse files
committed
all: drop deprecated pointer and clip types
Signed-off-by: Chris Waldon <[email protected]>
1 parent 0eb3fcd commit cf2b1f0

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed

component/context-area.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"gioui.org/io/pointer"
1010
"gioui.org/layout"
1111
"gioui.org/op"
12+
"gioui.org/op/clip"
1213
)
1314

1415
// ContextArea is a region of the UI that responds to right-clicks
@@ -94,7 +95,7 @@ func (r *ContextArea) Layout(gtx C, w layout.Widget) D {
9495
// contextual widget.
9596
suppressionScrim := func() op.CallOp {
9697
macro2 := op.Record(gtx.Ops)
97-
pr := pointer.Rect(image.Rectangle{Min: image.Point{-1e6, -1e6}, Max: image.Point{1e6, 1e6}})
98+
pr := clip.Rect(image.Rectangle{Min: image.Point{-1e6, -1e6}, Max: image.Point{1e6, 1e6}})
9899
stack := pr.Push(gtx.Ops)
99100
pointer.InputOp{
100101
Tag: suppressionTag,
@@ -114,7 +115,7 @@ func (r *ContextArea) Layout(gtx C, w layout.Widget) D {
114115
// Lay out a scrim on top of the contextual widget to detect
115116
// completed interactions with it (that should dismiss it).
116117
pt := pointer.PassOp{}.Push(gtx.Ops)
117-
stack := pointer.Rect(image.Rectangle{Max: r.dims.Size}).Push(gtx.Ops)
118+
stack := clip.Rect(image.Rectangle{Max: r.dims.Size}).Push(gtx.Ops)
118119
pointer.InputOp{
119120
Tag: dismissTag,
120121
Grab: false,
@@ -129,7 +130,7 @@ func (r *ContextArea) Layout(gtx C, w layout.Widget) D {
129130

130131
// Capture pointer events in the contextual area.
131132
defer pointer.PassOp{}.Push(gtx.Ops).Pop()
132-
defer pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Push(gtx.Ops).Pop()
133+
defer clip.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Push(gtx.Ops).Pop()
133134
pointer.InputOp{
134135
Tag: r,
135136
Grab: false,

component/nav_drawer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (n *renderNavItem) Layout(gtx layout.Context, th *material.Theme) layout.Di
6666
}
6767
}
6868
defer pointer.PassOp{}.Push(gtx.Ops).Pop()
69-
defer pointer.Rect(image.Rectangle{
69+
defer clip.Rect(image.Rectangle{
7070
Max: gtx.Constraints.Max,
7171
}).Push(gtx.Ops).Pop()
7272
pointer.InputOp{

component/resizer.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"gioui.org/io/pointer"
88
"gioui.org/layout"
99
"gioui.org/op"
10+
"gioui.org/op/clip"
1011
)
1112

1213
// Resize provides a draggable handle in between two widgets for resizing their area.
@@ -74,7 +75,7 @@ func (f *float) Layout(gtx layout.Context, axis layout.Axis, w layout.Widget) la
7475
}
7576

7677
rect := image.Rectangle{Max: dims.Size}
77-
defer pointer.Rect(rect).Push(gtx.Ops).Pop()
78+
defer clip.Rect(rect).Push(gtx.Ops).Pop()
7879
f.drag.Add(gtx.Ops)
7980
cursor := pointer.CursorRowResize
8081
if axis == layout.Horizontal {

component/sheet.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"gioui.org/io/pointer"
1010
"gioui.org/layout"
1111
"gioui.org/op"
12+
"gioui.org/op/clip"
1213
"gioui.org/unit"
1314
"gioui.org/widget/material"
1415
)
@@ -127,7 +128,7 @@ func (s *ModalSheet) LayoutModal(contents func(gtx layout.Context, th *material.
127128

128129
// Beneath sheet content, listen for tap events. This prevents taps in the
129130
// empty sheet area from passing downward to the scrim underneath it.
130-
pr := pointer.Rect(image.Rectangle{Max: gtx.Constraints.Max})
131+
pr := clip.Rect(image.Rectangle{Max: gtx.Constraints.Max})
131132
defer pr.Push(gtx.Ops).Pop()
132133
pointer.InputOp{
133134
Tag: s,
@@ -141,7 +142,7 @@ func (s *ModalSheet) LayoutModal(contents func(gtx layout.Context, th *material.
141142

142143
// On top of sheet content, listen for drag events to close the sheet.
143144
defer pointer.PassOp{}.Push(gtx.Ops).Pop()
144-
defer pointer.Rect(image.Rectangle{Max: gtx.Constraints.Max}).Push(gtx.Ops).Pop()
145+
defer clip.Rect(image.Rectangle{Max: gtx.Constraints.Max}).Push(gtx.Ops).Pop()
145146
s.drag.Add(gtx.Ops)
146147

147148
return dims

component/text_field.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func (in *TextField) Layout(gtx C, th *material.Theme, hint string) D {
338338
}),
339339
layout.Expanded(func(gtx C) D {
340340
defer pointer.PassOp{}.Push(gtx.Ops).Pop()
341-
defer pointer.Rect(image.Rectangle{
341+
defer clip.Rect(image.Rectangle{
342342
Max: gtx.Constraints.Min,
343343
}).Push(gtx.Ops).Pop()
344344
in.click.Add(gtx.Ops)

component/tooltip.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (t *TipArea) Layout(gtx C, tip Tooltip, w layout.Widget) D {
209209
layout.Stacked(w),
210210
layout.Expanded(func(gtx C) D {
211211
defer pointer.PassOp{}.Push(gtx.Ops).Pop()
212-
defer pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Push(gtx.Ops).Pop()
212+
defer clip.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Push(gtx.Ops).Pop()
213213
pointer.InputOp{
214214
Tag: t,
215215
Types: pointer.Press | pointer.Release | pointer.Enter | pointer.Leave,

outlay/table.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (t *Table) Layout(gtx layout.Context, xn, yn int, el Cell) layout.Dimension
5959
// Grab all scroll events for the lists.
6060
xMin, xMax := listScrollBounds(t.xList.Position, xn)
6161
yMin, yMax := listScrollBounds(t.yList.Position, yn)
62-
pr := pointer.Rect(image.Rectangle{Max: csMax}).Push(gtx.Ops)
62+
pr := clip.Rect(image.Rectangle{Max: csMax}).Push(gtx.Ops)
6363
pointer.InputOp{
6464
Tag: t,
6565
Types: pointer.Press | pointer.Drag | pointer.Release | pointer.Scroll,

richtext/richtext.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"gioui.org/io/pointer"
1313
"gioui.org/layout"
1414
"gioui.org/op"
15+
"gioui.org/op/clip"
1516
"gioui.org/op/paint"
1617
"gioui.org/text"
1718
"gioui.org/unit"
@@ -292,7 +293,7 @@ func (t TextStyle) Layout(gtx layout.Context) layout.Dimensions {
292293
// set this offset to the upper corner of the text, not the lower
293294
shape.offset.Y -= lineDims.Y
294295
offStack := op.Offset(layout.FPt(shape.offset)).Push(gtx.Ops)
295-
pr := pointer.Rect(image.Rectangle{Max: shape.size}).Push(gtx.Ops)
296+
pr := clip.Rect(image.Rectangle{Max: shape.size}).Push(gtx.Ops)
296297
state.Layout(gtx)
297298
pointer.CursorNameOp{Name: pointer.CursorPointer}.Add(gtx.Ops)
298299
pr.Pop()

0 commit comments

Comments
 (0)