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 {
|
||||
log.Info("in testRefresh")
|
||||
// log.Info("in testRefresh")
|
||||
return nil
|
||||
}
|
||||
|
||||
// refresh the screen 10 times a second
|
||||
func refreshGocui() {
|
||||
var lastRefresh time.Time
|
||||
lastRefresh = time.Now()
|
||||
for {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
@ -234,12 +235,13 @@ func refreshGocui() {
|
|||
if !me.ok {
|
||||
continue
|
||||
}
|
||||
if time.Since(lastRefresh) > 1*time.Second {
|
||||
if time.Since(lastRefresh) > 100*time.Millisecond {
|
||||
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)
|
||||
} else {
|
||||
log.Info("refresh skip on mouseDown")
|
||||
// log.Info("refresh skip on mouseDown")
|
||||
// me.baseGui.Update()
|
||||
}
|
||||
lastRefresh = time.Now()
|
||||
|
|
Loading…
Reference in New Issue