diff --git a/.changes/gtk018.md b/.changes/gtk018.md new file mode 100644 index 000000000..30642209d --- /dev/null +++ b/.changes/gtk018.md @@ -0,0 +1,7 @@ +--- + +"wry": minor + +--- + +Upgrade gtk to 0.18 and bump MSRV to 1.70.0. \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index dafb3ea3d..17132116f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ default = [ "file-drop", "objc-exception", "protocol", "tao" ] objc-exception = [ "objc/exception" ] file-drop = [ ] protocol = [ ] -dox = [ "tao/dox", "webkit2gtk/dox", "soup3/dox" ] devtools = [ ] transparent = [ ] fullscreen = [ ] @@ -41,7 +40,7 @@ serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" url = "2.4" -tao = { version = "0.22", default-features = false, features = [ "serde" ], optional = true } +tao = { version = "0.23", default-features = false, features = [ "serde" ], optional = true } http = "0.2.9" [dev-dependencies] @@ -49,15 +48,15 @@ http-range = "0.1.5" base64 = "0.21" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -javascriptcore-rs = { version = "1.0", features = [ "v2_28" ] } -webkit2gtk = { version = "1.1", features = [ "v2_38" ] } -webkit2gtk-sys = "1.1" -gio = "0.16" -glib = "0.16" -gtk = "0.16" -gdk = "0.16" -soup3 = "0.3" -winit = { package = "winit-gtk", version = "0.28.1", features = [ "serde" ], optional = true } +javascriptcore-rs = { version = "=1.1", features = [ "v2_28" ] } +webkit2gtk = { version = "=2.0", features = [ "v2_38" ] } +webkit2gtk-sys = "=2.0" +gio = "0.18" +glib = "0.18" +gtk = "0.18" +gdk = "0.18" +soup3 = "0.5" +winit = { version = "0.29", package = "winit-gtk", features = [ "serde" ], optional = true } [target."cfg(target_os = \"windows\")".dependencies] webview2-com = "0.27" diff --git a/src/webview/webkitgtk/file_drop.rs b/src/webview/webkitgtk/file_drop.rs index afa963315..0d7547b70 100644 --- a/src/webview/webkitgtk/file_drop.rs +++ b/src/webview/webkitgtk/file_drop.rs @@ -82,6 +82,11 @@ pub(crate) fn connect_drag_event( // Called when a drag "fails" - we'll just emit a Cancelled event. let listener_ref = listener.clone(); let w = window; - webview - .connect_drag_failed(move |_, _, _| gtk::Inhibit(listener_ref.0(&w, FileDropEvent::Cancelled))); + webview.connect_drag_failed(move |_, _, _| { + if listener_ref.0(&w, FileDropEvent::Cancelled) { + glib::Propagation::Stop + } else { + glib::Propagation::Proceed + } + }); } diff --git a/src/webview/webkitgtk/mod.rs b/src/webview/webkitgtk/mod.rs index 0406f3e93..c4e3d60cf 100644 --- a/src/webview/webkitgtk/mod.rs +++ b/src/webview/webkitgtk/mod.rs @@ -15,9 +15,11 @@ use std::{ }; use url::Url; use webkit2gtk::{ - traits::*, AutoplayPolicy, LoadEvent, NavigationPolicyDecision, NetworkProxyMode, - NetworkProxySettings, PolicyDecisionType, SettingsExt, URIRequest, UserContentInjectedFrames, - UserScript, UserScriptInjectionTime, WebView, WebViewBuilder, WebsitePoliciesBuilder, + AutoplayPolicy, InputMethodContextExt, LoadEvent, NavigationPolicyDecision, + NavigationPolicyDecisionExt, NetworkProxyMode, NetworkProxySettings, PolicyDecisionType, + SettingsExt, URIRequest, URIRequestExt, UserContentInjectedFrames, UserContentManagerExt, + UserScript, UserScriptInjectionTime, WebInspectorExt, WebView, WebViewExt, WebsiteDataManagerExt, + WebsitePolicies, }; use webkit2gtk_sys::{ webkit_get_major_version, webkit_get_micro_version, webkit_get_minor_version, @@ -86,13 +88,13 @@ impl InnerWebView { } } let webview = { - let mut webview = WebViewBuilder::new(); + let mut webview = WebView::builder(); webview = webview.user_content_manager(web_context.manager()); webview = webview.web_context(web_context.context()); webview = webview.is_controlled_by_automation(web_context.allows_automation()); if attributes.autoplay { webview = webview.website_policies( - &WebsitePoliciesBuilder::new() + &WebsitePolicies::builder() .autoplay(AutoplayPolicy::Allow) .build(), ); diff --git a/src/webview/webkitgtk/synthetic_mouse_events.rs b/src/webview/webkitgtk/synthetic_mouse_events.rs index 31c1f59eb..2efe58cb4 100644 --- a/src/webview/webkitgtk/synthetic_mouse_events.rs +++ b/src/webview/webkitgtk/synthetic_mouse_events.rs @@ -34,7 +34,11 @@ pub fn setup(webview: &WebView) { _ => {} } - Inhibit(inhibit) + if inhibit { + glib::Propagation::Stop + } else { + glib::Propagation::Proceed + } }); let bf_state_c = bf_state.clone(); @@ -63,7 +67,11 @@ pub fn setup(webview: &WebView) { } _ => {} } - Inhibit(inhibit) + if inhibit { + glib::Propagation::Stop + } else { + glib::Propagation::Proceed + } }); } diff --git a/src/webview/webkitgtk/undecorated_resizing.rs b/src/webview/webkitgtk/undecorated_resizing.rs index c6fa8601f..8e15a4930 100644 --- a/src/webview/webkitgtk/undecorated_resizing.rs +++ b/src/webview/webkitgtk/undecorated_resizing.rs @@ -37,10 +37,9 @@ pub fn setup(webview: &WebView) { } } } - Inhibit(false) + glib::Propagation::Proceed }); webview.connect_button_press_event(move |webview, event| { - let inhibit = false; if event.button() == 1 { let (cx, cy) = event.root(); // This one should be GtkBox @@ -64,7 +63,7 @@ pub fn setup(webview: &WebView) { } } } - Inhibit(inhibit) + glib::Propagation::Proceed }); webview.connect_touch_event(|webview, event| { // This one should be GtkBox @@ -97,6 +96,6 @@ pub fn setup(webview: &WebView) { } } } - Inhibit(false) + glib::Propagation::Proceed }); } diff --git a/src/webview/webkitgtk/web_context.rs b/src/webview/webkitgtk/web_context.rs index e9f3abaf5..cd0b3c5e0 100644 --- a/src/webview/webkitgtk/web_context.rs +++ b/src/webview/webkitgtk/web_context.rs @@ -24,8 +24,8 @@ use std::{ }; use url::Url; use webkit2gtk::{ - traits::*, ApplicationInfo, CookiePersistentStorage, LoadEvent, URIRequest, UserContentManager, - WebContext, WebContextBuilder, WebView, WebsiteDataManagerBuilder, + ApplicationInfo, CookiePersistentStorage, LoadEvent, URIRequest, URIRequestExt, + URISchemeResponseExt, UserContentManager, WebContext, WebView, WebViewExt, }; #[derive(Debug)] @@ -40,12 +40,13 @@ pub struct WebContextImpl { impl WebContextImpl { pub fn new(data: &WebContextData) -> Self { - let mut context_builder = WebContextBuilder::new(); + use webkit2gtk::{CookieManagerExt, WebsiteDataManager, WebsiteDataManagerExt}; + let mut context_builder = WebContext::builder(); if let Some(data_directory) = data.data_directory() { - let data_manager = WebsiteDataManagerBuilder::new() - .local_storage_directory(&data_directory.join("localstorage").to_string_lossy()) + let data_manager = WebsiteDataManager::builder() + .local_storage_directory(data_directory.join("localstorage").to_string_lossy()) .indexeddb_directory( - &data_directory + data_directory .join("databases") .join("indexeddb") .to_string_lossy(), @@ -71,7 +72,7 @@ impl WebContextImpl { } pub fn create_context(context: WebContext) -> Self { - use webkit2gtk::traits::*; + use webkit2gtk::WebContextExt; let automation = false; context.set_automation_allowed(automation); @@ -101,7 +102,7 @@ impl WebContextImpl { } pub fn set_allows_automation(&mut self, flag: bool) { - use webkit2gtk::traits::*; + use webkit2gtk::WebContextExt; self.automation = flag; self.context.set_automation_allowed(flag); } @@ -201,7 +202,7 @@ impl WebContextExt for super::WebContext { } fn register_automation(&mut self, webview: WebView) { - use webkit2gtk::traits::*; + use webkit2gtk::{AutomationSessionExt, WebContextExt}; if let (true, Some(app_info)) = (self.os.automation, self.os.app_info.take()) { self.os.context.connect_automation_started(move |_, auto| { @@ -225,7 +226,7 @@ impl WebContextExt for super::WebContext { download_started_handler: Option bool>>, download_completed_handler: Option, bool) + 'static>>, ) { - use webkit2gtk::traits::*; + use webkit2gtk::{DownloadExt, WebContextExt}; let context = &self.os.context; let download_started_handler = RefCell::new(download_started_handler); @@ -289,7 +290,7 @@ fn actually_register_uri_scheme( where F: Fn(Request>, RequestAsyncResponder) + 'static, { - use webkit2gtk::traits::*; + use webkit2gtk::{SecurityManagerExt, URISchemeRequestExt, WebContextExt}; let context = &context.os.context; // Enable secure context context @@ -393,7 +394,7 @@ where for (name, value) in http_response.headers().into_iter() { headers.append(name.as_str(), value.to_str().unwrap_or("")); } - response.set_http_headers(&headers); + response.set_http_headers(headers); request_.finish_with_response(&response); });