-
Notifications
You must be signed in to change notification settings - Fork 927
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
ControlFlow
is ignored while window is being resized on Windows
#3272
Comments
ControlFlow
ignored while window is resized on WindowsControlFlow
is ignored while window is resized on Windows
ControlFlow
is ignored while window is resized on WindowsControlFlow
is ignored while window is being resized on Windows
I generally don't see what could be causing this, like the Would suggest to step with debugger or something like that before it tries to go back to polling. |
This seems to be happening when interacting with the window buttons as well. Recording.2023-12-20.092743.-.Trim.mp4Recording.2023-12-20.055544.mp4 |
I mean, the only thing that is helpful would be debugging the |
Some more info: dispatch_peeked_messages never returns after the DispatchMessageW(msg = WM_NCLMOUSEDOWN) until after the user releases the mouse. WM_PAINT events continuously flow while it's paused there. |
Some (long running) actions in Windows start modal event loops (e.g as mentioned resizing and non-client area interactions) on top of the current running event loop iteration. Before the event loop changes the Windows backend internally checked the control flow on Continous presentation should be possible by requesting redraws inside the redraw event to periodically schedule new paint events. (IIRC non-client area didn't work in the past and might need some internal handling to correctly trigger redraws) |
@msiglreith I think the issue is that there's no resize at all now and the events are not sent to user? Though, it's hard to get that based on video (where you must hunt for log and could easily miss) and report saying that it's just broken. Could you look into that when you have time? |
Yes, this is the issue. It will repaint because the window itself is receiving paint events but the dispatcher is still stuck waiting for the resize event to stop. No other events will flow back to the user at this time, which makes it impossible to do other things besides repaint while resizing, but normally you'd be able to (and other platforms work properly). |
@msiglreith Do you know why winit uses a hidden window on win32 to receive events? I believe this issue would also be solved by forwarding window events in the wndproc of each window separately rather than using a separate window to receive the events. I've played with this design in my own rusty-windows testbed and I don't see why the current design was chosen. |
@dtzxporter There is basically one eventloop window which kind of ties things together: it handles 'global' events (like raw input) but also as interface for the user to handle custom events or calls, which should execute in the same thread/execution context as the event loop. |
Can't windows just reside on the main thread and requests basically being called via threaded_executor or something? And maybe some stuff via side channels to remove the delays, like for |
Right, but why is that logic in an event loop window instead of literally in the event loop before:
You can handle raw input directly in that loop before Custom events can be registered that also make it to the 'thread' that is running the dispatch loop. Then, each window's wndproc handles it's specific events and forwards them to the winit event loop. Adding a window and using it as an event loop seems like an unnecessary workaround for just processing in the main event loop. (And I believe this is the root cause of the issue because we can't wake up the other windows event loop while another is resizing, however, the main loop's dispatch loop will always fire) |
Yes, it probably could be replaced with another solution - raw input could be associated to no window and the OS will then pick the one currently in focus, but currently I don't see how this would help with the current issue. For resizing, in comparison to the control buttons, it's possible to poke the message queue to execute our callback but the OS will still block until the current action finishes. |
What I mean is that the window 'stuck' in the resize loop's wndproc can be used to continue to flow winit events? SetTimer can also be used to wake up that loop provided you specify the hwnd of the window currently in the resize loop:
WM_TIMER => {
println!("timer!");
} |
The
ControlFlow
set on theEventLoopWindowTarget
is currently ignored on Windows while a window is being resized.As a result, the
EventLoop
is not resumed when it should during the resizing process whenWaitUntil
orPoll
are set as the control flow.Other platforms are unaffected and work as expected.
The text was updated successfully, but these errors were encountered: