From 3bf2f2e5257ebbdbb2993135153bbc44851db8c1 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Tue, 2 Oct 2018 19:26:10 +0300 Subject: [PATCH] Misc fixes for Find In Path: increase active area to move the window provide visual border for undecorated dialog tune 'canClose' logic for clicks outside the dialog / outside the application --- .../src/com/intellij/find/impl/FindPopupPanel.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java index 65c51a33cd50..37d09efd5b39 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java @@ -233,6 +233,8 @@ public class FindPopupPanel extends JBPanel implements FindUI { WindowMoveListener windowListener = new WindowMoveListener(this); myTitlePanel.addMouseListener(windowListener); myTitlePanel.addMouseMotionListener(windowListener); + addMouseListener(windowListener); + addMouseMotionListener(windowListener); Dimension panelSize = getPreferredSize(); Dimension prev = DimensionService.getInstance().getSize(SERVICE_KEY); if (!myCbPreserveCase.isVisible()) { @@ -272,6 +274,7 @@ public class FindPopupPanel extends JBPanel implements FindUI { DumbAwareAction.create(e -> closeImmediately()) .registerCustomShortcutSet(escape == null ? CommonShortcuts.ESCAPE : escape.getShortcutSet(), root, myDisposable); root.setWindowDecorationStyle(JRootPane.NONE); + root.setBorder(PopupBorder.Factory.create(true, true)); UIUtil.markAsPossibleOwner((Dialog)w); w.setBackground(UIUtil.getPanelBackground()); w.setMinimumSize(panelSize); @@ -287,7 +290,7 @@ public class FindPopupPanel extends JBPanel implements FindUI { if (oppositeWindow == w || oppositeWindow != null && oppositeWindow.getOwner() == w) { return; } - if (canBeClosed()) { + if (canBeClosed() || (!myIsPinned.get() && oppositeWindow != null)) { //closeImmediately(); myDialog.doCancelAction(); } @@ -312,7 +315,7 @@ public class FindPopupPanel extends JBPanel implements FindUI { if (!myCanClose.get()) return false; if (myIsPinned.get()) return false; if (!ApplicationManager.getApplication().isActive()) return false; - //if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow() == null) return false; + if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow() == null) return false; if (myFileMaskField.isPopupVisible()) { myFileMaskField.setPopupVisible(false); return false;