fix(macos): raise Preferences after Browse so it stays in front - #283
Merged
got3nks merged 1 commit intoJul 3, 2026
Merged
Conversation
Clicking any Browse button inside Preferences on macOS (video player picker on IDC_BROWSEV, browser picker on IDC_SELBROWSER, and — once amule-project#280 lands — the ffprobe path picker on IDC_MEDIAMETA_FFPROBEBROWSE) visually closes the whole Preferences dialog on both Open and Cancel. Debug-tracing the dialog state showed it was still logically alive after wxFileSelector returned (IsShown() == true, IsBeingDeleted() == false, no wxEVT_CLOSE_WINDOW fired), so the disappearance wasn't a close event we were mishandling. The modal NSOpenPanel that wxCocoa opens steals key-window status while shown; when it dismisses, Cocoa returns focus + Z-order to whichever aMule window was active before Preferences opened, not to Preferences itself. The dialog sits alive but ordered behind the main aMule window — Cmd+Tab back to aMule brings it right up. Fix: call Raise() on Preferences after wxFileSelector returns on macOS. Wrapped in #ifdef __WXMAC__ so wxGTK / wxMSW pay nothing (they don't reproduce the bug — the Windows CommonDialog is a real top-level and wxGTK's file dialog doesn't reshuffle Z-order the same way).
Cflsft
pushed a commit
to Cflsft/amule
that referenced
this pull request
Jul 6, 2026
…e-org#283) Clicking any Browse button inside Preferences on macOS (video player picker on IDC_BROWSEV, browser picker on IDC_SELBROWSER, and — once amule-org#280 lands — the ffprobe path picker on IDC_MEDIAMETA_FFPROBEBROWSE) visually closes the whole Preferences dialog on both Open and Cancel. Debug-tracing the dialog state showed it was still logically alive after wxFileSelector returned (IsShown() == true, IsBeingDeleted() == false, no wxEVT_CLOSE_WINDOW fired), so the disappearance wasn't a close event we were mishandling. The modal NSOpenPanel that wxCocoa opens steals key-window status while shown; when it dismisses, Cocoa returns focus + Z-order to whichever aMule window was active before Preferences opened, not to Preferences itself. The dialog sits alive but ordered behind the main aMule window — Cmd+Tab back to aMule brings it right up. Fix: call Raise() on Preferences after wxFileSelector returns on macOS. Wrapped in #ifdef __WXMAC__ so wxGTK / wxMSW pay nothing (they don't reproduce the bug — the Windows CommonDialog is a real top-level and wxGTK's file dialog doesn't reshuffle Z-order the same way).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Clicking any Browse button inside Preferences on macOS visually closes the whole Preferences dialog, on both file-picked and Cancel. Reproduces on the pre-existing video-player picker (
IDC_BROWSEV), the browser picker (IDC_SELBROWSER), and — once #280 lands — the ffprobe path picker (IDC_MEDIAMETA_FFPROBEBROWSE). Windows (wxMSW) and Linux (wxGTK 3.2) don't reproduce.Root cause
Not a close event we were mishandling. Debug-tracing showed:
wxFileSelector:IsShown() == true,IsBeingDeleted() == falsewxFileSelector(Cancel):str == "",IsShown() == true,IsBeingDeleted() == falseOnClosenever firesSo the dialog was still logically alive after the file selector returned — it just wasn't visible. Cmd+Tab back to aMule confirmed it: the Preferences window was ordered behind the main aMule window. The modal
NSOpenPanelthat wxCocoa opens steals key-window status while shown; when it dismisses, Cocoa returns focus + Z-order to whichever aMule window was active before Preferences opened, not to Preferences itself.Fix
Raise()on the Preferences dialog afterwxFileSelectorreturns, macOS-only. Restores Z-order so the dialog sits in front of the main window where the user left it.Wrapped in
#ifdef __WXMAC__so wxGTK / wxMSW pay nothing — they don't reproduce the bug (Windows CommonDialog is a real top-level, wxGTK's file dialog doesn't reshuffle Z-order the same way).Verified
Local build + retest on macOS 15 ARM64: Preferences → Files → any Browse button → Cancel now leaves Preferences in front. Same for Open. Windows / Linux behaviour unchanged (Raise() is a no-op there, but the
#ifdefguards against paying the call at all).