~eliasnaur/gio-patches

gio-example: all: bump gioui.org latest v1 PROPOSED

~egonelbre
~egonelbre: 1
 all: bump gioui.org latest

 6 files changed, 21 insertions(+), 40 deletions(-)
#443895 linux.yml success
Note, the x/component demo had a paint before layout.Inset handling. I
was assuming that it was implemented that way to change the color
outside the inset, I didn't test that behavior. However, I disabled
the inset handling just in case -- to make sure it doesn't modify the
existing behavior.

The latest x/component has double inset handling because the other
layout.Inset is still present.
+ Egon

On Mon, Mar 1, 2021 at 12:35 AM Chris Waldon
<christopher.waldon.dev@gmail.com> wrote:
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/20705/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gio-example] all: bump gioui.org latest Export this patch

~egonelbre
From: Egon Elbre <egonelbre@gmail.com>

Insets are now automatically added.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
---
 go.mod              |  2 +-
 go.sum              |  3 ++-
 kitchen/kitchen.go  | 10 +---------
 tabs/tabs.go        | 10 +---------
 x/component/main.go |  4 +++-
 x/notify/hello.go   | 32 +++++++++++++-------------------
 6 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/go.mod b/go.mod
index 8c3a872..204808e 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module gioui.org/example
go 1.13

require (
	gioui.org v0.0.0-20210225120118-f6fba7388544
	gioui.org v0.0.0-20210228180843-e1248651c871
	gioui.org/x v0.0.0-20210226015410-958111222865
	gioui.org/x/haptic v0.0.0-20210120222453-b55819bc712b
	gioui.org/x/notify v0.0.0-20210120222453-b55819bc712b
diff --git a/go.sum b/go.sum
index 208e528..a377b69 100644
--- a/go.sum
+++ b/go.sum
@@ -33,8 +33,9 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20210116085804-99bfa6a33cdf/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw=
gioui.org v0.0.0-20210225120118-f6fba7388544 h1:xQePGQEyaupU5lfPe3//VUVZLXNsjALGAppEVAEzRh8=
gioui.org v0.0.0-20210225120118-f6fba7388544/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw=
gioui.org v0.0.0-20210228180843-e1248651c871 h1:LDHDc7aDPdzf9I5MfEnSRCSJj6W0Nf6Dl9cLOGj4/ew=
gioui.org v0.0.0-20210228180843-e1248651c871/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw=
gioui.org/x v0.0.0-20210226015410-958111222865 h1:+Oqlmqi1rRugWA//OMKrQsdulyQB6j4QRo5Dm13jcqs=
gioui.org/x v0.0.0-20210226015410-958111222865/go.mod h1:y7BpIia0O/1wgqVHlfTBaoOCcR1Xm/psmu/1M9AfX9E=
gioui.org/x/haptic v0.0.0-20210120222453-b55819bc712b h1:3lHNKrTHXJCXhtmCVdTInlNuay3jSQ0SVi9JNQTj5yM=
diff --git a/kitchen/kitchen.go b/kitchen/kitchen.go
index 7ab0e24..7e43cdc 100644
--- a/kitchen/kitchen.go
+++ b/kitchen/kitchen.go
@@ -132,15 +132,7 @@ func loop(w *app.Window) error {
						transformTime = time.Time{}
					}
				}

				layout.Inset{
					Bottom: e.Insets.Bottom,
					Left:   e.Insets.Left,
					Right:  e.Insets.Right,
					Top:    e.Insets.Top,
				}.Layout(gtx, func(gtx C) D {
					return transformedKitchen(gtx, th)
				})
				transformedKitchen(gtx, th)
				e.Frame(gtx.Ops)
			}
		case p := <-progressIncrementer:
diff --git a/tabs/tabs.go b/tabs/tabs.go
index f8bc172..9b661ab 100644
--- a/tabs/tabs.go
+++ b/tabs/tabs.go
@@ -45,15 +45,7 @@ func loop(w *app.Window) error {
			return e.Err
		case system.FrameEvent:
			gtx := layout.NewContext(&ops, e)
			layout.Inset{
   				Bottom: e.Insets.Bottom,
   				Left:   e.Insets.Left,
    				Right:  e.Insets.Right,
    				Top:    e.Insets.Top,
			}.Layout(gtx, func(gtx C) D {
   		 		return drawTabs(gtx, th)
		})
		
			drawTabs(gtx, th)
			e.Frame(gtx.Ops)
		}
	}
diff --git a/x/component/main.go b/x/component/main.go
index 213b650..8d19038 100644
--- a/x/component/main.go
+++ b/x/component/main.go
@@ -613,7 +613,9 @@ func loop(w *app.Window) error {
			case system.DestroyEvent:
				return e.Err
			case system.FrameEvent:
				gtx := layout.NewContext(&ops, e)
				skipInset := e
				skipInset.Insets = system.Insets{}
				gtx := layout.NewContext(&ops, skipInset)
				for _, event := range bar.Events(gtx) {
					switch event := event.(type) {
					case component.AppBarNavigationClicked:
diff --git a/x/notify/hello.go b/x/notify/hello.go
index 744fbbf..54773f3 100644
--- a/x/notify/hello.go
+++ b/x/notify/hello.go
@@ -49,26 +49,20 @@ func loop(w *app.Window) error {
				notificationRequests <- struct{}{}
			}
			gtx := layout.NewContext(&ops, e)
			layout.Inset{
				Top:    e.Insets.Top,
				Bottom: e.Insets.Bottom,
				Left:   e.Insets.Left,
				Right:  e.Insets.Right,
			}.Layout(gtx, func(gtx layout.Context) layout.Dimensions {

				return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
					layout.Rigid(func(gtx layout.Context) layout.Dimensions {
						text := "notification errors will appear here"
						if err != nil {
							text = err.Error()
						}
						return material.Body1(th, text).Layout(gtx)
					}),
					layout.Flexed(1, func(gtx layout.Context) layout.Dimensions {
						return material.Button(th, &button, "Send Notification").Layout(gtx)
					}),
				)
			})
			layout.Flex{Axis: layout.Vertical}.Layout(gtx,
				layout.Rigid(func(gtx layout.Context) layout.Dimensions {
					text := "notification errors will appear here"
					if err != nil {
						text = err.Error()
					}
					return material.Body1(th, text).Layout(gtx)
				}),
				layout.Flexed(1, func(gtx layout.Context) layout.Dimensions {
					return material.Button(th, &button, "Send Notification").Layout(gtx)
				}),
			)

			e.Frame(gtx.Ops)
			if first {
				first = false
-- 
2.30.1
Thanks Egon! I've applied this, though with a subsequent patch to leverage the new behavior in x/component's demo as well.

Cheers,
Chris
builds.sr.ht
gio-example/patches/linux.yml: SUCCESS in 2m1s

[all: bump gioui.org latest][0] from [~egonelbre][1]

[0]: https://lists.sr.ht/~eliasnaur/gio-patches/patches/20705
[1]: mailto:egonelbre@gmail.com

✓ #443895 SUCCESS gio-example/patches/linux.yml https://builds.sr.ht/~eliasnaur/job/443895