Skip to content

fix: Unify pollHttp behavior across platforms#172

Merged
treeform merged 5 commits intotreeform:masterfrom
heysokam:heysokam/pollHttp
Apr 6, 2026
Merged

fix: Unify pollHttp behavior across platforms#172
treeform merged 5 commits intotreeform:masterfrom
heysokam:heysokam/pollHttp

Conversation

@heysokam
Copy link
Copy Markdown
Collaborator

@heysokam heysokam commented Apr 3, 2026

Unconditional usage of pollHttp() for mac+emscripten, without protection from -d:windyUseStdHttp, causes unexpected behavior on every other platform for codebases developed primarily on mac.

It causes normally behaving mac apps to not download anything at all on linux.
Windows silently works "as expected" only because the event update function on windy is a no-op anyway.

This PR unifies pollHttp() behavior across platforms by not requiring the user to set a flag that only has significance for Linux systems, and silently does nothing on Windows systems.

heysokam added 3 commits April 3, 2026 16:35
Unconditional usage of the flag for mac causes unexpected behavior on
every other platform for codebases developed primarily on mac.

It causes normally behaving mac apps to not download anything at all on
linux. Windows silently works "as expected" only because the event
update function on windy is a no-op anyway.
@heysokam heysokam changed the title fix: Unify usage of windyUseStdHttp for all platforms fix: Unify pollHttp behavior across platforms Apr 3, 2026
@treeform treeform merged commit d9fc925 into treeform:master Apr 6, 2026
3 checks passed
@heysokam heysokam deleted the heysokam/pollHttp branch April 6, 2026 18:41
nishu-builder pushed a commit to Metta-AI/mettagrid that referenced this pull request Apr 9, 2026
## Summary

- Updates the windy nimby lock hash from `d87b6ad` to `45f58a2` (latest master)

## What changed in windy

The new windy includes [treeform/windy#174](treeform/windy#174) which fixes an intermittent bug where the mettascope window would not come to the front on macOS startup.

**Root cause:** `setActivationPolicy(NSApplicationActivationPolicyRegular)` was called inside the `applicationDidFinishLaunching` callback and then immediately tried to activate the app. This policy change tells the macOS window server (a separate process) to promote the app from a background process to a regular GUI app, but the window server processes this asynchronously via IPC. Sometimes the promotion completed before the activation request arrived (window comes to front), sometimes it didn't (window stays behind other apps).

**Fix:** Moved `setActivationPolicy` to before `finishLaunching()` in `init()`, giving the window server more time to process the policy change before any window is created or activation is attempted. This is the same approach used by GLFW and SDL.

Also includes:

- [treeform/windy#172](treeform/windy#172): Unify `pollHttp` behavior across platforms
- [treeform/windy#173](treeform/windy#173): Fix readme spelling and grammar

## Test plan

- [x] Launch mettascope repeatedly on macOS and verify the window consistently comes to front

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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