@@ -936,6 +936,21 @@ func (w *Window) GetClipboardString() string {
936
936
return C .GoString (cs )
937
937
}
938
938
939
+ // panicErrorExceptForInvalidValue is the same as panicError but ignores
940
+ // invalidValue.
941
+ func panicErrorExceptForInvalidValue () {
942
+ // invalidValue can happen when specific joysticks are used. This issue
943
+ // will be fixed in GLFW 3.3.5. As a temporary fix, ignore this error.
944
+ // See go-gl/glfw#292, go-gl/glfw#324, and glfw/glfw#1763.
945
+ err := acceptError (invalidValue )
946
+ if e , ok := err .(* Error ); ok && e .Code == invalidValue {
947
+ return
948
+ }
949
+ if err != nil {
950
+ panic (err )
951
+ }
952
+ }
953
+
939
954
// PollEvents processes only those events that have already been received and
940
955
// then returns immediately. Processing events will cause the window and input
941
956
// callbacks associated with those events to be called.
@@ -947,7 +962,7 @@ func (w *Window) GetClipboardString() string {
947
962
// This function may only be called from the main thread.
948
963
func PollEvents () {
949
964
C .glfwPollEvents ()
950
- panicError ()
965
+ panicErrorExceptForInvalidValue ()
951
966
}
952
967
953
968
// WaitEvents puts the calling thread to sleep until at least one event has been
@@ -965,7 +980,7 @@ func PollEvents() {
965
980
// This function may only be called from the main thread.
966
981
func WaitEvents () {
967
982
C .glfwWaitEvents ()
968
- panicError ()
983
+ panicErrorExceptForInvalidValue ()
969
984
}
970
985
971
986
// WaitEventsTimeout puts the calling thread to sleep until at least one event is available in the
@@ -992,7 +1007,7 @@ func WaitEvents() {
992
1007
// Event processing is not required for joystick input to work.
993
1008
func WaitEventsTimeout (timeout float64 ) {
994
1009
C .glfwWaitEventsTimeout (C .double (timeout ))
995
- panicError ()
1010
+ panicErrorExceptForInvalidValue ()
996
1011
}
997
1012
998
1013
// PostEmptyEvent posts an empty event from the current thread to the main
0 commit comments