mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-106544 Visual glitch: Fullscreen and maximized windows on the same screen
This commit is contained in:
@@ -59,6 +59,8 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
@@ -118,6 +120,48 @@ public class IdeFrameImpl extends JFrame implements IdeFrameEx, DataProvider {
|
||||
MouseGestureManager.getInstance().add(this);
|
||||
|
||||
myFrameDecorator = IdeFrameDecorator.decorate(this);
|
||||
addWindowStateListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowStateChanged(WindowEvent e) {
|
||||
updateBorder();
|
||||
}
|
||||
});
|
||||
Toolkit.getDefaultToolkit().addPropertyChangeListener("win.xpstyle.themeActive", new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
updateBorder();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateBorder() {
|
||||
int state = getExtendedState();
|
||||
if (!WindowManager.getInstance().isFullScreenSupportedInCurrentOS() || !SystemInfo.isWindows) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isNotClassic = Boolean.parseBoolean(String.valueOf(Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive")));
|
||||
if (isNotClassic && (state & MAXIMIZED_BOTH) != 0) {
|
||||
IdeFrame[] projectFrames = WindowManager.getInstance().getAllProjectFrames();
|
||||
GraphicsDevice device = ScreenUtil.getScreenDevice(getBounds());
|
||||
|
||||
for (IdeFrame frame : projectFrames) {
|
||||
if (frame == this) continue;
|
||||
if (((IdeFrameImpl)frame).isInFullScreen() && ScreenUtil.getScreenDevice(((IdeFrameImpl)frame).getBounds()) == device) {
|
||||
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(device.getDefaultConfiguration());
|
||||
int mask = SideBorder.NONE;
|
||||
if (insets.top != 0) mask |= SideBorder.TOP;
|
||||
if (insets.left != 0) mask |= SideBorder.LEFT;
|
||||
if (insets.bottom != 0) mask |= SideBorder.BOTTOM;
|
||||
if (insets.right != 0) mask |= SideBorder.RIGHT;
|
||||
myRootPane.setBorder(new SideBorder(JBColor.BLACK, mask, false, 3));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
myRootPane.setBorder(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected IdeRootPane createRootPane(ActionManagerEx actionManager,
|
||||
|
||||
@@ -42,7 +42,11 @@ public class SideBorder extends LineBorder {
|
||||
}
|
||||
|
||||
public SideBorder(Color color, @SideMask int mask, boolean dotted) {
|
||||
super(color, 1);
|
||||
this(color, mask, dotted, 1);
|
||||
}
|
||||
|
||||
public SideBorder(Color color, @SideMask int mask, boolean dotted, int thickness) {
|
||||
super(color, thickness);
|
||||
mySideMask = mask;
|
||||
myDotted = dotted;
|
||||
}
|
||||
@@ -73,16 +77,16 @@ public class SideBorder extends LineBorder {
|
||||
g.setColor(getLineColor());
|
||||
for(int i = 0; i < getThickness(); i++){
|
||||
if ((mySideMask & LEFT) != 0){
|
||||
drawLine(g, x + i, y + i, x + i, y + height - i - i - 1);
|
||||
drawLine(g, x + i, y, x + i, y + height - 1);
|
||||
}
|
||||
if ((mySideMask & TOP) != 0){
|
||||
drawLine(g, x + i, y + i, x + width - i - i - 1, y + i);
|
||||
drawLine(g, x, y + i, x + width - 1, y + i);
|
||||
}
|
||||
if ((mySideMask & RIGHT) != 0){
|
||||
drawLine(g, x + width - i - i - 1, y + i, x + width - i - i - 1, y + height - i - i - 1);
|
||||
drawLine(g, x + width - 1 - i, y, x + width - 1 - i, y + height - 1);
|
||||
}
|
||||
if ((mySideMask & BOTTOM) != 0){
|
||||
drawLine(g, x + i, y + height - i - i - 1, x + width - i - i - 1, y + height - i - i - 1);
|
||||
drawLine(g, x, y + height - 1 - i, x + width - 1, y + height - 1 - i);
|
||||
}
|
||||
}
|
||||
g.setColor(oldColor);
|
||||
|
||||
Reference in New Issue
Block a user