-
Notifications
You must be signed in to change notification settings - Fork 10
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
Unable to get/set window position on MouseMoved callback #121
Comments
from MouseMoved callback? |
Yup
…-------- Original Message --------
On Oct 19, 2024, 8:33 AM, Ben Perry < ***@***.***> wrote:
from MouseMoved callback?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
[ { ***@***.***": "http://schema.org", ***@***.***": "EmailMessage", "potentialAction": { ***@***.***": "ViewAction", "target": "[https://github.com](<a href=)/gopxl/pixel/issues/121#issuecomment-2423619274">#121 (comment)", "url": "[https://github.com](<a href=)/gopxl/pixel/issues/121#issuecomment-2423619274">#121 (comment)", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
|
Pixel uses a package called mainthread to interact with openGL to ensure all calls come from the same thread (required by OpenGL). The callbacks are processed from within a mainthread call, and the SetPos and GetPos also use mainthread calls, so they end up getting blocked on each other. Doesn't know that it's already running in the scope of mainthread, just blindly pushes the requests onto the call queue |
So I can't use both functions in that callback because they would cancel each other out and freeze the process/loop indefinitely?
|
In its current state, yes. This is a pretty good argument that the user callbacks should be run outside of the mainthread context though. Would have to collect the events as they are received and process them after. But then you could use any window function from within the callback. In the meantime, you could do something similar. Keep track of the callbacks you received each frame, and process them after win.Update() |
So for context I'm writing my own GUI framework of sorts (rendering sprites to an undecorated window with transparent framebuffer) and now that I got around to implementing window dragging its a workaround hell. Doing anything with
SetPos()
andGetPos()
in MouseMoved freezes everything for some reason. I have*opengl.Window
in my own struct if that even matters.The text was updated successfully, but these errors were encountered: