From 67220f7da4f19f620b12be82768197f8adb0ca6b Mon Sep 17 00:00:00 2001 From: Eugene Petrenko Date: Wed, 27 Nov 2019 18:46:13 +0100 Subject: [PATCH] DarculaJBPopupComboPopup - disable macOS touchbar for ComboBox popups and ListPopupImpls with custom renderers Complex items with custom rendering are not the best candidates for macOS touchbar, as the different rendering from the ListPopupStep is used for the touchbar presentation. Thus it's too unexpected to have two unaligned presentations. Better not not. There are error messages list these in the log: 2019-11-27 18:31:00.814 java[44579:4946691] ERROR: scrubber [(null)]: called showScrubberItems 4, but item-data at this index is null GitOrigin-RevId: 54bb22f6fef7ddc3a71416c4c63753731f71d889 --- .../src/com/intellij/ui/mac/touchbar/TouchBarsManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBarsManager.java b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBarsManager.java index d6da2b031a20..ece0df6e19e8 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBarsManager.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBarsManager.java @@ -33,6 +33,7 @@ import com.intellij.openapi.wm.ToolWindowId; import com.intellij.ui.mac.TouchbarDataKeys; import com.intellij.ui.mac.foundation.NSDefaults; import com.intellij.ui.popup.list.ListPopupImpl; +import com.intellij.ui.popup.list.PopupListElementRenderer; import com.intellij.util.containers.JBIterable; import com.intellij.util.containers.Predicate; import com.intellij.util.ui.UIUtil; @@ -397,6 +398,10 @@ public final class TouchBarsManager { return null; @NotNull ListPopupImpl listPopup = (ListPopupImpl)popup; + + //some toolbars, e.g. one from DarculaJBPopupComboPopup are too custom to be supported here + if (!(listPopup.getList().getCellRenderer() instanceof PopupListElementRenderer)) return null; + final TouchBar tb = BuildUtils.createScrubberBarFromPopup(listPopup); BarContainer container = new BarContainer(BarType.POPUP, tb, null, popupComponent); ourTemporaryBars.put(popupComponent, container);