private void RasterizeAcceleratorOverlay(ref UIOperationContext context, ref ImperativeRenderer renderer) { var activeModal = ActiveModal; Control shiftTab = ResolveProxies(PickRotateFocusTarget(false, -1)), tab = ResolveProxies(PickRotateFocusTarget(false, 1)), ctrlShiftTab = (activeModal?.RetainFocus == true) ? null : ResolveProxies(PickRotateFocusTarget(true, -1)), ctrlTab = (activeModal?.RetainFocus == true) ? null : ResolveProxies(PickRotateFocusTarget(true, 1)); var targetGroup = renderer.MakeSubgroup(); var labelGroup = renderer.MakeSubgroup(); RasterizedOverlayBoxes.Clear(); if (Focused != null) { RasterizedOverlayBoxes.Add(new RasterizedOverlayBox { Control = Focused, ControlBox = Focused.GetRect(contentRect: true) }); } // FIXME: This looks confusing // RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, Focused, null); var topLevelSource = TopLevelFocused as IAcceleratorSource; if (topLevelSource != null) { labelGroup = renderer.MakeSubgroup(); foreach (var accel in topLevelSource.Accelerators) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, accel, true); } } RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, tab, FocusForward); if (shiftTab != tab) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, shiftTab, FocusBackward); } if ((ctrlTab != TopLevelFocused) || (ctrlShiftTab != TopLevelFocused)) { if (ctrlTab != tab) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, ctrlTab, WindowFocusForward); } if (ctrlTab != ctrlShiftTab) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, ctrlShiftTab, WindowFocusBackward); } } var focusedSource = Focused as IAcceleratorSource; if ((focusedSource != null) && (focusedSource != topLevelSource)) { labelGroup = renderer.MakeSubgroup(); foreach (var accel in focusedSource.Accelerators) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, accel, true); } } }