File tree Expand file tree Collapse file tree 3 files changed +64
-6
lines changed Expand file tree Collapse file tree 3 files changed +64
-6
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,27 @@ fn main() -> wry::Result<()> {
2424 exit ( 0 ) ;
2525 }
2626 } ;
27- let _webview = WebViewBuilder :: new ( & window)
27+ #[ cfg( any(
28+ target_os = "windows" ,
29+ target_os = "macos" ,
30+ target_os = "ios" ,
31+ target_os = "android"
32+ ) ) ]
33+ let builder = WebViewBuilder :: new ( & window) ;
34+
35+ #[ cfg( not( any(
36+ target_os = "windows" ,
37+ target_os = "macos" ,
38+ target_os = "ios" ,
39+ target_os = "android"
40+ ) ) ) ]
41+ let builder = {
42+ use tao:: platform:: unix:: WindowExtUnix ;
43+ use wry:: WebViewBuilderExtUnix ;
44+ let vbox = window. default_vbox ( ) . unwrap ( ) ;
45+ WebViewBuilder :: new_gtk ( vbox)
46+ } ;
47+ let _webview = builder
2848 . with_custom_protocol ( "wrybench" . into ( ) , move |request| {
2949 let path = request. uri ( ) . to_string ( ) ;
3050 let requested_asset_path = path. strip_prefix ( "wrybench://localhost" ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -48,7 +48,27 @@ fn main() -> wry::Result<()> {
4848 exit ( 0 ) ;
4949 }
5050 } ;
51- let _webview = WebViewBuilder :: new ( & window)
51+ #[ cfg( any(
52+ target_os = "windows" ,
53+ target_os = "macos" ,
54+ target_os = "ios" ,
55+ target_os = "android"
56+ ) ) ]
57+ let builder = WebViewBuilder :: new ( & window) ;
58+
59+ #[ cfg( not( any(
60+ target_os = "windows" ,
61+ target_os = "macos" ,
62+ target_os = "ios" ,
63+ target_os = "android"
64+ ) ) ) ]
65+ let builder = {
66+ use tao:: platform:: unix:: WindowExtUnix ;
67+ use wry:: WebViewBuilderExtUnix ;
68+ let vbox = window. default_vbox ( ) . unwrap ( ) ;
69+ WebViewBuilder :: new_gtk ( vbox)
70+ } ;
71+ let _webview = builder
5272 . with_ipc_handler ( handler)
5373 . with_custom_protocol ( "wrybench" . into ( ) , move |_request| {
5474 Response :: builder ( )
Original file line number Diff line number Diff line change @@ -35,10 +35,28 @@ fn main() -> wry::Result<()> {
3535 exit ( 0 ) ;
3636 }
3737 } ;
38- let _webview = WebViewBuilder :: new ( & window)
39- . with_url ( url)
40- . with_ipc_handler ( handler)
41- . build ( ) ?;
38+
39+ #[ cfg( any(
40+ target_os = "windows" ,
41+ target_os = "macos" ,
42+ target_os = "ios" ,
43+ target_os = "android"
44+ ) ) ]
45+ let builder = WebViewBuilder :: new ( & window) ;
46+
47+ #[ cfg( not( any(
48+ target_os = "windows" ,
49+ target_os = "macos" ,
50+ target_os = "ios" ,
51+ target_os = "android"
52+ ) ) ) ]
53+ let builder = {
54+ use tao:: platform:: unix:: WindowExtUnix ;
55+ use wry:: WebViewBuilderExtUnix ;
56+ let vbox = window. default_vbox ( ) . unwrap ( ) ;
57+ WebViewBuilder :: new_gtk ( vbox)
58+ } ;
59+ let _webview = builder. with_url ( url) . with_ipc_handler ( handler) . build ( ) ?;
4260
4361 event_loop. run ( move |event, _, control_flow| {
4462 * control_flow = ControlFlow :: Wait ;
You can’t perform that action at this time.
0 commit comments