IJPL-171475 Fix the fit-to-screen logic in AbstractPopup

The existing logic didn't take coordinates into account.
A popup may be smaller than the screen, but shifted so
that it doesn't fit anyway.


(cherry picked from commit 945d7a60730508eb3d68f257c95d3833d68846d1)

IJ-CR-149457

GitOrigin-RevId: c2874c7d61f524c183d8f1451408d64e0d8db356
This commit is contained in:
Sergei Tachenov
2024-11-14 16:11:12 +02:00
committed by intellij-monorepo-bot
parent 655d3cec0d
commit 2f41585647

View File

@@ -1370,7 +1370,12 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup
PopupLocationTracker.register(this);
if (bounds.width > screen.width || bounds.height > screen.height) {
if (
bounds.x < screen.x ||
bounds.y < screen.y ||
bounds.x + bounds.width > screen.x + screen.width ||
bounds.y + bounds.height > screen.y + screen.height
) {
if (LOG.isDebugEnabled()) {
LOG.debug("Bounds won't fit into the screen, adjusting");
}