Skip to content

Commit 1dabec1

Browse files
authored
Merge pull request #1501 from floooh/issue1500/macos_activation_policy
sokol_app.h macos: move activationPolicy before window creation
2 parents c2ccaea + 880c880 commit 1dabec1

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
## Updates
22

3+
### 01-May-2026
4+
5+
- sokol_app.h macos: Move `activationPolicy` in front of window
6+
creation. This fixes the edge case that when the app is built as 'bare'
7+
cmdline executable (e.g. not as a macOS app bundle with Info.plist file),
8+
and the exe is started from a fullscreen terminal, the application window
9+
would be opened on the same screen as the fullscreen app before visibility
10+
and control switches to the desktop screen (but leaving the app window
11+
on the now hidden terminal screen). Moving activationPolicy before
12+
window creation fixes the behaviour and makes it identical with app bundles
13+
(visibility and focus switch to the desktop screen first, then the window
14+
is opened on the desktop screen).
15+
16+
Many thanks to @johannesmono for reporting the issue and suggesting the
17+
correct solution!
18+
19+
Issue: https://github.com/floooh/sokol/issues/1500
20+
PR: https://github.com/floooh/sokol/pull/1501
21+
322
### 26-Apr-2026
423

524
A new code-generation script has been added which compiles and injects the embedded

sokol_app.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5842,6 +5842,8 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
58425842
@implementation _sapp_macos_app_delegate
58435843
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
58445844
_SOKOL_UNUSED(aNotification);
5845+
// NOTE: keep activationPolicy in front of window creation (see https://github.com/floooh/sokol/issues/1500)
5846+
NSApp.activationPolicy = NSApplicationActivationPolicyRegular;
58455847
_sapp_macos_init_cursors();
58465848
if ((_sapp.window_width == 0) || (_sapp.window_height == 0)) {
58475849
_sapp_macos_init_default_dimensions();
@@ -5875,7 +5877,6 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
58755877
[_sapp.macos.window makeFirstResponder:_sapp.macos.view];
58765878
[_sapp.macos.window center];
58775879
_sapp.valid = true;
5878-
NSApp.activationPolicy = NSApplicationActivationPolicyRegular;
58795880
if (_sapp.fullscreen) {
58805881
/* ^^^ on GL, this already toggles a rendered frame, so set the valid flag before */
58815882
[_sapp.macos.window toggleFullScreen:self];

0 commit comments

Comments
 (0)