@@ -9,6 +9,11 @@ use napi_derive::*;
99use tao:: dpi:: { LogicalPosition , LogicalSize } ;
1010use wry:: { http:: Request , Rect , WebViewBuilder } ;
1111
12+ #[ cfg( target_os = "linux" ) ]
13+ use tao:: platform:: unix:: WindowExtUnix ;
14+ #[ cfg( target_os = "linux" ) ]
15+ use wry:: WebViewBuilderExtUnix ;
16+
1217use crate :: { HeaderData , IpcMessage } ;
1318
1419/// Represents the theme of the window.
@@ -215,25 +220,20 @@ impl JsWebview {
215220 )
216221 } ;
217222
218- #[ cfg( not( target_os = "linux" ) ) ]
219223 let webview = {
220- if options. child . unwrap_or ( false ) {
221- webview. build_as_child ( & window) . map_err ( handle_build_error)
222- } else {
223- webview. build ( & window) . map_err ( handle_build_error)
224+ #[ cfg( target_os = "linux" ) ]
225+ {
226+ webview. build_gtk ( window. default_vbox ( ) . unwrap ( ) ) . map_err ( handle_build_error)
224227 }
225- } ?;
226-
227- #[ cfg( target_os = "linux" ) ]
228- let webview = {
229- if options. child . unwrap_or ( false ) {
230- webview
231- . build_as_child ( & window)
232- . map_err ( handle_build_error) ?
233- } else {
234- webview. build ( & window) . map_err ( handle_build_error) ?
228+ #[ cfg( not( target_os = "linux" ) ) ]
229+ {
230+ if options. child . unwrap_or ( false ) {
231+ webview. build_as_child ( window) . map_err ( handle_build_error)
232+ } else {
233+ webview. build ( window) . map_err ( handle_build_error)
234+ }
235235 }
236- } ;
236+ } ? ;
237237
238238 Ok ( Self {
239239 webview_inner : webview,
0 commit comments