提交 3537f849 编写于 作者: A Ahmed Ashour 提交者: skylot

fix(gui): detect if a window is opened inside a visible screen (PR #521)

上级 9557f04f
package jadx.gui.settings;
import java.awt.*;
import java.awt.Font;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Window;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
......@@ -142,14 +145,25 @@ public class JadxSettings extends JadxCLIArgs {
public boolean loadWindowPos(Window window) {
WindowLocation pos = windowPos.get(window.getClass().getSimpleName());
if (pos == null) {
if (pos == null || !isContainedInAnyScreen(pos)) {
return false;
}
window.setLocation(pos.getX(), pos.getY());
window.setSize(pos.getWidth(), pos.getHeight());
return true;
}
private static boolean isContainedInAnyScreen(WindowLocation pos) {
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
if (gd.getDefaultConfiguration().getBounds().contains(
pos.getX(), pos.getY(), pos.getWidth(), pos.getHeight())) {
return true;
}
}
return false;
}
public boolean isShowHeapUsageBar() {
return showHeapUsageBar;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册