WinEvents and ConPTY question #2544

Closed
opened 2026-01-30 22:58:01 +00:00 by claunia · 4 comments
Owner

Originally created by @parkovski on GitHub (Jul 3, 2019).

Originally assigned to: @bitcrazed on GitHub.

A few days ago I noticed that NeoVim in tmux does not pick up resize events properly, but mysteriously when a different console window is resized, it suddenly fixes itself. I just tracked this down to the fact that libuv is listening for the EVENT_CONSOLE_LAYOUT WinEvent for any window, which doesn't seem to be firing for PTY layout changes.

Now, I believe this is a libuv bug and they should be handling WINDOW_BUFFER_SIZE_EVENT. But before ConPTY existed, their way did work.

Basically I'm looking for some clarification here - what are the console WinEvents supposed to be for, and should they be enabled for PTYs as well? And if not, it might be a good idea to document that they are only sent for actual conhost windows.

Originally created by @parkovski on GitHub (Jul 3, 2019). Originally assigned to: @bitcrazed on GitHub. A few days ago I noticed that NeoVim in tmux does not pick up resize events properly, but mysteriously when a different console window is resized, it suddenly fixes itself. I just tracked this down to the fact that [libuv is listening for the EVENT_CONSOLE_LAYOUT WinEvent for any window](https://github.com/libuv/libuv/blob/7ed1eced3145c9eb17f831c2d66cdaa3d440d904/src/win/tty.c#L2294), which doesn't seem to be firing for PTY layout changes. Now, I believe this is a libuv bug and they should be handling `WINDOW_BUFFER_SIZE_EVENT`. But before ConPTY existed, their way did work. Basically I'm looking for some clarification here - what are the console WinEvents supposed to be for, and should they be enabled for PTYs as well? And if not, it might be a good idea to document that they are only sent for actual conhost windows.
claunia added the Issue-QuestionResolution-AnsweredArea-InteropProduct-Conpty labels 2026-01-30 22:58:01 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Jul 3, 2019):

Hey, it's really funny that you should mention this. I'm working on filing a bug on them for this exact issue, because their winevent hook degrades performance for all console workloads by a few percentage points if a libuv thing is running whatsoever.

I believe that WinEvents are not part of the compatibility guarantee for pseudoconsoles. @miniksa can keep me honest here.

@DHowett-MSFT commented on GitHub (Jul 3, 2019): Hey, it's really funny that you should mention this. I'm working on filing a bug on them for this exact issue, because their winevent hook degrades performance for _all console workloads_ by a few percentage points if a libuv thing is running whatsoever. I believe that _WinEvents are not part of the compatibility guarantee for pseudoconsoles._ @miniksa can keep me honest here.
Author
Owner

@oising commented on GitHub (Jul 4, 2019):

More info: https://github.com/microsoft/terminal/issues/410 @parkovski

@oising commented on GitHub (Jul 4, 2019): More info: https://github.com/microsoft/terminal/issues/410 @parkovski
Author
Owner

@miniksa commented on GitHub (Jul 5, 2019):

Hey, it's really funny that you should mention this. I'm working on filing a bug on them for this exact issue, because their winevent hook degrades performance for all console workloads by a few percentage points if a libuv thing is running whatsoever.

I believe that WinEvents are not part of the compatibility guarantee for pseudoconsoles. @miniksa can keep me honest here.

Correct. Given that UIA (released 2005) is the replacement for WinEvents/MSAA (released 1997) and UIA is significantly less terrible than MSAA performance-wise (and otherwise), we didn't consider it during the implementation of ConPTY (2018).

Also, MSAA and UIA are for accessibility tools and user interface testing. I don't guarantee anything if you're not attempting to use them for those purposes.

@miniksa commented on GitHub (Jul 5, 2019): > Hey, it's really funny that you should mention this. I'm working on filing a bug on them for this exact issue, because their winevent hook degrades performance for _all console workloads_ by a few percentage points if a libuv thing is running whatsoever. > > I believe that _WinEvents are not part of the compatibility guarantee for pseudoconsoles._ @miniksa can keep me honest here. Correct. Given that UIA (released 2005) is the replacement for WinEvents/MSAA (released 1997) and UIA is significantly less terrible than MSAA performance-wise (and otherwise), we didn't consider it during the implementation of ConPTY (2018). Also, MSAA and UIA are for accessibility tools and user interface testing. I don't guarantee anything if you're not attempting to use them for those purposes.
Author
Owner

@DHowett-MSFT commented on GitHub (Jul 8, 2019):

I'm marking this one as answered and closing it. I'll follow up with the libuv bug. 😄

@DHowett-MSFT commented on GitHub (Jul 8, 2019): I'm marking this one as answered and closing it. I'll follow up with the libuv bug. :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#2544