ref: 68691c82402b473215a17850f4007bde4a02f12f
parent: ef6a836bbc71c1e4f1e41b0cea12ab075587ab79
author: Philip Silva <philip.silva@protonmail.com>
date: Tue Jun 8 14:08:08 EDT 2021
Improved scroll redraw
--- a/browser/browser.go
+++ b/browser/browser.go
@@ -33,9 +33,6 @@
const debugPrintHtml = false
const EnterKey = 10
-// alwaysForceDraw to prevent blurry text after mouse
-// hovering
-const alwaysForceDraw = true
// cursor based on Clipart from Francesco 'Architetto' Rollandin
// OpenClipart SVG ID: 163773 from OCAL 0.18 release 16/11/2019
@@ -400,7 +397,7 @@
if el == nil {
return
}
- force = alwaysForceDraw
+
// It would be possible to avoid flickers under certain circumstances
// of overlapping elements but the load for this is high:
// if self.Draw == duit.DirtyKid {
@@ -636,9 +633,9 @@
maxX := self.R.Dx()
maxY := self.R.Dy()
if 5 <= x && x <= (maxX-5) && 5 <= y && y <= (maxY-5) && el.IsLink {
- dui.Display.SetCursor(&draw.Cursor{
- Set: cursor,
- })
+ //dui.Display.SetCursor(&draw.Cursor{
+ // Set: cursor,
+ //})
if m.Buttons == 0 {
r.Consumed = true
return r
--- a/browser/grid.go
+++ b/browser/grid.go
@@ -177,7 +177,6 @@
}
func (ui *Grid) Draw(dui *duit.DUI, self *duit.Kid, img *draw.Image, orig image.Point, m draw.Mouse, force bool) {
- force = alwaysForceDraw
duit.KidsDraw(dui, self, ui.Kids, ui.size, ui.Background, img, orig, m, force)
}
--- a/browser/scroll.go
+++ b/browser/scroll.go
@@ -99,7 +99,7 @@
return
}
- ui.scroll(0)
+ // ui.scroll(0)
barHover := m.In(ui.barR)
bg := dui.ScrollBGNormal
@@ -184,7 +184,7 @@
return r
}
-func (ui *Scroll) scroll(delta int) bool {
+func (ui *Scroll) scroll(delta int) (changed bool) {
o := ui.Offset
ui.Offset += delta
ui.Offset = maximum(0, ui.Offset)
@@ -245,34 +245,26 @@
}
func (ui *Scroll) Mouse(dui *duit.DUI, self *duit.Kid, m draw.Mouse, origM draw.Mouse, orig image.Point) (r duit.Result) {
+ if m.Buttons == 0 { return }
if m.Point.In(ui.barR) {
r.Hit = ui
r.Consumed = ui.scrollMouse(m, false)
self.Draw = duit.Dirty
return
- }
- if m.Point.In(ui.childR) {
+ } else if m.Point.In(ui.childR) {
+ r.Consumed = ui.scrollMouse(m, true)
+ if r.Consumed {
+ self.Draw = duit.Dirty
+ return
+ }
nOrigM := origM
nOrigM.Point = nOrigM.Point.Add(image.Pt(-ui.scrollbarSize, ui.Offset))
nm := m
nm.Point = nm.Point.Add(image.Pt(-ui.scrollbarSize, ui.Offset))
r = ui.Kid.UI.Mouse(dui, &ui.Kid, nm, nOrigM, image.ZP)
- ui.warpScroll(dui, self, r.Warp, orig)
- scrolled := false
- if !r.Consumed {
- scrolled = ui.scrollMouse(m, true)
- r.Consumed = scrolled
+ if r.Consumed {
+ self.Draw = duit.Dirty
}
- ui.result(dui, self, &r, scrolled)
- if r.Hit != ui.lastMouseUI {
- if r.Hit != nil {
- ui.Mark(self, r.Hit, false)
- }
- if ui.lastMouseUI != nil {
- ui.Mark(self, ui.lastMouseUI, false)
- }
- }
- ui.lastMouseUI = r.Hit
}
return
}
--- a/package.rc
+++ b/package.rc
@@ -1,31 +1,42 @@
-name='opossum-plan9-amd64'
+name64='opossum-plan9-amd64'
+name32='opossum-plan9-386'
+tarball64=`{pwd} ^ '/packages/' ^ $name64 ^ '-v0.0.1-' ^ `{date -i} ^ '-' ^ `{cat /mnt/git/branch/heads/master/hash | read -c 6} ^ '.tgz'
+tarball32=`{pwd} ^ '/packages/' ^ $name32 ^ '-v0.0.1-' ^ `{date -i} ^ '-' ^ `{cat /mnt/git/branch/heads/master/hash | read -c 6} ^ '.tgz'
-rm -rf ./$name
-mkdir ./$name
-mkdir -p ./packages
-chmod +t ./$name
+fn build {
+ tarball=$1
+ name=$2
+ GOARCH=$3
+ rm -rf ./$name
+ mkdir ./$name
+ mkdir -p ./packages
+ chmod +t ./$name
+
+ echo Compiling $GOARCH...
+ cd cmd/browse
+ go build -ldflags '-s -w' -o $name.bin
+ cd ../..
+ mv cmd/browse/$name.bin .
+ mv $name.bin ./$name/
+ cp README.md ./$name/
+ cp opossum.jpg ./$name/
+ tar czf $tarball $name
+ chmod +t $tarball
+ echo Created $tarball
+}
+
echo Testing...
go vet ./...
go test -cover ./...
-echo Compiling...
-cd cmd/browse
-go build -ldflags '-s -w' -o $name.bin
-cd ../..
-mv cmd/browse/$name.bin .
-mv $name.bin ./$name/
-cp README.md ./$name/
-cp opossum.jpg ./$name/
-tarball=`{pwd} ^ '/packages/' ^ $name ^ '-v0.0.1-' ^ `{date -i} ^ '-' ^ `{cat /mnt/git/branch/heads/master/hash | read -c 6} ^ '.tgz'
-tar czf $tarball $name
-chmod +t $tarball
-echo Created $tarball
+build $tarball64 $name64 amd64
+build $tarball32 $name32 386
-echo Verifying $tarball ...
+echo Verifying $tarball64 ...
mkdir -p /tmp/`{date -n}
cd /tmp/`{date -n}
-tar xf $tarball
-cd $name
-./$name.bin '-quiet=false'
-./$name.bin '-experimentalJsInsecure=true' '-quiet=false'
+tar xf $tarball64
+cd $name64
+./$name64.bin '-quiet=false'
+./$name64.bin '-experimentalJsInsecure=true' '-quiet=false'