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

Spurious events? #64

Closed
joe9 opened this issue Sep 20, 2016 · 2 comments
Closed

Spurious events? #64

joe9 opened this issue Sep 20, 2016 · 2 comments

Comments

@joe9
Copy link

joe9 commented Sep 20, 2016

Hello,

Thanks for sharing the GLFW-b.

I am trying to figure out why I am getting spurious events when I run the GLFW-b-demo. The issue seems to be with GLFW-b. But, I am not sure about it and hence want to get some expert opinion about it.

With this patch to the Main.hs, I am expecting the message "received GLFW event" to be fired only when there is an actual event.

git diff
diff --git a/src/Main.hs b/src/Main.hs
index 89799f4..fcb2b56 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -210,7 +210,9 @@ run = do
     liftIO $ do
         GLFW.swapBuffers win
         GL.flush  -- not necessary, but someone recommended it
-        GLFW.pollEvents
+--         GLFW.pollEvents
+        GLFW.waitEvents
+        liftIO (putStrLn "received GLFW event")
     processEvents

     state <- get

But, for some reason, I keep getting the message "received GLFW event" almost as if it is running in an endless loop. I tested the events behaviour using the tests/events.c of the glfw github master branch and it works fine.

TMPDIR=/tmp/ghc stack exec GLFW-b-demo
    ------------------------------------------------------------
    '?': Print these instructions
    'i': Print GLFW information

    * Mouse cursor, keyboard cursor keys, and/or joystick
      control rotation.
    * Mouse scroll wheel controls distance from scene.
    ------------------------------------------------------------
received GLFW event
window refresh:
window iconify: IconifyState'NotIconified
framebuffer size: 836 513
window size: 836 513
window pos: 0 17
window iconify: IconifyState'NotIconified
window focus: FocusState'Focused
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
key: Key'X 53 KeyState'Pressed [mod keys: none]
char: 'q'
key: Key'X 53 KeyState'Released [mod keys: none]
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
received GLFW event
key: Key'Escape 9 KeyState'Pressed [mod keys: none]
GLFW-b-demo: <stdout>: commitBuffer: invalid argument (Bad file descriptor)
-

Thanks

@JavierJF
Copy link
Collaborator

Thanks for reporting, I'm trying to trace this, from know I just have several thoughts of what It could be. I will post the updates I have made if they lead me to any conclusions. But indeed it could be something.

@joe9
Copy link
Author

joe9 commented Sep 22, 2016

There is an issue with glfwWaitEvents glfw/glfw#866 . This could be related to that.

@JavierJF

@joe9 joe9 closed this as completed Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants