mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-05 21:59:47 +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
(cherry picked from commit a1a43a4ff5)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBND8
Service-Version: 1.25
This commit is contained in:
committed by
Dustin L. Howett
parent
82d5e0cad3
commit
0252c78997
@@ -3088,6 +3088,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