Skip to content

Fix modal dialogs freezing all IDE windows (#1375)#1437

Open
deekshithaby wants to merge 1 commit intoprocessing:mainfrom
deekshithaby:fix/modal-dialog-1375
Open

Fix modal dialogs freezing all IDE windows (#1375)#1437
deekshithaby wants to merge 1 commit intoprocessing:mainfrom
deekshithaby:fix/modal-dialog-1375

Conversation

@deekshithaby
Copy link

Problem
When a modal message appears (error, warning, "Save first", etc.), it freezes ALL Processing IDE windows. Users can't interact with any other window, and the modal can get lost behind other windows with no way to recover.

Root Cause

  • Messages.kt: All popup dialogs used Frame() as their parent (an orphan frame with no connection to any editor window), causing APPLICATION_MODALbehaviour that blocks every window.
  • Base.java, Sketch.java, ShimAWT.java: FileDialog instances did not set modality type, defaulting to APPLICATION_MODAL.

Fix
-Messages.kt: Created a showModalDialog() helper that finds the currently active window via KeyboardFocusManager and creates DOCUMENT_MODAL dialogs. Replaced all 5 JOptionPane.showMessageDialog(Frame(), ...) calls with this helper.

  • FileDialogs: Set DOCUMENT_MODAL on all FileDialog instances in Base.java, Sketch.java, and ShimAWT.java.

Result

  • Modal messages (errors, warnings, confirmations) now only block their parent window — other IDE windows remain fully interactive.
  • File dialogs respect DOCUMENT_MODAL on Linux/Windows. Native macOS file dialogs ignore Java modality settings (Apple limitation), but all JOptionPane-based messages are fixed across all platforms.

Testing

  • Opened 3+ editor windows
  • Triggered error messages in each window
  • Confirmed other windows remained responsive while popups were showing

Fixes #1375

- Change FileDialog modality from APPLICATION_MODAL to DOCUMENT_MODAL
  in Base.java, Sketch.java, and ShimAWT.java so file dialogs only
  block their parent window on Linux/Windows.

- Replace orphan Frame() parents in Messages.kt with a helper that
  uses KeyboardFocusManager to find the active window and creates
  DOCUMENT_MODAL dialogs, preventing message popups from freezing
  all IDE windows.

Note: Native macOS file dialogs ignore Java modality settings (Apple
limitation), but all JOptionPane-based messages are now fixed across
all platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop modal message from freezing all windows

1 participant