private static void processFocusEvent(AWTEvent e) {
    if (!(e.getSource() instanceof Component src)) {
      return;
    }

    // NOTE: WindowEvent.WINDOW_GAINED_FOCUS can be fired when frame focused
    if (e.getID() == FocusEvent.FOCUS_GAINED) {
      // find current (showing) component/touchbar corresponding to event window
      final Window windowOfEvent = getWindow(src);
      final @Nullable ComponentActions shownActions = getShownActions(windowOfEvent);
      final boolean isShownPersistent = shownActions != null && shownActions.isPersistent();

      for (Component p = src; p != null; p = p.getParent()) {
        final @Nullable ComponentActions candidateActions = ourComp2Actions.get(p);
        if (candidateActions == null) {
          continue;
        }

        if (shownActions == candidateActions) {
          // actions of component p are already shown, nothing to do
          return;
        }

        if (!p.isVisible()) {
          if (LOG_FOCUS_PROCESSING) {
            LOG.debug("FOCUS GAINED: skip actions of invisible component: %s, child (source): %s", p, src);
          }
        }

        if (isShownPersistent && !candidateActions.isPersistent()) {
          // FIXME: except when focused subcomponent of current component (with persistent-touchbar)
          if (LOG_FOCUS_PROCESSING) {
            LOG.debug("FOCUS GAINED: skip not-persistent actions of parent: %s, child (source): %s", p, src);
          }
          continue;
        }

        if (LOG_FOCUS_PROCESSING) {
          LOG.debug("FOCUS GAINED: show actions of parent: %s, child (source): %s", p, src);
        }

        final TBPanel toShow = candidateActions.getTouchbar(0/*ourLastModifiersEx*/, true);
        if (toShow instanceof TBPanelActionGroup && ((TBPanelActionGroup)toShow).updateAutoCloseAndCheck()) {
          // touchbar of component p is autoclosed, skip this candidate
          continue;
        }

        showTouchbar(candidateActions);
        return;
      }

      if (LOG_FOCUS_PROCESSING) {
        LOG.debug("FOCUS GAINED: components chain hasn't any actions, initial child (source): %s", src);
      }
    }
  }
private static void processFocusEvent(AWTEvent e)