IDEA-349390 Wayland: git push dialog dropdown option misplaced

GitOrigin-RevId: 6154e17269bcc606dae83fa9974ca92e666504cf
This commit is contained in:
Maxim Kartashev
2024-03-26 11:28:07 +00:00
committed by intellij-monorepo-bot
parent cf666d61ff
commit 4fc2b005a0
2 changed files with 11 additions and 1 deletions
@@ -1212,6 +1212,15 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup
popupOwner = root.getRootPane();
LOG.debug("popup owner fixed for JDK cache");
}
if (StartupUiUtil.isWaylandToolkit()) {
// targetBounds are "screen" coordinates, which in Wayland means that they
// are relative to the nearest toplevel (Window).
// But popups in Wayland are expected to be relative to popup's "owner";
// let's re-set the owner to be that window.
popupOwner = popupOwner instanceof Window
? popupOwner
: SwingUtilities.getWindowAncestor(popupOwner);
}
if (LOG.isDebugEnabled()) {
LOG.debug("expected preferred size: " + myContent.getPreferredSize());
}
@@ -5,6 +5,7 @@ import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.SystemInfoRt
import com.intellij.ui.scale.JBUIScale.sysScale
import com.intellij.ui.scale.isHiDPIEnabledAndApplicable
import com.intellij.util.ui.StartupUiUtil
import org.jetbrains.annotations.TestOnly
import java.awt.Graphics2D
import java.awt.GraphicsConfiguration
@@ -37,7 +38,7 @@ object JreHiDpiUtil {
@JvmStatic
fun isJreHiDPIEnabled(): Boolean {
if (SystemInfoRt.isMac) {
if (SystemInfoRt.isMac || StartupUiUtil.isWaylandToolkit()) {
return true
}