Skip to content

Commit

Permalink
Merge branch 'dev/migrie/b/2988-focus-foreground' into dev/migrie/b/2…
Browse files Browse the repository at this point in the history
…988-focus-fg-with-owner
  • Loading branch information
zadjii-msft committed Apr 13, 2022
2 parents f12b8c1 + ac53c8a commit 9688573
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
28 changes: 14 additions & 14 deletions src/host/outputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,20 +893,6 @@ void ConhostInternalGetSet::UpdateSoftFont(const gsl::span<const uint16_t> bitPa
}
}

void ConhostInternalGetSet::ReparentWindow(const uint64_t handle)
{
// This will initialize s_interactivityFactory for us. It will also
// conveniently return 0 when we're on OneCore.
//
// 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)) })
{
LOG_LAST_ERROR_IF_NULL(::SetParent(psuedoHwnd, reinterpret_cast<HWND>(handle)));
}
}

// Method Description:
// - Inform the console that the window is focused. This is used by ConPTY.
// Terminals can send ConPTY a FocusIn/FocusOut sequence on the input pipe,
Expand Down Expand Up @@ -975,3 +961,17 @@ void ConhostInternalGetSet::FocusChanged(const bool focused)
// Theoretically, this could be propagated as a focus event as well, to the
// input buffer. That should be considered when implementing GH#11682.
}

void ConhostInternalGetSet::ReparentWindow(const uint64_t handle)
{
// This will initialize s_interactivityFactory for us. It will also
// conveniently return 0 when we're on OneCore.
//
// 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)) })
{
LOG_LAST_ERROR_IF_NULL(::SetParent(psuedoHwnd, reinterpret_cast<HWND>(handle)));
}
}
4 changes: 2 additions & 2 deletions src/host/outputStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ class ConhostInternalGetSet final : public Microsoft::Console::VirtualTerminal::
const SIZE cellSize,
const size_t centeringHint) override;

void ReparentWindow(const uint64_t handle);

void FocusChanged(const bool focused) override;

void ReparentWindow(const uint64_t handle);

private:
void _modifyLines(const size_t count, const bool insert);

Expand Down
4 changes: 2 additions & 2 deletions src/terminal/adapter/conGetSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ namespace Microsoft::Console::VirtualTerminal
const SIZE cellSize,
const size_t centeringHint) = 0;

virtual void ReparentWindow(const uint64_t handle) = 0;

virtual void FocusChanged(const bool focused) = 0;

virtual void ReparentWindow(const uint64_t handle) = 0;
};
}

1 comment on commit 9688573

@github-actions

This comment was marked as outdated.

Please sign in to comment.