File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
src/cascadia/TerminalControl Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -3983,17 +3983,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation
39833983 void TermControl::_contextMenuHandler (IInspectable /* sender*/ ,
39843984 Control::ContextMenuRequestedEventArgs args)
39853985 {
3986- // Position the menu where the pointer is. This was the best way I found how.
3987- const til::point absolutePointerPos{ til::math::rounding, CoreWindow::GetForCurrentThread ().PointerPosition () };
3988- const til::point absoluteWindowOrigin{ til::math::rounding,
3989- CoreWindow::GetForCurrentThread ().Bounds ().X ,
3990- CoreWindow::GetForCurrentThread ().Bounds ().Y };
3991- // Get the offset (margin + tabs, etc..) of the control within the window
3992- const til::point controlOrigin{ til::math::flooring,
3993- this ->TransformToVisual (nullptr ).TransformPoint (Windows::Foundation::Point (0 , 0 )) };
3994-
3995- const auto pos = (absolutePointerPos - absoluteWindowOrigin - controlOrigin);
3996- _showContextMenuAt (pos);
3986+ const auto inverseScale = 1 .0f / static_cast <float >(XamlRoot ().RasterizationScale ());
3987+ const auto padding = GetPadding ();
3988+ const auto pos = args.Position ();
3989+ _showContextMenuAt ({
3990+ til::math::rounding,
3991+ pos.X * inverseScale + static_cast <float >(padding.Left ),
3992+ pos.Y * inverseScale + static_cast <float >(padding.Top ),
3993+ });
39973994 }
39983995
39993996 void TermControl::_showContextMenuAt (const til::point& controlRelativePos)
You can’t perform that action at this time.
0 commit comments