mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-227388 Run Anything: Context popup closes immediately after opening in Remote Development
fix positioning of context popup Merge-request: IJ-MR-190697 Merged-by: Dmitry Batrak <Dmitry.Batrak@jetbrains.com> GitOrigin-RevId: b901b77c50bfacbe2a6beac30f23895107d056a5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7f12ee47ef
commit
cf5509c458
@@ -20,6 +20,7 @@ jvm_library(
|
||||
"//java/java-psi-impl:psi-impl",
|
||||
"//platform/util:util-ui",
|
||||
"//java/java-analysis-impl:analysis-impl",
|
||||
"//platform/platform-api:ide",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build intellij.java.structureView` end
|
||||
@@ -14,5 +14,6 @@
|
||||
<orderEntry type="module" module-name="intellij.java.psi.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
<orderEntry type="module" module-name="intellij.java.analysis.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -224,17 +224,6 @@ a:com.intellij.openapi.application.ReadAction
|
||||
- *s:computeThrowable(com.intellij.openapi.util.ThrowableComputable):java.lang.Object
|
||||
- *s:run(java.lang.Runnable):V
|
||||
- *s:runThrowable(com.intellij.util.ThrowableRunnable):V
|
||||
*f:com.intellij.openapi.client.ClientSystemInfo
|
||||
- *sf:Companion:com.intellij.openapi.client.ClientSystemInfo$Companion
|
||||
- f:getMacClient():java.lang.Boolean
|
||||
- f:getWindowsClient():java.lang.Boolean
|
||||
- sf:isMac():Z
|
||||
- sf:isWindows():Z
|
||||
- f:setMacClient(java.lang.Boolean):V
|
||||
- f:setWindowsClient(java.lang.Boolean):V
|
||||
*f:com.intellij.openapi.client.ClientSystemInfo$Companion
|
||||
- f:isMac():Z
|
||||
- f:isWindows():Z
|
||||
a:com.intellij.openapi.command.CommandProcessor
|
||||
- *a:allowMergeGlobalCommands(java.lang.Runnable):V
|
||||
- *a:executeCommand(com.intellij.openapi.project.Project,java.lang.Runnable,java.lang.String,java.lang.Object,com.intellij.openapi.command.UndoConfirmationPolicy,Z,com.intellij.openapi.editor.Document):V
|
||||
|
||||
@@ -79,6 +79,15 @@ c:com.intellij.openapi.actionSystem.ex.ComboBoxAction$ComboBoxButton
|
||||
- *p:doShiftClick():V
|
||||
f:com.intellij.openapi.actionSystem.remoting.PermissionsKt
|
||||
- *sf:getOwner():com.intellij.platform.ide.core.permissions.Permission
|
||||
*f:com.intellij.openapi.client.ClientSystemInfo
|
||||
- *sf:Companion:com.intellij.openapi.client.ClientSystemInfo$Companion
|
||||
- sf:isMac():Z
|
||||
- sf:isWaylandToolkit():Z
|
||||
- sf:isWindows():Z
|
||||
*f:com.intellij.openapi.client.ClientSystemInfo$Companion
|
||||
- f:isMac():Z
|
||||
- f:isWaylandToolkit():Z
|
||||
- f:isWindows():Z
|
||||
com.intellij.openapi.fileEditor.AsyncFileEditorProvider
|
||||
- com.intellij.openapi.fileEditor.FileEditorProvider
|
||||
- com.intellij.openapi.project.DumbAware
|
||||
|
||||
+15
-2
@@ -1,13 +1,15 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.client
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.util.KeyWithDefaultValue
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.util.ui.StartupUiUtil
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
/**
|
||||
* Provides information about operating system, just like [SystemInfo], but for the current client (in terms of [ClientId.current])
|
||||
* Provides information about operating system, just like [SystemInfo], but for the current client (in terms of
|
||||
* [com.intellij.codeWithMe.ClientId.current])
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
class ClientSystemInfo private constructor() {
|
||||
@@ -22,6 +24,11 @@ class ClientSystemInfo private constructor() {
|
||||
return getInstance()?.windowsClient ?: SystemInfo.isWindows
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isWaylandToolkit(): Boolean {
|
||||
return getInstance()?.waylandToolkitClient ?: StartupUiUtil.isWaylandToolkit()
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun getInstance(): ClientSystemInfo? {
|
||||
return ApplicationManager.getApplication()?.currentSessionOrNull?.takeIf { it.isRemote }?.getUserData(CLIENT_INFO_KEY)
|
||||
@@ -30,6 +37,12 @@ class ClientSystemInfo private constructor() {
|
||||
private val CLIENT_INFO_KEY = KeyWithDefaultValue.create("ClientSystemInfo") { ClientSystemInfo() }
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
var macClient: Boolean? = null
|
||||
|
||||
@ApiStatus.Internal
|
||||
var windowsClient: Boolean? = null
|
||||
|
||||
@ApiStatus.Internal
|
||||
var waylandToolkitClient: Boolean? = null
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.client.ClientSystemInfo;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
@@ -15,7 +16,6 @@ import com.intellij.ui.ScreenUtil;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.wayland.WaylandUtilKt;
|
||||
import com.intellij.util.ui.GraphicsUtil;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import com.intellij.util.ui.TimerUtil;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -382,7 +382,7 @@ public class JBPopupMenu extends JPopupMenu {
|
||||
}
|
||||
if (configuration == null) return Short.MAX_VALUE;
|
||||
Rectangle screenRectangle = ScreenUtil.getScreenRectangle(configuration);
|
||||
if (StartupUiUtil.isWaylandToolkit()) {
|
||||
if (ClientSystemInfo.isWaylandToolkit()) {
|
||||
var screenHeight = WaylandUtilKt.getFakeScreenHeight(invoker);
|
||||
if (screenHeight != null) {
|
||||
screenRectangle.height = screenHeight;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.ex.MainMenuPresentationAware
|
||||
import com.intellij.openapi.actionSystem.impl.ActionPresentationDecorator.decorateTextIfNeeded
|
||||
import com.intellij.openapi.actionSystem.impl.actionholder.createActionRef
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.client.ClientSystemInfo
|
||||
import com.intellij.openapi.ui.JBPopupMenu
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.IconLoader.getDarkIcon
|
||||
@@ -47,7 +48,6 @@ import com.intellij.util.cancelOnDispose
|
||||
import com.intellij.util.concurrency.EdtScheduler
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.StartupUiUtil
|
||||
import com.intellij.util.ui.launchOnShow
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
@@ -397,7 +397,7 @@ class ActionMenu constructor(
|
||||
|
||||
override fun getPopupMenuOrigin(): Point {
|
||||
val result = super.getPopupMenuOrigin()
|
||||
if (!StartupUiUtil.isWaylandToolkit() || parent !is JPopupMenu) return result
|
||||
if (!ClientSystemInfo.isWaylandToolkit() || parent !is JPopupMenu) return result
|
||||
correctPopupMenuPositionForWayland(result)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.WriteIntentReadAction;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.client.ClientSystemInfo;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
@@ -470,7 +471,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
|
||||
myCancelKeyEnabled = cancelKeyEnabled;
|
||||
myLocateByContent = locateByContent;
|
||||
myLocateWithinScreen = placeWithinScreenBounds && !StartupUiUtil.isWaylandToolkit();
|
||||
myLocateWithinScreen = placeWithinScreenBounds && !ClientSystemInfo.isWaylandToolkit();
|
||||
myAlpha = alpha;
|
||||
myMaskProvider = maskProvider;
|
||||
myInStack = inStack;
|
||||
@@ -1377,7 +1378,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
LOG.warn(sb.toString());
|
||||
}
|
||||
Rectangle original = new Rectangle(targetBounds);
|
||||
if (StartupUiUtil.isWaylandToolkit()) {
|
||||
if (ClientSystemInfo.isWaylandToolkit()) {
|
||||
var hadToFit = fitSizeToScreen(targetBounds, screen);
|
||||
if (hadToFit && LOG.isDebugEnabled()) {
|
||||
LOG.debug("Target bounds after resizing to fit the screen: " + targetBounds);
|
||||
@@ -1427,7 +1428,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
popupOwner = root.getRootPane();
|
||||
LOG.debug("popup owner fixed for JDK cache");
|
||||
}
|
||||
if (StartupUiUtil.isWaylandToolkit()) {
|
||||
if (ClientSystemInfo.isWaylandToolkit()) {
|
||||
// In Wayland, popup's owner must be a toplevel, i.e., a window or another popup that is also a window:
|
||||
popupOwner = SwingUtilities.getRoot(popupOwner);
|
||||
targetBounds.setLocation(getLocationRelativeToParent(targetBounds, (Window) popupOwner));
|
||||
@@ -1573,7 +1574,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
|
||||
PopupLocationTracker.register(this);
|
||||
|
||||
if (StartupUiUtil.isWaylandToolkit()) {
|
||||
if (ClientSystemInfo.isWaylandToolkit()) {
|
||||
var hadToFit = fitSizeToScreen(bounds, screen);
|
||||
if (hadToFit && LOG.isDebugEnabled()) {
|
||||
LOG.debug("Popup shown larger than the screen, adjusted: " + targetBounds);
|
||||
@@ -1835,7 +1836,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
}
|
||||
|
||||
private static void fitToVisibleArea(Rectangle targetBounds) {
|
||||
if (StartupUiUtil.isWaylandToolkit()) return; // Wrt screen edges, only the Wayland server can reliably position popups
|
||||
if (ClientSystemInfo.isWaylandToolkit()) return; // Wrt screen edges, only the Wayland server can reliably position popups
|
||||
|
||||
Point topLeft = new Point(targetBounds.x, targetBounds.y);
|
||||
Point bottomRight = new Point((int)targetBounds.getMaxX(), (int)targetBounds.getMaxY());
|
||||
@@ -2105,7 +2106,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
final Window wnd = popup.getWindow();
|
||||
assert wnd != null;
|
||||
|
||||
if (StartupUiUtil.isWaylandToolkit() && wnd.getType() == Window.Type.POPUP && myOwner != null) {
|
||||
if (ClientSystemInfo.isWaylandToolkit() && wnd.getType() == Window.Type.POPUP && myOwner != null) {
|
||||
Rectangle newBounds = wnd.getBounds();
|
||||
newBounds.setLocation(p.getScreenPoint());
|
||||
Component parent = SwingUtilities.getRoot(myOwner);
|
||||
@@ -2580,7 +2581,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
size = window.getPreferredSize();
|
||||
}
|
||||
|
||||
if (StartupUiUtil.isWaylandToolkit() && useScreenLocation
|
||||
if (ClientSystemInfo.isWaylandToolkit() && useScreenLocation
|
||||
&& myPopup.getWindow().getType() == Window.Type.POPUP
|
||||
&& myOwner != null) {
|
||||
// The location is in the screen coordinates, but popups need to be positioned relative to their parent
|
||||
@@ -3125,7 +3126,7 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup,
|
||||
}
|
||||
|
||||
private static boolean shouldUseTrueWaylandPopups() {
|
||||
return StartupUiUtil.isWaylandToolkit() && Registry.is("wayland.true.popups", false);
|
||||
return ClientSystemInfo.isWaylandToolkit() && Registry.is("wayland.true.popups", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.ShortcutProvider;
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||
import com.intellij.openapi.application.WriteIntentReadAction;
|
||||
import com.intellij.openapi.client.ClientSystemInfo;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -31,7 +32,6 @@ import com.intellij.ui.speedSearch.ElementFilter;
|
||||
import com.intellij.ui.speedSearch.SpeedSearch;
|
||||
import com.intellij.ui.wayland.WaylandUtilKt;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import com.intellij.util.ui.TimerUtil;
|
||||
import org.intellij.lang.annotations.JdkConstants;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -396,7 +396,7 @@ public abstract class WizardPopup extends AbstractPopup implements ActionListene
|
||||
|
||||
private static @Nullable Integer computeNotBiggerHeight(@NotNull Dimension ofContent, @Nullable Component focusOwner) {
|
||||
@Nullable Integer screenHeight = null;
|
||||
if (StartupUiUtil.isWaylandToolkit()) {
|
||||
if (ClientSystemInfo.isWaylandToolkit()) {
|
||||
screenHeight = WaylandUtilKt.getFakeScreenHeight(focusOwner);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -52,7 +52,6 @@ import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SlowOperations;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.accessibility.ScreenReader;
|
||||
import kotlin.Unit;
|
||||
@@ -670,7 +669,7 @@ public class ListPopupImpl extends WizardPopup implements ListPopup, NextStepHan
|
||||
if (!UiInterceptors.tryIntercept(myChild)) {
|
||||
// Intercept child popup in tests because it is impossible to calculate location on screen there
|
||||
var childLocation = new Point(container.getLocationOnScreen().x + container.getWidth() - STEP_X_PADDING, y);
|
||||
if (StartupUiUtil.isWaylandToolkit()) {
|
||||
if (ClientSystemInfo.isWaylandToolkit()) {
|
||||
SwingUtilities.convertPointFromScreen(childLocation, container);
|
||||
var childBounds = new Rectangle(childLocation, myChild.getPreferredContentSize());
|
||||
WaylandUtilKt.moveToFitChildPopupX(childBounds, container);
|
||||
|
||||
Reference in New Issue
Block a user