mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ExpUI: fix popup actions from invisible toolbar
GitOrigin-RevId: 8acd505c2d42c160c0fdb999e517dfe835b75103
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f1c3734723
commit
67de402617
+14
-19
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.actionSystem.impl;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -157,8 +157,9 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar, QuickAct
|
||||
private boolean myShowSeparatorTitles;
|
||||
private Image myCachedImage;
|
||||
|
||||
private final AlphaAnimationContext myAlphaContext = new AlphaAnimationContext(composite -> {
|
||||
super.setVisible(composite != null);
|
||||
@ApiStatus.Internal
|
||||
@ApiStatus.Experimental
|
||||
public final AlphaAnimationContext myAlphaContext = new AlphaAnimationContext(composite -> {
|
||||
if (isShowing()) repaint();
|
||||
});
|
||||
|
||||
@@ -296,13 +297,17 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar, QuickAct
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(final Graphics g) {
|
||||
if (g instanceof Graphics2D) {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
AlphaComposite composite = myAlphaContext.getComposite();
|
||||
if (composite == null) return; // do not paint a completely transparent component
|
||||
g2d.setComposite(composite);
|
||||
public void paint(Graphics g) {
|
||||
if (g instanceof Graphics2D && ExperimentalUI.isNewUI()) {
|
||||
myAlphaContext.paintWithComposite((Graphics2D)g, () -> super.paint(g));
|
||||
}
|
||||
else {
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(final Graphics g) {
|
||||
if (myCachedImage != null) {
|
||||
UIUtil.drawImage(g, myCachedImage, 0, 0, null);
|
||||
return;
|
||||
@@ -1112,16 +1117,6 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar, QuickAct
|
||||
revalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
if (ExperimentalUI.isNewUI()) {
|
||||
myAlphaContext.setVisible(visible);
|
||||
}
|
||||
else {
|
||||
super.setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(@MagicConstant(intValues = {SwingConstants.HORIZONTAL, SwingConstants.VERTICAL}) int orientation) {
|
||||
if (SwingConstants.HORIZONTAL != orientation && SwingConstants.VERTICAL != orientation) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.wm.impl;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.ui.Queryable;
|
||||
@@ -546,8 +547,9 @@ public final class InternalDecoratorImpl extends InternalDecorator implements Qu
|
||||
|
||||
void updateActiveAndHoverState() {
|
||||
ActionToolbar toolbar = getHeaderToolbar();
|
||||
if (toolbar != null) {
|
||||
toolbar.getComponent().setVisible(!isNewUI() || isWindowHovered || toolWindow.isActive());
|
||||
if (toolbar instanceof ActionToolbarImpl) {
|
||||
ActionToolbarImpl impl = (ActionToolbarImpl)toolbar;
|
||||
impl.myAlphaContext.setVisible(!isNewUI() || isWindowHovered || toolWindow.isActive());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user