Not 100% positive if this is a MacOS issue with the designer, or happens on windows too.
However in my project scan module, I have found that when the dialog box gets opened, it will open on whatever desktop/monitor your mouse is currently focused on in that moment. Not necessarily on the same desktop/monitor as the designer itself.
What this means if if I trigger it via a rest endpoint from Desktop A, and the Designer is on Desktop B. Because my focus was on A, the dialog ends up showing up behind the thing I was interacting with, on Desktop A. Instead of in front of the Designer on Desktop B.
This is fairly annoying, as ideally I just want that popup to always show up straight in front of the designer.
Is there something I can do here to try to identify the dialog gets opened on the specific desktop as the designer?
In the repository, see ignition-project-scan-endpoint/designer/src/main/java/com/bwdesigngroup/ignition/project_scan/designer/dialog/ConfirmationDialog.java at 324d8252cf3aafe69abe1993b0abe0778d55183c · design-group/ignition-project-scan-endpoint · GitHub for the specific class being triggered. This is from a push notification being sent from the gateway to the designer.
I have attempted to center the popup on the owner (the designer), but that just ends up centering it on whatever desktop It ends up on.
private void centerOnOwner(Frame owner) {
if (owner != null) {
GraphicsConfiguration gc = owner.getGraphicsConfiguration();
Rectangle screenBounds = gc.getBounds();
Rectangle ownerBounds = owner.getBounds();
Dimension dialogSize = getSize();
int x = ownerBounds.x + (ownerBounds.width - dialogSize.width) / 2;
int y = ownerBounds.y + (ownerBounds.height - dialogSize.height) / 2;
// Ensure dialog stays within screen bounds
x = Math.max(screenBounds.x, Math.min(x, screenBounds.x + screenBounds.width - dialogSize.width));
y = Math.max(screenBounds.y, Math.min(y, screenBounds.y + screenBounds.height - dialogSize.height));
setLocation(x, y);
}
}