mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
IJPL-171351 Only fit AbstractPopup into the screen if the flag is set
This is a bit complicated and confusing. We have a flag to fit the popup into the screen. However, the existing code ignored that flag and fit it anyway, but only if the popup is too large. If it's small enough, then it was left alone regardless of whether it's actually located fully within the screen. The previous fix ignored that flag as well, but fit the popup into the screen in all cases. Which meant the flag was now useless. So to keep it working for both cases, let's actually check that flag here. If it's set, then use the new logic: fit into the screen no matter what. Otherwise, only fit it into the screen if it's too large, keeping the old logic there. That logic was introduced for Search Everywhere to begin with, and it has the flag set to false. So we're not changing anything there. And at the same time it'll fix issues with popups such as the Commit Options. (cherry picked from commit 92d1f0be81d4860901414d3266ec4de3af2fc952) IJ-CR-149457 GitOrigin-RevId: 4539693a61b8b7b8920795868e0146f53ffdd0ec
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7e7f518331
commit
7e93970597
@@ -1370,17 +1370,28 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup
|
||||
|
||||
PopupLocationTracker.register(this);
|
||||
|
||||
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");
|
||||
if (myLocateWithinScreen) {
|
||||
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");
|
||||
}
|
||||
ScreenUtil.fitToScreen(bounds);
|
||||
window.setBounds(bounds);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (bounds.width > screen.width || bounds.height > screen.height) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Bounds are larger than the screen, adjusting");
|
||||
}
|
||||
ScreenUtil.fitToScreen(bounds);
|
||||
window.setBounds(bounds);
|
||||
}
|
||||
ScreenUtil.fitToScreen(bounds);
|
||||
window.setBounds(bounds);
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
|
||||
Reference in New Issue
Block a user