Auto merge of #28236 - pecastro:winit_0_24_surfman, r=jdm

Winit 0.24.0 and surfman

<!-- Please describe your changes on the following line: -->
I've updated Servo to Winit 0.24.0 based on the previous work in #26394.
I've basically rebased master onto his jdm/winit branch which had the bulk of the work and I brute forced it till it built correcting things here and there as I could.
The build reports a few warnings:

```
00:04:59 Mar 03 10:20:06 warning: use of deprecated field `winit::event::KeyboardInput::modifiers`: Deprecated in favor of WindowEvent::ModifiersChanged
00:04:59 Mar 03 10:20:06    --> ports/winit/headed_window.rs:753:12
00:04:59 Mar 03 10:20:06     |
00:04:59 Mar 03 10:20:06 753 |         if input.modifiers.shift() {
00:04:59 Mar 03 10:20:06     |            ^^^^^^^^^^^^^^^
00:04:59 Mar 03 10:20:06     |
00:04:59 Mar 03 10:20:06     = note: `#[warn(deprecated)]` on by default
00:04:59 Mar 03 10:20:06
00:04:59 Mar 03 10:20:06 warning: use of deprecated field `winit::event::KeyboardInput::modifiers`: Deprecated in favor of WindowEvent::ModifiersChanged
00:04:59 Mar 03 10:20:06    --> ports/winit/keyutils.rs:263:34
00:04:59 Mar 03 10:20:06     |
00:04:59 Mar 03 10:20:06 263 |         modifiers: get_modifiers(input.modifiers),
00:04:59 Mar 03 10:20:06     |                                  ^^^^^^^^^^^^^^^
00:04:59 Mar 03 10:20:06
00:07:06 Mar 03 10:22:13 warning: 2 warnings emitted
00:07:06 Mar 03 10:22:13
00:07:06 Mar 03 10:22:13    Completed servo v0.0.1 bin "servo" in 132.7s
00:07:06 Mar 03 10:22:13     Finished dev [unoptimized + debuginfo] target(s) in 6m 59s
00:07:08 Mar 03 10:22:15 [Warning] Could not generate notification!
00:07:08 Mar 03 10:22:15 Build Completed in 0:07:01
```

And there are a few commits namely b27e09e009 which I'm not entirely sure of.
I've intentionally left the surfman patch in Cargo.toml so someone else can validate this branch.
Unit tests and smoke test run successfully.
Servo runs but I'm not familiar enough with it to validate how well it does. The window opens and content loads though.

My Rust foo is not great and I could use some help fixing those warnings.

Regards,

PECastro

---
<!-- 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
A few warnings ...
- [x ] `./mach test-tidy` does not report any errors
A few duplicate version statements but no errors.
- [x] These changes fix #26394
- [x] There are tests for these changes
-  [ ] These changes do not require tests because

<!-- 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 2021-03-14 19:26:04 -04:00 committed by GitHub
commit 68e200a581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 714 additions and 559 deletions

View file

@ -40,8 +40,8 @@ sparkle = "0.1.25"
style = { path = "../style" }
style_traits = { path = "../style_traits" }
# NOTE: the sm-angle feature only enables angle on windows, not other platforms!
surfman = { version = "0.3", features = ["sm-angle","sm-angle-default"] }
surfman-chains = "0.5"
surfman = { version = "0.4", features = ["sm-angle","sm-angle-default"] }
surfman-chains = "0.6"
surfman-chains-api = "0.2"
time = { version = "0.1.0", optional = true }
webrender = { git = "https://github.com/servo/webrender" }

View file

@ -835,7 +835,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
}
}
pub fn on_resize_window_event(&mut self) {
pub fn on_resize_window_event(&mut self) -> bool {
debug!("compositor resize requested");
let old_coords = self.embedder_coordinates;
@ -847,11 +847,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
}
if self.embedder_coordinates.viewport == old_coords.viewport {
return;
return false;
}
self.send_window_size(WindowSizeType::Resize);
self.composite_if_necessary(CompositingReason::Resize);
return true;
}
pub fn on_mouse_window_event_class(&mut self, mouse_window_event: MouseWindowEvent) {

View file

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

View file

@ -549,7 +549,7 @@ where
}
}
fn handle_window_event(&mut self, event: WindowEvent) {
fn handle_window_event(&mut self, event: WindowEvent) -> bool {
match event {
WindowEvent::Idle => {},
@ -558,7 +558,7 @@ where
},
WindowEvent::Resize => {
self.compositor.on_resize_window_event();
return self.compositor.on_resize_window_event();
},
WindowEvent::AllowNavigationResponse(pipeline_id, allowed) => {
@ -745,6 +745,7 @@ where
}
},
}
return false;
}
fn receive_messages(&mut self) {
@ -776,18 +777,20 @@ where
::std::mem::replace(&mut self.embedder_events, Vec::new())
}
pub fn handle_events(&mut self, events: Vec<WindowEvent>) {
pub fn handle_events(&mut self, events: Vec<WindowEvent>) -> bool {
if self.compositor.receive_messages() {
self.receive_messages();
}
let mut need_resize = false;
for event in events {
self.handle_window_event(event);
need_resize |= self.handle_window_event(event);
}
if self.compositor.shutdown_state != ShutdownState::FinishedShuttingDown {
self.compositor.perform_updates();
} else {
self.embedder_events.push((None, EmbedderMsg::Shutdown));
}
need_resize
}
pub fn repaint_synchronously(&mut self) {

View file

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