Pseudoconsole hosting window position and size do not match the Terminal window #13525
Labels
Area-Server
Down in the muck of API call servicing, interprocess communication, eventing, etc.
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Product-Conpty
For console issues specifically related to conpty
Milestone
Windows Terminal version
1.15.1863.0 (preview)
Windows build number
10.0.22621.232
Other Software
All Win32 CUI apps that use GUI windows (incl. popups and dialogs) with the console as the parent.
Steps to reproduce
So ConPTY now has pseudoconsole hosting windows for Win32 CUI apps to be able to get a handle using GetConsoleWindow and support some of the scenarios expected from a Windows console host.
A common scenario is for a CUI app to use some GUI elements such as messageboxes and dialogs, using the console HWND as the parent.
Messageboxes as well as dialogs with the
DS_CENTER
flag automatically get centered on the monitor containing the parent window. Many apps will go further and try to center their dialogs over their parent window.This is important on multi-monitors system to have the new window visibly related to its parent instead of in the center of the primary/main display, making it easier to find or even to notice. It also improves productivity by minimizing the pointer movements required to reach related UI.
See for example the following code:
Currently, this works when using the legacy console as its window is properly positioned and sized, but always get displayed on the primary/main monitor when using the Terminal.
When using Terminal, the pseudoconsole hosting window is always located at 0,0 and sized 16,16.
This can be tested with the following code:
This makes screen-centered messageboxes and dialogs centered in the primary/main display instead of on the monitor where the Terminal is.
Even worse, some apps trying to center their dialogs over their parent window do not handle desktop boundaries and will clip their dialogs by centering them at 8,8, making it difficult even to move them into view since their title bars are offscreen (unless user has negative coordinates monitors as part of their desktop).
Expected Behavior
Pseudoconsole hosting windows should be moved and sized to always match the Terminal window, so that apps relying on GetWindowRect get valid values. Note even the dialog manager and the MessageBox function are using those values to center popups and dialogs on the same display.
Actual Behavior
CUI apps relying on pseudoconsole hosting windows positions and sizes will not display messageboxes and dialogs in their intended location, and sometimes even partially offscreen.
The text was updated successfully, but these errors were encountered: