Commit f0b5fd9
committed
ui_cocoa: promote bare binary to foreground on pre-10.6
On 10.5 Leopard, the RetroArch window now responded to mouse input
(after 23a9456) but still ignored keyboard input entirely.
ROOT CAUSE: A bare binary launched from a terminal (no .app bundle
wrapping, no Info.plist) starts as a background-only process. The
WindowServer delivers mouse events to background processes that own
windows, but routes keystrokes only to the frontmost UI app (Finder
or the terminal emulator in this case).
Commit 6c37fb0 guards [NSApp setActivationPolicy:NSApplication-
ActivationPolicyRegular] - the Cocoa API that promotes a background
process to a foreground GUI app - behind MAC_OS_X_VERSION_10_6
because the selector doesn't exist on 10.5. That's correct but
leaves pre-10.6 bare-binary builds with no promotion path at all,
hence no keystrokes.
FIX: fall back to the Carbon Process Manager equivalent on pre-10.6:
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
Available since 10.3 in <ApplicationServices/ApplicationServices.h>.
Per Leopard's HIServices release notes, 10.5 specifically added
support for promoting plain background processes (not just
LSUIElement / LSBackgroundOnly apps) to foreground, which covers
the bare-binary case.
On 10.6+ builds nothing changes - setActivationPolicy: is still
used. On bundled .app builds nothing changes either - bundle
identity sets the process type at launch and the foreground
promotion is a no-op. Bare-binary launches on 10.5 are the
only configuration affected, and they now receive keystrokes.1 parent 23a9456 commit f0b5fd9
1 file changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| |||
1445 | 1452 | | |
1446 | 1453 | | |
1447 | 1454 | | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
1452 | 1458 | | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
1453 | 1475 | | |
1454 | 1476 | | |
1455 | 1477 | | |
| |||
0 commit comments