mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-227460 Full file path tooltip is shown in the middle of the screen in Remote Development
this also restores the usage of heavyweight popups for 'extension' popups in monolith mode under Wayland Merge-request: IJ-MR-190489 Merged-by: Dmitry Batrak <Dmitry.Batrak@jetbrains.com> GitOrigin-RevId: 3a9a234c5633c3aaf9f6b3a94d1badafb34e8aba
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3da2fb2642
commit
7b8d4b5d4a
@@ -5,6 +5,7 @@ import com.intellij.openapi.diagnostic.debug
|
||||
import com.intellij.openapi.diagnostic.fileLogger
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.wm.IdeFrame
|
||||
import com.intellij.ui.ClientProperty
|
||||
import com.intellij.ui.ComponentUtil
|
||||
import com.intellij.ui.tabs.JBTabsEx
|
||||
import com.intellij.util.ui.JBUI
|
||||
@@ -200,4 +201,14 @@ private fun fitValue(location: Int, width: Int, start1: Int, end1: Int, start2:
|
||||
}
|
||||
}
|
||||
|
||||
private const val POPUP_POSITION_UNCONSTRAINED = "wlawt.popup_position_unconstrained"
|
||||
|
||||
var Window.isUnconstrainedPopupPositioning: Boolean
|
||||
@ApiStatus.Internal
|
||||
get() = ClientProperty.isTrue(this, POPUP_POSITION_UNCONSTRAINED)
|
||||
@ApiStatus.Internal
|
||||
set(value) {
|
||||
ClientProperty.put(this, POPUP_POSITION_UNCONSTRAINED, true.takeIf { value })
|
||||
}
|
||||
|
||||
private val LOG = fileLogger()
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SingleEdtTaskScheduler;
|
||||
import com.intellij.util.ui.MouseEventAdapter;
|
||||
import com.intellij.util.ui.MouseEventHandler;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.accessibility.ScreenReader;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -120,13 +119,7 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
|
||||
myComponent.add(myRendererPane);
|
||||
myComponent.validate();
|
||||
}
|
||||
var popup = new MovablePopup(myComponent, myTipComponent);
|
||||
// On Wayland, heavyweight popup might get automatically displaced
|
||||
// by the server if they appear to cross the screen boundary, which
|
||||
// is not what we want in this case.
|
||||
popup.setHeavyWeight(!StartupUiUtil.isWaylandToolkit());
|
||||
myPopup = popup;
|
||||
|
||||
myPopup = new MovablePopup(myComponent, myTipComponent);
|
||||
|
||||
MouseEventHandler dispatcher = new MouseEventHandler() {
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.diagnostic.debug
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.ui.awt.RelativePoint
|
||||
import com.intellij.ui.wayland.getValidBoundsForPopup
|
||||
import com.intellij.ui.wayland.isUnconstrainedPopupPositioning
|
||||
import com.intellij.util.ui.StartupUiUtil
|
||||
import com.jetbrains.JBR
|
||||
import org.intellij.lang.annotations.JdkConstants
|
||||
@@ -284,7 +285,7 @@ private class WaylandWindowMouseListenerSupport(source: WindowMouseListenerSourc
|
||||
dx = 0
|
||||
dy = 0
|
||||
if (isRelativeMovementMode()) {
|
||||
ClientProperty.put(view as Window, "wlawt.popup_position_unconstrained", true)
|
||||
(view as Window).isUnconstrainedPopupPositioning = true
|
||||
grabPoint = RelativePoint(event).getPoint(view)
|
||||
@Suppress("UsePropertyAccessSyntax")
|
||||
JBR.getRelativePointerMovement().getAccumulatedMouseDeltaAndReset()
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ui.popup;
|
||||
|
||||
import com.intellij.idea.AppMode;
|
||||
import com.intellij.openapi.util.SystemInfoRt;
|
||||
import com.intellij.ui.ComponentUtil;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.wayland.WaylandUtilKt;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -197,7 +199,8 @@ public final class MovablePopup {
|
||||
if (myHeavyWeight) {
|
||||
JWindow view = new JWindow(owner);
|
||||
view.setType(Window.Type.POPUP);
|
||||
if (StartupUiUtil.isWaylandToolkit()) {
|
||||
if (StartupUiUtil.isWaylandToolkit() ||
|
||||
AppMode.isRemoteDevHost() /* Needed only with Wayland toolkit on the client, but won't hurt in other cases */) {
|
||||
// Wayland popups *must* know their parent in order to be
|
||||
// placed on the screen relative to it.
|
||||
try {
|
||||
@@ -207,6 +210,7 @@ public final class MovablePopup {
|
||||
}
|
||||
catch (NoSuchFieldException| IllegalAccessException ignore) {
|
||||
}
|
||||
WaylandUtilKt.setUnconstrainedPopupPositioning(view, true);
|
||||
}
|
||||
setAlwaysOnTop(view, myAlwaysOnTop);
|
||||
setWindowFocusable(view, myWindowFocusable);
|
||||
@@ -214,7 +218,7 @@ public final class MovablePopup {
|
||||
view.setAutoRequestFocus(false);
|
||||
view.setFocusable(false);
|
||||
view.setFocusableWindowState(false);
|
||||
if (myTransparent && SystemInfoRt.isMac) {
|
||||
if (myTransparent && (SystemInfoRt.isMac || StartupUiUtil.isWaylandToolkit())) {
|
||||
try {
|
||||
Field field = JRootPane.class.getDeclaredField("useTrueDoubleBuffering");
|
||||
field.setAccessible(true);
|
||||
|
||||
Reference in New Issue
Block a user