chore: remove WindowMethods::rendering_context (#34780)

* Create Servo without initial webview ID

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Add rendering context in App struct

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Make webview manager optional

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Move window creation to init

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Create window from external rendering context

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Resize surface in compositor

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Obey clippy

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Update Android and OHOS

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Add missing arguent on OHOS

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Show webview after focused on Android and OH

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Remove rendering_context in ServoWindowCallbacks

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Create surface before swapchain in headless mode

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

---------

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>
This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2025-01-01 17:26:23 +09:00 committed by GitHub
parent 59c7ac680e
commit d581acab3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 200 additions and 253 deletions

View file

@ -2,18 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::rc::Rc;
use std::{env, panic, process};
use getopts::Options;
use log::{error, warn};
use log::error;
use servo::config::opts::{self, ArgumentParsingResult};
use servo::config::set_pref;
use servo::servo_config::pref;
use crate::desktop::app::App;
use crate::desktop::events_loop::EventsLoop;
use crate::desktop::{headed_window, headless_window};
use crate::panic_hook;
pub fn main() {
@ -106,29 +103,12 @@ pub fn main() {
let event_loop = EventsLoop::new(opts::get().headless, opts::get().output_file.is_some())
.expect("Failed to create events loop");
// Implements window methods, used by compositor.
// FIXME: We keep the window until application exits. Otherwise, it will cause
// simthay-clipboard thread segfault on Wayland.
let window = if opts::get().headless {
if pref!(media.glvideo.enabled) {
warn!("GL video rendering is not supported on headless windows.");
set_pref!(media.glvideo.enabled, false);
}
headless_window::Window::new(opts::get().initial_window_size, device_pixel_ratio_override)
} else {
Rc::new(headed_window::Window::new(
opts::get().initial_window_size,
event_loop.as_winit(),
do_not_use_native_titlebar,
device_pixel_ratio_override,
))
};
let mut app = App::new(
&event_loop,
window.clone(),
user_agent,
url_opt.map(|s| s.to_string()),
do_not_use_native_titlebar,
device_pixel_ratio_override,
);
event_loop.run_app(&mut app);