mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Change OSX 'activation policy' when running headless mode.
...or also when outputting a file. Fixes https://github.com/servo/servo/issues/10836.
This commit is contained in:
parent
a7a8eba13e
commit
71af66a349
4 changed files with 35 additions and 15 deletions
10
components/servo/Cargo.lock
generated
10
components/servo/Cargo.lock
generated
|
@ -273,7 +273,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.3.0"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -811,7 +811,7 @@ dependencies = [
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-glutin 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-glutin 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
|
@ -1974,12 +1974,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-glutin"
|
name = "servo-glutin"
|
||||||
version = "0.4.15"
|
version = "0.4.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cocoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2015,7 +2015,7 @@ dependencies = [
|
||||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-glutin 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-glutin 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
12
ports/cef/Cargo.lock
generated
12
ports/cef/Cargo.lock
generated
|
@ -4,7 +4,7 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"azure 0.4.3 (git+https://github.com/servo/rust-azure)",
|
"azure 0.4.3 (git+https://github.com/servo/rust-azure)",
|
||||||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cocoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"compositing 0.0.1",
|
"compositing 0.0.1",
|
||||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -258,7 +258,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.3.0"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -731,7 +731,7 @@ dependencies = [
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-glutin 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-glutin 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
|
@ -1868,12 +1868,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-glutin"
|
name = "servo-glutin"
|
||||||
version = "0.4.15"
|
version = "0.4.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cocoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1909,7 +1909,7 @@ dependencies = [
|
||||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-glutin 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-glutin 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ use euclid::size::TypedSize2D;
|
||||||
use euclid::{Size2D, Point2D};
|
use euclid::{Size2D, Point2D};
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
use glutin;
|
use glutin;
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
|
||||||
use glutin::{Api, ElementState, Event, GlRequest, MouseButton, VirtualKeyCode, MouseScrollDelta};
|
use glutin::{Api, ElementState, Event, GlRequest, MouseButton, VirtualKeyCode, MouseScrollDelta};
|
||||||
use glutin::{TouchPhase};
|
use glutin::{TouchPhase};
|
||||||
use layers::geometry::DevicePixel;
|
use layers::geometry::DevicePixel;
|
||||||
|
@ -65,6 +67,22 @@ const LINE_HEIGHT: f32 = 38.0;
|
||||||
|
|
||||||
const MULTISAMPLES: u16 = 16;
|
const MULTISAMPLES: u16 = 16;
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
fn builder_with_platform_options(mut builder: glutin::WindowBuilder) -> glutin::WindowBuilder {
|
||||||
|
if opts::get().headless || opts::get().output_file.is_some() {
|
||||||
|
// Prevent the window from showing in Dock.app, stealing focus,
|
||||||
|
// or appearing at all when running in headless mode or generating an
|
||||||
|
// output file.
|
||||||
|
builder = builder.with_activation_policy(ActivationPolicy::Prohibited)
|
||||||
|
}
|
||||||
|
builder
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
fn builder_with_platform_options(builder: glutin::WindowBuilder) -> glutin::WindowBuilder {
|
||||||
|
builder
|
||||||
|
}
|
||||||
|
|
||||||
/// The type of a window.
|
/// The type of a window.
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
window: glutin::Window,
|
window: glutin::Window,
|
||||||
|
@ -113,6 +131,8 @@ impl Window {
|
||||||
builder = builder.with_multisampling(MULTISAMPLES)
|
builder = builder.with_multisampling(MULTISAMPLES)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder = builder_with_platform_options(builder);
|
||||||
|
|
||||||
let mut glutin_window = builder.build().unwrap();
|
let mut glutin_window = builder.build().unwrap();
|
||||||
|
|
||||||
unsafe { glutin_window.make_current().expect("Failed to make context current!") }
|
unsafe { glutin_window.make_current().expect("Failed to make context current!") }
|
||||||
|
|
8
ports/gonk/Cargo.lock
generated
8
ports/gonk/Cargo.lock
generated
|
@ -251,7 +251,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.3.0"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1849,12 +1849,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-glutin"
|
name = "servo-glutin"
|
||||||
version = "0.4.15"
|
version = "0.4.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cocoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1890,7 +1890,7 @@ dependencies = [
|
||||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo-glutin 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-glutin 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue