mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
Use raw handles to create surfman context instead (#29871)
This commit is contained in:
parent
d90e3078a6
commit
3fea90a231
4 changed files with 16 additions and 13 deletions
|
@ -55,9 +55,10 @@ lazy_static = { workspace = true }
|
|||
libc = { workspace = true }
|
||||
libservo = { path = "../../components/servo" }
|
||||
log = { workspace = true }
|
||||
raw-window-handle = "0.5"
|
||||
servo-media = { git = "https://github.com/servo/media" }
|
||||
shellwords = "1.0.0"
|
||||
surfman = { workspace = true, features = ["sm-winit", "sm-x11"] }
|
||||
surfman = { workspace = true, features = ["sm-x11", "sm-raw-window-handle"] }
|
||||
tinyfiledialogs = "3.0"
|
||||
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "glwindow", "headless"] }
|
||||
winit = "0.28.3"
|
||||
|
|
|
@ -14,7 +14,7 @@ use euclid::{
|
|||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||
use winit::window::Icon;
|
||||
use winit::event::{ElementState, KeyboardInput, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode};
|
||||
|
||||
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
||||
use servo::keyboard_types::{Key, KeyState, KeyboardEvent};
|
||||
use servo::compositing::windowing::{AnimationState, MouseWindowEvent, EmbedderEvent};
|
||||
use servo::compositing::windowing::{EmbedderCoordinates, WindowMethods};
|
||||
|
@ -30,7 +30,6 @@ use servo::webrender_surfman::WebrenderSurfman;
|
|||
use servo_media::player::context::{GlApi, GlContext as PlayerGLContext, NativeDisplay};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use std::rc::Rc;
|
||||
#[cfg(target_os = "linux")]
|
||||
use surfman::platform::generic::multi::connection::NativeConnection;
|
||||
|
@ -125,13 +124,15 @@ impl Window {
|
|||
let inner_size = Size2D::new(width, height);
|
||||
|
||||
// Initialize surfman
|
||||
let display_handle = winit_window.raw_display_handle();
|
||||
let connection =
|
||||
Connection::from_winit_window(&winit_window).expect("Failed to create connection");
|
||||
Connection::from_raw_display_handle(display_handle).expect("Failed to create connection");
|
||||
let adapter = connection
|
||||
.create_adapter()
|
||||
.expect("Failed to create adapter");
|
||||
let window_handle = winit_window.raw_window_handle();
|
||||
let native_widget = connection
|
||||
.create_native_widget_from_winit_window(&winit_window)
|
||||
.create_native_widget_from_rwh(window_handle)
|
||||
.expect("Failed to create native widget");
|
||||
let surface_type = SurfaceType::Widget { native_widget };
|
||||
let webrender_surfman = WebrenderSurfman::create(&connection, &adapter, surface_type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue