зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #10935 - Change OSX 'activiation policy' when running headless mode (from frewsxcv:activation-policy); r=larsbergstrom
...or also when outputting a file. Fixes servo#10836. Source-Repo: https://github.com/servo/servo Source-Revision: f6a5ecb4a992e35f1673673df4f680154f217d2d
This commit is contained in:
Родитель
7e1062d6b5
Коммит
cc70fcb9a3
|
@ -273,7 +273,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.3.0"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -811,7 +811,7 @@ dependencies = [
|
|||
"net_traits 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"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",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
|
@ -1974,12 +1974,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "servo-glutin"
|
||||
version = "0.4.15"
|
||||
version = "0.4.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"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)",
|
||||
"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-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)",
|
||||
|
@ -2015,7 +2015,7 @@ dependencies = [
|
|||
"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-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)",
|
||||
]
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"azure 0.4.3 (git+https://github.com/servo/rust-azure)",
|
||||
"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",
|
||||
"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)",
|
||||
|
@ -258,7 +258,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.3.0"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -731,7 +731,7 @@ dependencies = [
|
|||
"net_traits 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"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",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
|
@ -1868,12 +1868,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "servo-glutin"
|
||||
version = "0.4.15"
|
||||
version = "0.4.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"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)",
|
||||
"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-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)",
|
||||
|
@ -1909,7 +1909,7 @@ dependencies = [
|
|||
"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-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)",
|
||||
]
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ use euclid::size::TypedSize2D;
|
|||
use euclid::{Size2D, Point2D};
|
||||
use gleam::gl;
|
||||
use glutin;
|
||||
#[cfg(target_os = "macos")]
|
||||
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
|
||||
use glutin::{Api, ElementState, Event, GlRequest, MouseButton, VirtualKeyCode, MouseScrollDelta};
|
||||
use glutin::{TouchPhase};
|
||||
use layers::geometry::DevicePixel;
|
||||
|
@ -65,6 +67,22 @@ const LINE_HEIGHT: f32 = 38.0;
|
|||
|
||||
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.
|
||||
pub struct Window {
|
||||
window: glutin::Window,
|
||||
|
@ -113,6 +131,8 @@ impl Window {
|
|||
builder = builder.with_multisampling(MULTISAMPLES)
|
||||
}
|
||||
|
||||
builder = builder_with_platform_options(builder);
|
||||
|
||||
let mut glutin_window = builder.build().unwrap();
|
||||
|
||||
unsafe { glutin_window.make_current().expect("Failed to make context current!") }
|
||||
|
|
|
@ -251,7 +251,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.3.0"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1849,12 +1849,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "servo-glutin"
|
||||
version = "0.4.15"
|
||||
version = "0.4.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"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)",
|
||||
"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-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)",
|
||||
|
@ -1890,7 +1890,7 @@ dependencies = [
|
|||
"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-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)",
|
||||
]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче