Auto merge of #29382 - atomgardner:update-winit, r=jdm

Bump winit to 0.28.1

This fixes the following wayland-client error:

	Attempted to dispatch unknown opcode 0 for wl_shm, aborting.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #27740 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [X] These changes do not require tests because only dependencies are updated.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-02-24 14:57:39 +01:00 committed by GitHub
commit e714b95267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 454 additions and 445 deletions

817
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -28,8 +28,6 @@ opt-level = 3
# This is here to dedupe winapi since mio 0.6 is still using winapi 0.2. # This is here to dedupe winapi since mio 0.6 is still using winapi 0.2.
mio = { git = "https://github.com/servo/mio.git", branch = "servo-mio-0.6.22" } mio = { git = "https://github.com/servo/mio.git", branch = "servo-mio-0.6.22" }
# Work around bug in winit 0.24 crashing servo headless in macOS
winit = { git = "https://github.com/rust-windowing/winit.git", rev = "4192d04a53202c199f94d1b7d883a34c9ad09272" }
# surfman-chains has not yet released version 0.7 to crates.io yet. # surfman-chains has not yet released version 0.7 to crates.io yet.
surfman-chains = { git = "https://github.com/servo/surfman-chains.git" } surfman-chains = { git = "https://github.com/servo/surfman-chains.git" }

View file

@ -40,7 +40,7 @@ sparkle = "0.1.25"
style = { path = "../style" } style = { path = "../style" }
style_traits = { path = "../style_traits" } style_traits = { path = "../style_traits" }
# NOTE: the sm-angle feature only enables angle on windows, not other platforms! # NOTE: the sm-angle feature only enables angle on windows, not other platforms!
surfman = { version = "0.5", features = ["sm-angle","sm-angle-default"] } surfman = { version = "0.6", features = ["sm-angle","sm-angle-default"] }
surfman-chains = "0.7" surfman-chains = "0.7"
surfman-chains-api = "0.2" surfman-chains-api = "0.2"
time = { version = "0.1.41", optional = true } time = { version = "0.1.41", optional = true }

View file

@ -78,7 +78,7 @@ servo_url = { path = "../url" }
sparkle = "0.1" sparkle = "0.1"
style = { path = "../style", features = ["servo"] } style = { path = "../style", features = ["servo"] }
style_traits = { path = "../style_traits", features = ["servo"] } style_traits = { path = "../style_traits", features = ["servo"] }
surfman = "0.5" surfman = "0.6"
webdriver_server = { path = "../webdriver_server", optional = true } webdriver_server = { path = "../webdriver_server", optional = true }
webgpu = { path = "../webgpu" } webgpu = { path = "../webgpu" }
webrender = { git = "https://github.com/servo/webrender" } webrender = { git = "https://github.com/servo/webrender" }

View file

@ -12,6 +12,6 @@ path = "lib.rs"
[dependencies] [dependencies]
euclid = "0.22" euclid = "0.22"
surfman = "0.5" surfman = "0.6"
surfman-chains = "0.7" surfman-chains = "0.7"

View file

@ -29,7 +29,7 @@ libservo = { path = "../../components/servo" }
log = "0.4" log = "0.4"
servo-media = { git = "https://github.com/servo/media" } servo-media = { git = "https://github.com/servo/media" }
sparkle = "0.1" sparkle = "0.1"
surfman = "0.5" surfman = "0.6"
surfman-chains = "0.7" surfman-chains = "0.7"
surfman-chains-api = "0.2" surfman-chains-api = "0.2"
webxr = { git = "https://github.com/servo/webxr", features = ["glwindow"] } webxr = { git = "https://github.com/servo/webxr", features = ["glwindow"] }

View file

@ -12,7 +12,7 @@ ipc-channel = "0.14"
libservo = { path = "../../../components/servo" } libservo = { path = "../../../components/servo" }
log = "0.4" log = "0.4"
servo-media = { git = "https://github.com/servo/media" } servo-media = { git = "https://github.com/servo/media" }
surfman = { version = "0.5", features = ["sm-angle-default"] } surfman = { version = "0.6", features = ["sm-angle-default"] }
webxr = { git = "https://github.com/servo/webxr"} webxr = { git = "https://github.com/servo/webxr"}
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] } webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }

View file

@ -18,7 +18,7 @@ env_logger = "0.8"
lazy_static = "1" lazy_static = "1"
log = "0.4" log = "0.4"
simpleservo = { path = "../api" } simpleservo = { path = "../api" }
surfman = "0.5" surfman = "0.6"
keyboard-types = "0.6" keyboard-types = "0.6"
[target.'cfg(target_os = "windows")'.dependencies] [target.'cfg(target_os = "windows")'.dependencies]

