gio: widget: show pointer for clickable things v1 PROPOSED

~egonelbre: 1
 widget: show pointer for clickable things

 3 files changed, 3 insertions(+), 0 deletions(-)
#392041 apple.yml success
#392042 freebsd.yml success
#392043 linux.yml success
#392044 openbsd.yml success
Hmm, I guess that's true about the OS.
I was trying to make it more obvious what was clickable.

Yeah, let's drop this patch.

I guess using hover effect is a more common signifier than using CursorPointer.
Maybe having hover states is a better approach?
+ Egon

On Sun, Jan 10, 2021 at 4:29 PM Elias Naur <mail@eliasnaur.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/19438/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gio] widget: show pointer for clickable things Export this patch

From: Egon Elbre <egonelbre@gmail.com>

Changing cursor to "Pointer" is an important signifier for showing that
something is clickable.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
 widget/button.go | 1 +
 widget/enum.go   | 1 +
 widget/float.go  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/widget/button.go b/widget/button.go
index f534920..68d6a6a 100644
--- a/widget/button.go
+++ b/widget/button.go
@@ -76,6 +76,7 @@ func (b *Clickable) Layout(gtx layout.Context) layout.Dimensions {
	stack := op.Push(gtx.Ops)
	pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Add(gtx.Ops)
	pointer.CursorNameOp{Name: pointer.CursorPointer}.Add(gtx.Ops)
	for len(b.history) > 0 {
diff --git a/widget/enum.go b/widget/enum.go
index 442000e..d8f7682 100644
--- a/widget/enum.go
+++ b/widget/enum.go
@@ -39,6 +39,7 @@ func (e *Enum) Changed() bool {
func (e *Enum) Layout(gtx layout.Context, key string) layout.Dimensions {
	defer op.Push(gtx.Ops).Pop()
	pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min}).Add(gtx.Ops)
	pointer.CursorNameOp{Name: pointer.CursorPointer}.Add(gtx.Ops)

	if index(e.values, key) == -1 {
		e.values = append(e.values, key)
diff --git a/widget/float.go b/widget/float.go
index 8d21c68..6b64d25 100644
--- a/widget/float.go
+++ b/widget/float.go
@@ -57,6 +57,7 @@ func (f *Float) Layout(gtx layout.Context, pointerMargin int, min, max float32)
	rect.Min.X -= pointerMargin
	rect.Max.X += pointerMargin
	pointer.CursorNameOp{Name: pointer.CursorPointer}.Add(gtx.Ops)

	return layout.Dimensions{Size: size}
CursorPointer is widely used for Web UI, but rarely for native UI. I'm
not sure we want to unconditionally set CursorPointer for all
Clickables. Maybe a CursorClickable that is per-GOOS?