Skip to content

Commit

Permalink
Stash HWND things
Browse files Browse the repository at this point in the history
I was starting to port over the focus & show/hide & reparent things from #2988, but this isn't it. I know sufficiently little about how this works, that I won't be able to do this. Additionally, we don't own the actual WPF conpty connection (VS does), so I can't just implement it here.
  • Loading branch information
zadjii-msft committed Apr 28, 2022
1 parent 7acd742 commit d6a02c8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/cascadia/PublicTerminalCore/HwndTerminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,14 @@ void __stdcall TerminalSetFocus(void* terminal)
{
auto publicTerminal = static_cast<HwndTerminal*>(terminal);
publicTerminal->_focused = true;
// TODO!: somehow let the core terminal know about focus events?
}

void __stdcall TerminalKillFocus(void* terminal)
{
auto publicTerminal = static_cast<HwndTerminal*>(terminal);
publicTerminal->_focused = false;
// TODO!: somehow let the core terminal know about focus events?
}

// Routine Description:
Expand Down
7 changes: 2 additions & 5 deletions src/cascadia/TerminalConnection/ConptyConnection.idl
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@ namespace Microsoft.Terminal.TerminalConnection
{
delegate void NewConnectionHandler(ConptyConnection connection);

[default_interface] runtimeclass ConptyConnection : ITerminalConnection
[default_interface] runtimeclass ConptyConnection : ITerminalConnection,
IWindowHostedConnection
{
ConptyConnection();
Guid Guid { get; };
String Commandline { get; };

void ClearBuffer();

void ShowHide(Boolean show);

void ReparentWindow(UInt64 newParent);

static event NewConnectionHandler NewConnection;
static void StartInboundListener();
static void StopInboundListener();
Expand Down
6 changes: 6 additions & 0 deletions src/cascadia/TerminalConnection/ITerminalConnection.idl
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ namespace Microsoft.Terminal.TerminalConnection
event Windows.Foundation.TypedEventHandler<ITerminalConnection, Object> StateChanged;
ConnectionState State { get; };
};

interface IWindowHostedConnection
{
void ShowHide(Boolean show);
void ReparentWindow(UInt64 newParent);
};
}
3 changes: 3 additions & 0 deletions src/cascadia/WpfTerminalControl/IWindowHostedConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ namespace Microsoft.Terminal.Wpf
/// </summary>
public interface IWindowHostedConnection
{

void ShowHide(bool show);

/// <summary>
/// Inform the connection that the HWND we are hosted in has changed.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/WpfTerminalTestNetCore/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace WpfTerminalTestNetCore
{
public class EchoConnection : Microsoft.Terminal.Wpf.ITerminalConnection
public class EchoConnection : Microsoft.Terminal.Wpf.ITerminalConnection, Microsoft.Terminal.Wpf.IWindowHostedConnection
{
public event EventHandler<TerminalOutputEventArgs> TerminalOutput;

Expand Down

0 comments on commit d6a02c8

Please sign in to comment.