-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Enable the Terminal to tell ConPTY who the owner is #12526
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
Changes from all commits
30863d2
555042e
31e9fef
cb2ad2b
b257581
2009147
669b1e2
5d96691
e46e9a3
23b6fee
cfded0f
cf65085
659d752
4edeec3
000cb83
0ba955d
5e54423
a536bb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,6 +145,7 @@ REGCLS | |
RETURNCMD | ||
rfind | ||
roundf | ||
ROOTOWNER | ||
RSHIFT | ||
SACL | ||
schandle | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ namespace Microsoft.Terminal.TerminalConnection | |
Guid Guid { get; }; | ||
String Commandline { get; }; | ||
void ClearBuffer(); | ||
void ReparentWindow(UInt64 newParent); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mind filing a followup to make this and the following ones about focus part of a new interface? |
||
|
||
static event NewConnectionHandler NewConnection; | ||
static void StartInboundListener(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,6 +262,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
const auto height = vp.Height(); | ||
_connection.Resize(height, width); | ||
|
||
if (_OwningHwnd != 0) | ||
{ | ||
if (auto conpty{ _connection.try_as<TerminalConnection::ConptyConnection>() }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't love this coupling, thus the interface :) |
||
{ | ||
conpty.ReparentWindow(_OwningHwnd); | ||
} | ||
} | ||
|
||
// Override the default width and height to match the size of the swapChainPanel | ||
_settings->InitialCols(width); | ||
_settings->InitialRows(height); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2794,4 +2794,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
} | ||
} | ||
|
||
void TermControl::OwningHwnd(uint64_t owner) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: vaguely prefer the |
||
{ | ||
_core.OwningHwnd(owner); | ||
} | ||
|
||
uint64_t TermControl::OwningHwnd() | ||
{ | ||
return _core.OwningHwnd(); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ namespace Microsoft::Console | |
enum class PtySignal : unsigned short | ||
{ | ||
ClearBuffer = 2, | ||
SetParent = 3, | ||
ResizeWindow = 8 | ||
}; | ||
|
||
|
@@ -49,10 +50,15 @@ namespace Microsoft::Console | |
unsigned short sx; | ||
unsigned short sy; | ||
}; | ||
struct SetParentData | ||
{ | ||
uint64_t handle; | ||
}; | ||
Comment on lines
+53
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why's this a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meh, they're all structs? I thought it was a nice abstraction to indicate "this is the packet of data that's sent". I don't expect to add more members in the future, but who knows. As far as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think transmitting it as a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, this is a wire format. 32-bit VSCode might be using 64-bit conhost (in fact: it is using 64-bit conhost). |
||
|
||
[[nodiscard]] HRESULT _InputThread(); | ||
bool _GetData(_Out_writes_bytes_(cbBuffer) void* const pBuffer, const DWORD cbBuffer); | ||
void _DoResizeWindow(const ResizeWindowData& data); | ||
void _DoSetWindowParent(const SetParentData& data); | ||
void _DoClearBuffer(); | ||
void _Shutdown(); | ||
|
||
|
@@ -62,5 +68,8 @@ namespace Microsoft::Console | |
bool _consoleConnected; | ||
std::optional<ResizeWindowData> _earlyResize; | ||
std::unique_ptr<Microsoft::Console::VirtualTerminal::ConGetSet> _pConApi; | ||
|
||
public: | ||
std::optional<SetParentData> _earlyReparent; | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -892,3 +892,17 @@ void ConhostInternalGetSet::UpdateSoftFont(const gsl::span<const uint16_t> bitPa | |
pRender->UpdateSoftFont(bitPattern, cellSize, centeringHint); | ||
} | ||
} | ||
|
||
void ConhostInternalGetSet::ReparentWindow(const uint64_t handle) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interesting -- why did we keep it a |
||
{ | ||
// This will initialize s_interactivityFactory for us. It will also | ||
// conveniently return 0 when we're on OneCore. | ||
zadjii-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// | ||
// If the window hasn't been created yet, by some other call to | ||
// LocatePseudoWindow, then this will also initialize the owner of the | ||
// window. | ||
if (const auto psuedoHwnd{ ServiceLocator::LocatePseudoWindow(reinterpret_cast<HWND>(handle)) }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
LOG_LAST_ERROR_IF_NULL(::SetParent(psuedoHwnd, reinterpret_cast<HWND>(handle))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just making sure . . . so this sets the OWNER, not the PARENT, for the same reason as below (no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exactly. There's no |
||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.