Skip to content

Commit

Permalink
Move GL errors behind hints flag as the are usually recoverable and c…
Browse files Browse the repository at this point in the history
…an be confusing

Fixes #1112
  • Loading branch information
andydotxyz committed Oct 14, 2020
1 parent 8062cfd commit d6c45e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions internal/hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import (
"runtime"
)

// HintsEnabled returns true to indicate that hints are currently switched on.
func HintsEnabled() bool {
return true
}

// LogHint reports a developer hint that should be followed to improve their app.
func LogHint(reason string) {
log.Println("Fyne hint: ", reason)
Expand Down
6 changes: 6 additions & 0 deletions internal/hints_disabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

package internal

// HintsEnabled returns false to indicate that hints are not currently switched on.
// To enable please rebuild with "-tags hints" parameters.
func HintsEnabled() bool {
return false
}

// LogHint reports a developer hint that should be followed to improve their app.
// This does nothing unless the "hints" build flag is used.
func LogHint(reason string) {
Expand Down
3 changes: 2 additions & 1 deletion internal/painter/gl/gl_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"fyne.io/fyne"
"fyne.io/fyne/canvas"
"fyne.io/fyne/internal"
"fyne.io/fyne/internal/cache"
"fyne.io/fyne/internal/painter"
"fyne.io/fyne/theme"
Expand All @@ -19,7 +20,7 @@ import (
var textures = make(map[fyne.CanvasObject]Texture, 1024)

func logGLError(err uint32) {
if err == 0 {
if err == 0 || !internal.HintsEnabled() {
return
}

Expand Down

0 comments on commit d6c45e4

Please sign in to comment.