Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac Function Key InvalidValue: Invalid scancode #1024

Open
stuartmscott opened this issue May 22, 2020 · 7 comments
Open

Mac Function Key InvalidValue: Invalid scancode #1024

stuartmscott opened this issue May 22, 2020 · 7 comments
Labels
upstream A bug that likely comes from upstream

Comments

@stuartmscott
Copy link
Member

In the advanced tab of fyne_demo, fn key does not show up when pressed, however console contains:

2020/05/22 09:30:05 Fyne error:  GLFW poll event error: InvalidValue: Invalid scancode
2020/05/22 09:30:05   At: /Users/stuartscott/Documents/Projects/Go/src/fyne.io/fyne/internal/driver/glfw/loop.go:203
  • MacOSX Catalina
  • fyne@develop(5eea431)
@andydotxyz
Copy link
Member

I can now replicate on my MacBook Pro - it seems specific to the mac hardware (keyboard) and not a problem with other keyboards

@andydotxyz
Copy link
Member

This is being printed because GLFW does not recognise the key. Started a conversation upstream at glfw/glfw#1785

@galamiram
Copy link

Is it possible to disable GLFW from listening for keyboard events?

@andydotxyz
Copy link
Member

I think this is difficult to intercept because the error is in lookup.
GLFW sees the code and tries to find what it is. In that there is an error generated which is printed.
Frustrating, but I can't see a workaround.

@Goltanju
Copy link
Contributor

Long time on this one, I realize it's an upstream issue and hate to "necro" old issues that can't really be resolved here.

But, all that said, :) this has been a mess for me because most (every?) special key (vol up, down, etc.) on my keyboard triggers this log event. So, here's my modification for shipping software.

diff --git a/log.go b/log.go
index 53cd1b2db..1c5a70ddb 100644
--- a/log.go
+++ b/log.go
@@ -3,12 +3,16 @@ package fyne
 import (
        "log"
        "runtime"
+       "strings"
 )

 // LogError reports an error to the command line with the specified err cause,
 // if not nil.
 // The function also reports basic information about the code location.
 func LogError(reason string, err error) {
+       if strings.Contains(reason, "Invalid scancode") {
+               return
+       }
        log.Println("Fyne error: ", reason)
        if err != nil {
                log.Println("  Cause:", err)

Obviously a hack, but maybe Fyne has a "debugging only" mode where it can output these errors and otherwise suppress them?

@andydotxyz
Copy link
Member

Obviously a hack, but maybe Fyne has a "debugging only" mode where it can output these errors and otherwise suppress them?

Indeed it does, turned on with "-tags debug" - I agree your proposal is a little ugly but it does avoid logging something that the user won't be interested in :).

@Goltanju
Copy link
Contributor

-tags debug ... sometimes I miss the obvious, ha ha. Best way to do it too, as things can just compile right out when shipping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream A bug that likely comes from upstream
Projects
None yet
Development

No branches or pull requests

5 participants