macOS: Set activation policy in `gst_macos_main`

Lukas Geiger requested to merge lgeiger/gstreamer:macos-activation-policy into main

This patch sets the macOS activation policy in gst_macos_main to NSApplicationActivationPolicyAccessory.

macOS supports three activation policies:

  • regular: The application is an ordinary app that appears in the Dock and may have a user interface.
  • accessory: The application doesn’t appear in the Dock and doesn’t have a menu bar, but it may be activated programmatically or by clicking on one of its windows.
  • prohibited: The application doesn’t appear in the Dock and may not create windows or be activated.

By default bundled *.app applications will use the regular activation policy which makes them appear in the Dock and work properly with the macOS window manager. However, unbundled apps like ones intended to be launched via the command line by default use activation policy prohibited which aren't expected to create windows or take focus.

This leads to two user facing issues:

  • The GStreamer window doesn't properly work with the macOS window manager. Its application bar stays greyed out and if another application takes focus it is impossible to bring the window back into the foreground:


  • Since macOS doesn't allow the application to take focus navigation events like mouse-over or key-press are not passed to the application so image sinks like osxvideosink won't receive them and forward them to other plugins.

This patch fixes both issues by changing the activation policy to accessory in cases where it is set to prohibited. This doesn't make the application appear in the Dock but allows it to properly take focus and receive navigation events. Bundled apps shouldn't be affected by this change as their activation policy is already set to regular.

Merge request reports