Skip to content

fix(macos): focus existing window on dock reopen + skin font NPE#374

Merged
ktgw0316 merged 5 commits into
ktgw0316:masterfrom
chrisbendel:fix/reopen-current-window
May 8, 2026
Merged

fix(macos): focus existing window on dock reopen + skin font NPE#374
ktgw0316 merged 5 commits into
ktgw0316:masterfrom
chrisbendel:fix/reopen-current-window

Conversation

@chrisbendel
Copy link
Copy Markdown
Contributor

@chrisbendel chrisbendel commented May 6, 2026

@ktgw0316 I've just recently started using this software for editing my own scans. I would love to contribute and help improve on the mac OS side of things, here's a few small bugs/improvements

Summary

  • Dock reopen: Application.reOpen(null) now focuses the most-recently-active ComboFrame via getActiveFrame() instead of always calling openEmpty(). Stops macOS dock clicks from spawning duplicate empty windows.
  • Font NPE: LightZoneFontSet hardcodes a SansSerif 11pt font. The previous UIManager.getFont("small.font") returned null with FlatLaf theme variants that don't register typography keys, NPE'ing <clinit> and bricking every subsequent ComboFrame build with NoClassDefFoundError.
  • App name: ./gradlew :macosx:run now shows LightZone in the menubar/dock instead of MacOSXLauncher. Adds -Xdock:name and -Dapple.awt.application.name to the application plugin's JVM args (previously only the beryx jpackage launcher set them).

Test plan

  • App running, click dock repeatedly → same window stays, no duplicates
  • Minimize, click dock → de-iconifies and focuses
  • Two windows, focus window 2, click dock → window 2 forward
  • Two windows, focus window 1, click dock → window 1 forward
  • Image open, click dock → same window stays, no extra empty
  • All windows closed (app alive), click dock → new empty window opens (fallback)
  • Linux/Windows: revert button + revert menu still work (non-null branch untouched)
  • App launches without LightZoneFontSet.<clinit> NPE
  • Menubar + dock show "LightZone", not "MacOSXLauncher"

Application.reOpen(null) always called openEmpty(), so each macOS
dock-icon click spawned a new empty ComboFrame. AppReopenedEvent
semantics is "bring app to foreground", not "create new window".
When called with a null frame, bring the most-recently-active frame
in Current forward (de-iconify, toFront, requestFocus) and only fall
back to openEmpty() when no frames exist.
Current is ordered by creation, not activity. Use getActiveFrame()
which falls through to ComboFrame.LastActiveComboFrame (set on
windowGainedFocus).
@chrisbendel chrisbendel changed the title fix(macos): focus existing window on dock-icon reopen fix(macos): fix macOS launch + dock reopen most recent window May 6, 2026
@chrisbendel chrisbendel changed the title fix(macos): fix macOS launch + dock reopen most recent window fix(macos): focus existing window on dock reopen + skin font NPE May 6, 2026
@ktgw0316 ktgw0316 merged commit 999e9da into ktgw0316:master May 8, 2026
8 checks passed
@ktgw0316
Copy link
Copy Markdown
Owner

ktgw0316 commented May 8, 2026

@chrisbendel Thank you very much for your contribution!

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.

2 participants