View file

@ -57,10 +57,10 @@ libservo = { path = "../../components/servo" }
log = "0.4" log = "0.4"
servo-media = { git = "https://github.com/servo/media" } servo-media = { git = "https://github.com/servo/media" }
shellwords = "1.0.0" shellwords = "1.0.0"
surfman = { version = "0.5", features = ["sm-winit", "sm-x11"] } surfman = { version = "0.6", features = ["sm-winit", "sm-x11"] }
tinyfiledialogs = "3.0" tinyfiledialogs = "3.0"
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "glwindow", "headless"] } webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "glwindow", "headless"] }
winit = "0.24" winit = "0.28.1"
[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies] [target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
image = "0.24" image = "0.24"

View file

@ -40,7 +40,7 @@ impl App {
device_pixels_per_px: Option<f32>, device_pixels_per_px: Option<f32>,
user_agent: Option<String>, user_agent: Option<String>,
) { ) {
let events_loop = EventsLoop::new(opts::get().headless); let events_loop = EventsLoop::new(opts::get().headless, opts::get().output_file.is_some());
// Implements window methods, used by compositor. // Implements window methods, used by compositor.
let window = if opts::get().headless { let window = if opts::get().headless {

View file

@ -8,6 +8,8 @@ use servo::embedder_traits::EventLoopWaker;
use std::sync::{Arc, Condvar, Mutex}; use std::sync::{Arc, Condvar, Mutex};
use std::time; use std::time;
use winit; use winit;
#[cfg(target_os = "macos")]
use winit::platform::macos::{ActivationPolicy, EventLoopBuilderExtMacOS};
#[derive(Debug)] #[derive(Debug)]
pub enum ServoEvent { pub enum ServoEvent {
@ -30,15 +32,29 @@ impl EventsLoop {
// Ideally, we could use the winit event loop in both modes, // Ideally, we could use the winit event loop in both modes,
// but on Linux, the event loop requires a X11 server. // but on Linux, the event loop requires a X11 server.
#[cfg(not(any(target_os = "linux", target_os = "macos")))] #[cfg(not(any(target_os = "linux", target_os = "macos")))]
pub fn new(_headless: bool) -> EventsLoop { pub fn new(_headless: bool, _has_output_file: bool) -> EventsLoop {
EventsLoop(EventLoop::Winit(Some(winit::event_loop::EventLoop::with_user_event()))) EventsLoop(EventLoop::Winit(Some(winit::event_loop::EventLoopBuilder::with_user_event().build())))
} }
#[cfg(any(target_os = "linux", target_os = "macos"))] #[cfg(target_os = "linux")]
pub fn new(headless: bool) -> EventsLoop { pub fn new(headless: bool, _has_output_file: bool) -> EventsLoop {
EventsLoop(if headless { EventsLoop(if headless {
EventLoop::Headless(Arc::new((Mutex::new(false), Condvar::new()))) EventLoop::Headless(Arc::new((Mutex::new(false), Condvar::new())))
} else { } else {
EventLoop::Winit(Some(winit::event_loop::EventLoop::with_user_event())) EventLoop::Winit(Some(winit::event_loop::EventLoopBuilder::with_user_event().build()))
})
}
#[cfg(target_os = "macos")]
pub fn new(headless: bool, _has_output_file: bool) -> EventsLoop {
EventsLoop(if headless {
EventLoop::Headless(Arc::new((Mutex::new(false), Condvar::new())))
} else {
let mut event_loop_builder = winit::event_loop::EventLoopBuilder::with_user_event();
if _has_output_file {
// Prevent the window from showing in Dock.app, stealing focus,
// when generating an output file.
event_loop_builder.with_activation_policy(ActivationPolicy::Prohibited);
}
EventLoop::Winit(Some(event_loop_builder.build()))
}) })
} }
} }

View file

@ -11,8 +11,6 @@ use euclid::{
Angle, Point2D, Rotation3D, Scale, Size2D, UnknownUnit, Angle, Point2D, Rotation3D, Scale, Size2D, UnknownUnit,
Vector2D, Vector3D, Vector2D, Vector3D,
}; };
#[cfg(target_os = "macos")]
use winit::platform::macos::{ActivationPolicy, WindowBuilderExtMacOS};
#[cfg(any(target_os = "linux", target_os = "windows"))] #[cfg(any(target_os = "linux", target_os = "windows"))]
use winit::window::Icon; use winit::window::Icon;
use winit::event::{ElementState, KeyboardInput, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode}; use winit::event::{ElementState, KeyboardInput, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode};
@ -50,21 +48,6 @@ use winapi;
use winit::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize}; use winit::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
use winit::event::ModifiersState; use winit::event::ModifiersState;
#[cfg(target_os = "macos")]
fn builder_with_platform_options(mut builder: winit::window::WindowBuilder) -> winit::window::WindowBuilder {
if opts::get().output_file.is_some() {
// Prevent the window from showing in Dock.app, stealing focus,
// when generating an output file.
builder = builder.with_activation_policy(ActivationPolicy::Prohibited)
}
builder
}
#[cfg(not(target_os = "macos"))]
fn builder_with_platform_options(builder: winit::window::WindowBuilder) -> winit::window::WindowBuilder {
builder
}
pub struct Window { pub struct Window {
winit_window: winit::window::Window, winit_window: winit::window::Window,
webrender_surfman: WebrenderSurfman, webrender_surfman: WebrenderSurfman,
@ -117,15 +100,13 @@ impl Window {
let width = win_size.to_untyped().width; let width = win_size.to_untyped().width;
let height = win_size.to_untyped().height; let height = win_size.to_untyped().height;
let mut window_builder = winit::window::WindowBuilder::new() let window_builder = winit::window::WindowBuilder::new()
.with_title("Servo".to_string()) .with_title("Servo".to_string())
.with_decorations(!no_native_titlebar) .with_decorations(!no_native_titlebar)
.with_transparent(no_native_titlebar) .with_transparent(no_native_titlebar)
.with_inner_size(PhysicalSize::new(width as f64, height as f64)) .with_inner_size(PhysicalSize::new(width as f64, height as f64))
.with_visible(visible); .with_visible(visible);
window_builder = builder_with_platform_options(window_builder);
let winit_window = window_builder.build(events_loop.as_winit()).expect("Failed to create window."); let winit_window = window_builder.build(events_loop.as_winit()).expect("Failed to create window.");
#[cfg(any(target_os = "linux", target_os = "windows"))] #[cfg(any(target_os = "linux", target_os = "windows"))]
@ -508,13 +489,11 @@ impl WindowPortsMethods for Window {
) -> Box<dyn webxr::glwindow::GlWindow> { ) -> Box<dyn webxr::glwindow::GlWindow> {
let size = self.winit_window.outer_size(); let size = self.winit_window.outer_size();
let mut window_builder = winit::window::WindowBuilder::new() let window_builder = winit::window::WindowBuilder::new()
.with_title("Servo XR".to_string()) .with_title("Servo XR".to_string())
.with_inner_size(size) .with_inner_size(size)
.with_visible(true); .with_visible(true);
window_builder = builder_with_platform_options(window_builder);
let winit_window = window_builder.build(event_loop) let winit_window = window_builder.build(event_loop)
.expect("Failed to create window."); .expect("Failed to create window.");

View file

@ -30,18 +30,14 @@ packages = [
"arrayvec", "arrayvec",
"base64", "base64",
"cfg-if", "cfg-if",
"cloudabi",
"cocoa",
"crossbeam-channel", "crossbeam-channel",
"crossbeam-utils", "crossbeam-utils",
"fixedbitset", "fixedbitset",
"getrandom", "getrandom",
"gleam",
"h2", "h2",
"image", "image",
"itoa", "itoa",
"libloading", "libloading",
"lock_api",
"metal", "metal",
"miniz_oxide", "miniz_oxide",
"num-rational", "num-rational",
@ -83,13 +79,10 @@ packages = [
# https://github.com/servo/servo/pull/25518 # https://github.com/servo/servo/pull/25518
"core-foundation", "core-foundation",
"core-foundation-sys", "core-foundation-sys",
"core-graphics",
"lyon_geom", "lyon_geom",
# https://github.com/servo/servo/pull/28236 # https://github.com/servo/servo/pull/28236
"dlib",
"nix", "nix",
"strsim",
# Duplicated by webrender debugger via ws # Duplicated by webrender debugger via ws
"digest", "digest",
@ -97,6 +90,10 @@ packages = [
"opaque-debug", "opaque-debug",
"sha-1", "sha-1",
"block-buffer", "block-buffer",
# Duplicated by winit/surfman update.
"raw-window-handle",
"windows-sys",
] ]
# Files that are ignored for all tidy and lint checks. # Files that are ignored for all tidy and lint checks.
files = [ files = [