quiet refresh goroutine
This commit is contained in:
parent
665d2289e2
commit
77b4bcb94b
14
init.go
14
init.go
|
@ -219,14 +219,15 @@ func waitOK() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastRefresh time.Time
|
// empty function. this triggers gocui to refresh the screen
|
||||||
|
|
||||||
func testRefresh(*gocui.Gui) error {
|
func testRefresh(*gocui.Gui) error {
|
||||||
log.Info("in testRefresh")
|
// log.Info("in testRefresh")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// refresh the screen 10 times a second
|
||||||
func refreshGocui() {
|
func refreshGocui() {
|
||||||
|
var lastRefresh time.Time
|
||||||
lastRefresh = time.Now()
|
lastRefresh = time.Now()
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
@ -234,12 +235,13 @@ func refreshGocui() {
|
||||||
if !me.ok {
|
if !me.ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if time.Since(lastRefresh) > 1*time.Second {
|
if time.Since(lastRefresh) > 100*time.Millisecond {
|
||||||
if me.mouse.mouseUp {
|
if me.mouse.mouseUp {
|
||||||
log.Info("refresh now on mouseUp")
|
// log.Info("refresh now on mouseUp")
|
||||||
|
// todo: add logic here to see if the application has changed anything
|
||||||
me.baseGui.Update(testRefresh)
|
me.baseGui.Update(testRefresh)
|
||||||
} else {
|
} else {
|
||||||
log.Info("refresh skip on mouseDown")
|
// log.Info("refresh skip on mouseDown")
|
||||||
// me.baseGui.Update()
|
// me.baseGui.Update()
|
||||||
}
|
}
|
||||||
lastRefresh = time.Now()
|
lastRefresh = time.Now()
|
||||||
|
|
Loading…
Reference in New Issue