1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:07:45 +00:00

Ladybird: Prohibit GUI interaction of the WebContent process on macOS

The WebContent process behaves a bit awkwardly on macOS. When we launch
the process, we have to create a QGuiApplication to access system fonts.
But on macOS, doing so creates an entry in the Dock, and also causes the
WebContent to be focused. So if you enter cmd+Q without first focusing
the Ladybird GUI, WebContent is closed, while the Ladybird process keeps
running.
This commit is contained in:
Timothy Flynn 2023-04-26 16:46:55 -04:00 committed by Andreas Kling
parent cc86c07f58
commit 4dcdc3bd25
4 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,15 @@
/*
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "MacOSSetup.h"
#import <AppKit/NSApplication.h>
void prohibit_interaction()
{
// This prevents WebContent from being displayed in the macOS Dock and becoming the focused,
// interactable application upon launch.
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
}