-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
WINDOW_BUFFER_SIZE_EVENT generated during window scrolling #281
Comments
Thank you for the report. I've copied this into my internal bug queue as MSFT: 19275577. |
Another (possibly related) observation: v2 console sends WINDOW_BUFFER_SIZE_EVENT even if ENABLE_WINDOW_INPUT flag is not set:
|
1. Hello again, rainbow: continuation of build 2070 after seven years. - Added a new option "Use Virtual Terminal for rendering" to Interface settings. - Added "Advanced" button to Color dialog. - Fixed bugs related to colors combination. In other words - happy Windows 10 owners now can enjoy TrueColor without intermediaries and right on the spot. 2. Workaround for microsoft/terminal#281.
It looks like this was an intentional change to fix Maximus5/ConEmu#1123. We don't really have any other notification mechanism for the viewport or buffer changing, so it looks like we're triggering that event whenever the view changes even when the buffer size does not to try to keep things in sync. It looks like at the time we thought that applications receiving an additional message with no actual change wouldn't really be harmed by that information as whatever they were doing would probably be able to detect nothing really happened with In theory, we could revert the change and come up with a new message type or notification type for the viewport change behavior and then change other downstream components that are now relying on it for synchrony, but I'm a bit hesitant to do that because this is the first report I've seen of it causing issues after being in the wild for over a year. I'm also afraid changing it to fix your issue will then cause me to have to completely revisit the ConEmu one and potentially cause other bugs as a result. Is it an extremely onerous change in your software to realize that nothing has actually changed when this message comes through with the same buffer size as before? If so, can you further describe your scenario and estimated usage market? It would be useful to weigh your report versus the installed market of ConEmu and WSL users to see whether it's worth the risk of changing this further at this time or if I need to defer a more complete solution to a future milestone. |
Thanks for looking into this. Indeed, there was no way for applications to receive notifications about window changing. And now there is one (sort of). Sadly this looks like a quick hack rather than a long-term solution - the only information provided is basically "something's happened, go figure it out yourself":
Also, what about this (see above):
- Shouldn't the event be generated in both cases if you're triggering that event "whenever the view changes"? Our scenario:
Detecting that nothing has actually changed is not extremely onerous, and that's what I already did a month ago (a commit reference is just above your comment), so it's not a blocker for us at least. I'd say reverting this and introducing a new notification type for the window changes is a Good Thing To Do in general:
Obviously, the final decision is yours. But, in any case:
|
You're right, the event should probably be generated in both of those cases if it should be generated in either one. You're also right that the documentation should probably be reflecting what happens. And you're right that we would have to look into the ENABLE_WINDOW_INPUT console mode. You're also right that the solution of sending this event in hindsight is a dirtier quick hack than we thought it was at the time. So I think what I'm going to do is promote the work item type here from a simple bug into a deliverable. It's obvious to me by how many nuances there are to this particular scenario that it needs a more concerted effort to resolve this than a simple bug fix. I do think The Right Thing To Do is for it to have its own event notification and try to resolve the ConEmu/WSL thing through that mechanism instead. It looks like you are unblocked for now through your own workaround (sorry, I didn't see the link attached at first). That takes a bit of the pressure off and means that taking longer to craft the right solution (Deliverable style) is easier to justify than making another hack on top of this hack (Bug style). |
Deliverable ID: 19275577 - Craft comprehensive solution to buffer/window overload on Input event |
@miniksa I noticed (unless I'm doing something wrong) that ENABLE_VIRTUAL_TERMINAL_INPUT and ENABLE_WINDOWS_INPUT seem to be mutually exclusive. This is a real pain in the ass since there's no other way to get console host resize events. Is this a bug you're also tracking? If not, I'll open a new issue. I'm on latest insider build, 18282. |
@oising The answer to that depends on how you're reading the console. I think that |
@DHowett-MSFT -- that's exactly what I'm doing, except I'm not seeing any events in the buffer. I'm testing by resizing the console window (dragging the corner) and also by adjusting from the control box (top left). Nothing in the input buffer. |
Do you have a minimal repro sample code I could debug? What @DHowett-MSFT describes is how WSL does it, so I'm 99% sure that should be working for you. |
@zadjii-msft I think the problem is that I had never really taken a good look at |
@oising Yea, that's what I would have expected as well, but apparently whoever wrote that API originally hadn't considered that. |
So for the record, sometime between RS2 and RS5, we changed the behavior of the console with respect to WINDOW_BUFFER_SIZE_EVENTs. We made the console send the events anytime the viewport size changed, not only the buffer size. However, we didn't change the actual values of the message, it still had the buffer size as the payload, not the viewport size. A client app can now use that message as a notification that the window might have changed size, and they could query the actual window size using GetConsoleScreenBufferInfo. We haven't added more messages yet, nor have we changed the content of any messages, only increased the frequency of the messages. I believe there were earlier builds where this change was scoped only to apps using VT input, but IIRC we changed it later to just send the events for all viewport changes regardless. This was probably a year ago, so I'm definitely hazy on the specifics. |
Thanks @zadjii-msft for the update. I'd still rather see a new event |
So how do you sync UI update due to console resize and a subsequent resize? As far as I know there's no way to ask Windows to wait or postpone resizing the console. |
/me necros thread
Well, if we meant to do this, we sure didn't. This works as expected for VT input, but not for apps that didn't ask for VT input. I can still repro the behavior from OP even on Windows 11 (circa 1.15 conhost builds), so we haven't ever accidentally fixed the bug at the root of the OP, and we surely didn't get around to adding the So I don't totally lose it: sample code for reproing this |
I just mentioned it on issue #305 but I realised the best way to trigger the SIGWINCH manually is to catch an event like WM_ERASEBKGND from the console window and poll the sizes there, here's a snippet from my code (which I also posted on issue #305):
I'm looping through the few events that I catch of the window so ignore the return statements and the library specific stuff like |
window buffer size.. to me, is a mixture of names by previous naming artist, SCROLL_EVENT sounds better oriented. scroll event happens only with the terminal that has a scrollback buffer, which is defined by 4 parameters - a change of any of the above parameters made by the user or by sending certain ESC sequences cause the scroll event. the scroll is not related to SIGWINCH that nix terminals have resize event or window size event or screen size event is a separate event, it may occur with the scroll or alone. it is similar to SIGWINCH *fix: resize event absorbs (includes) scroll event, resize > scroll, so only one shall be generated |
@awsdert those |
Oh darn, being a linux user I would never have found out until some time after releasing the library & launcher pair I'm working on. I'm making it because I'm tired of all the ABI and executable/library type issues caused by data models and os specific APIs. Far too many variants so I'm working on the pair to just link static libs against native objects that deal with the build:
$(CC) -o $(LIBPFX)foo$(LIBEXT) foo.a $(OSLIBS:%=-l %) ... My project is on gitlab under the same username, paw repo, if anyone is interested in occasionally taking a look (I'm a lazy dev so will take a while). |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
too much to worry about, not lazy. git has some masterpassword too, though i dont use git except for
uniformity at the API level is what matters, sure cant use some platform dependent types or structs, call it ABI or BABABI concept's the same relating to window magic you mentioned previously, i found out that it happens in FAR and also with another user, they probably send that WM_ erase background message to the window. can check it by slowly resizing the window frame, content redraws even before mouse btn been depressed. one of the polling properties should be the focus, when it's on, then poll, no sense otherwise. |
An ABI is that plus binary compatibility. And yes ABI matters, just take a look at all the workarounds the standard libraries (stdlib.h, stdint.h, etc) pull to keep their libraries working for native builds. What I'm doing just takes that a step further.
Good to know, will still test with wine primarily and via a copy of windows in qemu or similar once I'm satisfied. I don't think there's anything left to extract from either of these topics for now so let's just leave end the convo here for now so the admin doesn't need to decide if any more of our comments are off topic or not. |
i've re-read the topic and want to DISAGREE with the author's statement. buffer (scroll) is defined by size and offset, so the change in the offset shall generate the scroll event. the regarding to above window magic - it doesnt work (in the sense that window refreshes content and |
Windows Version 10.0.17763.1
Starting from Windows 10 1709 (FCU) such scrolling generates a WINDOW_BUFFER_SIZE_EVENT even though the console buffer size remains unchanged.
This breaks our application behaviour and does not make sense for the following reasons:
A minimal project to reproduce the issue attached.
BufferSizeEventBug.zip
The text was updated successfully, but these errors were encountered: