Terminal receives focus on drag n drop#20003
Conversation
|
|
||
| if (const auto hwnd = reinterpret_cast<HWND>(OwningHwnd())) | ||
| { | ||
| SetForegroundWindow(hwnd); |
There was a problem hiding this comment.
Do you mind also adding this here?
terminal/src/interactivity/win32/windowproc.cpp
Lines 952 to 957 in 0f5d883
Something like this:
if (const auto hwnd = GetWindowHandle())
{
SetForegroundWindow(hwnd);
}This way, even the old conhost (the classic console window) would get this improvement. You can test conhost by setting Conhost\Host.EXE as your startup project.
...I'm not sure if it'll work though, given that it relies on WM_DROPFILES and not OLE.
Thank you for working on this!
There was a problem hiding this comment.
Added! Looks like it was just as easy as calling SetForegroundWindow again.
|
@microsoft-github-policy-service agree |
carlos-zamora
left a comment
There was a problem hiding this comment.
✅ Tested on Windows Terminal and Conhost
Thank you so much for doing this! 🙏
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
I'm a little hesitant to put TermControl--which is supposed to know only XAML and nothing of the window outside of it--in charge of this... but I'll probably let it slide for now and fix it when I move drag/drop up into TerminalApp. |
|
(thanks for the fix!) |
Summary
Closes #19934
Updates terminal to gain foreground focus when a user drags and drops a file into the terminal.
Changes
Updates the
DragDropHandlerto callSetForegroundWindow.Validation