GUI: fix invisible text on Linux, tiny button hit-areas, missing labels.

Found by running and debugging the Linux build on a virtual display:

- impl_linux.go: set fontSize (16, like Darwin). It was only defined
  for the Android and Darwin builds, so on Linux every label and
  button was rendered at size zero (all text invisible).
- ui.go: extend the Button click area to the full button width, not
  just the label width. Short labels (e.g. a few characters in a
  full-width list row) had a tiny tap target that was easy to miss.
- main.go: set Color: black on the insert-page buttons (<, >, generate,
  @, #). A zero-value NRGBA has A=0 (transparent), so their labels
  were invisible even though the buttons worked.
- main.go: gofmt (modern operator spacing).
This commit is contained in:
Greg Pomerantz 2026-08-21 13:48:14 -04:00
parent e7218b1efd
commit 4b74367a55
4 changed files with 19 additions and 9 deletions

View File

@ -12,6 +12,10 @@ var (
noidLabelText = "No GPG ids available"
)
func init() {
fontSize = 16
}
func getConfDir() (string, error) {
ret, err := app.DataDir()
if err != nil {

View File

@ -651,17 +651,17 @@ func eventLoop() {
var insName, insValue string
genBtn := &SelButton{SelColor: gray}
genBtn.Button = Button{Size: unit.Sp(fontSize), Label: "generate"}
genBtn.Button = Button{Size: unit.Sp(fontSize), Label: "generate", Color: black}
symBtn := &SelButton{SelColor: gray}
numBtn := &SelButton{SelColor: gray}
symBtn.Button = Button{Size: unit.Sp(fontSize), Label: "@"}
numBtn.Button = Button{Size: unit.Sp(fontSize), Label: "#"}
symBtn.Button = Button{Size: unit.Sp(fontSize), Label: "@", Color: black}
numBtn.Button = Button{Size: unit.Sp(fontSize), Label: "#", Color: black}
symBtn.Select()
numBtn.Select()
lenEd := &widget.Editor{SingleLine: true, Alignment: text.End}
lenEd.SetText("15")
lBtn := &Button{Size: unit.Sp(fontSize), Label: "<", Background: gray}
rBtn := &Button{Size: unit.Sp(fontSize), Label: ">", Background: gray}
lBtn := &Button{Size: unit.Sp(fontSize), Label: "<", Color: black, Background: gray}
rBtn := &Button{Size: unit.Sp(fontSize), Label: ">", Color: black, Background: gray}
updatePw := func() {
if !genBtn.Selected {

View File

@ -89,8 +89,14 @@ func (b *Button) Layout(gtx C) D {
ret := ins.Layout(gtx, func(gtx C) D {
return l.Layout(gtx)
})
// Register the click handler for the label area.
stk := clip.Rect(image.Rectangle{Max: ret.Size}).Push(gtx.Ops)
// Register the click handler for the whole button area, not
// just the label: otherwise buttons with short labels (in
// full-width rows, for example) have a tiny tap target.
hit := ret.Size
if hit.X < gtx.Constraints.Max.X {
hit.X = gtx.Constraints.Max.X
}
stk := clip.Rect(image.Rectangle{Max: hit}).Push(gtx.Ops)
event.Op(gtx.Ops, b)
b.Click.Add(gtx.Ops)
stk.Pop()

View File

@ -63,9 +63,9 @@ func GetStore(store *Store) error {
}
for i := len(id) - 1; i > 0; i-- {
if id[i] == '>' {
for j := i-1; j > 0; j-- {
for j := i - 1; j > 0; j-- {
if id[j] == '<' {
id = id[j+1:i]
id = id[j+1 : i]
}
}
break