mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-05 21:44:31 +00:00
Terminal receives focus on drag n drop (#20003)
### Summary Updates terminal to gain foreground focus when a user drags and drops a file into the terminal. ### Changes Updates the `DragDropHandler` to call `SetForegroundWindow`. ### Validation * Built and deployed locally * Manually verified terminal gains focus when dragging and dropping Closes #19934
This commit is contained in:
@@ -3073,6 +3073,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
co_return;
|
||||
}
|
||||
|
||||
if (const auto hwnd = reinterpret_cast<HWND>(OwningHwnd()))
|
||||
{
|
||||
SetForegroundWindow(hwnd);
|
||||
}
|
||||
|
||||
const auto weak = get_weak();
|
||||
|
||||
if (e.DataView().Contains(StandardDataFormats::ApplicationLink()))
|
||||
|
||||
@@ -951,6 +951,11 @@ LRESULT Window::_HandleGetDpiScaledSize(UINT dpiNew, _Inout_ SIZE* pSizeNew) con
|
||||
// - <none>
|
||||
void Window::_HandleDrop(const WPARAM wParam) const
|
||||
{
|
||||
if (const auto hwnd = GetWindowHandle())
|
||||
{
|
||||
SetForegroundWindow(hwnd);
|
||||
}
|
||||
|
||||
const auto drop = reinterpret_cast<HDROP>(wParam);
|
||||
Clipboard::Instance().PasteDrop(drop);
|
||||
DragFinish(drop);
|
||||
|
||||
Reference in New Issue
Block a user