@@ -199,7 +199,7 @@ pub struct MessageDialogBuilder<R: Runtime> {
199199 pub ( crate ) ok_button_label : Option < String > ,
200200 pub ( crate ) cancel_button_label : Option < String > ,
201201 #[ cfg( desktop) ]
202- pub ( crate ) parent : Option < raw_window_handle :: RawWindowHandle > ,
202+ pub ( crate ) parent : Option < crate :: desktop :: WindowHandle > ,
203203}
204204
205205/// Payload for the message dialog mobile API.
@@ -250,14 +250,18 @@ impl<R: Runtime> MessageDialogBuilder<R> {
250250 }
251251
252252 /// Set parent windows explicitly (optional)
253- ///
254- /// ## Platform-specific
255- ///
256- /// - **Linux:** Unsupported.
257253 #[ cfg( desktop) ]
258- pub fn parent < W : raw_window_handle:: HasWindowHandle > ( mut self , parent : & W ) -> Self {
259- if let Ok ( h) = parent. window_handle ( ) {
260- self . parent . replace ( h. as_raw ( ) ) ;
254+ pub fn parent < W : raw_window_handle:: HasWindowHandle + raw_window_handle:: HasDisplayHandle > (
255+ mut self ,
256+ parent : & W ,
257+ ) -> Self {
258+ if let ( Ok ( window_handle) , Ok ( display_handle) ) =
259+ ( parent. window_handle ( ) , parent. display_handle ( ) )
260+ {
261+ self . parent . replace ( crate :: desktop:: WindowHandle :: new (
262+ window_handle. as_raw ( ) ,
263+ display_handle. as_raw ( ) ,
264+ ) ) ;
261265 }
262266 self
263267 }
@@ -314,7 +318,7 @@ pub struct FileDialogBuilder<R: Runtime> {
314318 pub ( crate ) title : Option < String > ,
315319 pub ( crate ) can_create_directories : Option < bool > ,
316320 #[ cfg( desktop) ]
317- pub ( crate ) parent : Option < raw_window_handle :: RawWindowHandle > ,
321+ pub ( crate ) parent : Option < crate :: desktop :: WindowHandle > ,
318322}
319323
320324#[ cfg( mobile) ]
@@ -380,9 +384,19 @@ impl<R: Runtime> FileDialogBuilder<R> {
380384 /// Sets the parent window of the dialog.
381385 #[ cfg( desktop) ]
382386 #[ must_use]
383- pub fn set_parent < W : raw_window_handle:: HasWindowHandle > ( mut self , parent : & W ) -> Self {
384- if let Ok ( h) = parent. window_handle ( ) {
385- self . parent . replace ( h. as_raw ( ) ) ;
387+ pub fn set_parent <
388+ W : raw_window_handle:: HasWindowHandle + raw_window_handle:: HasDisplayHandle ,
389+ > (
390+ mut self ,
391+ parent : & W ,
392+ ) -> Self {
393+ if let ( Ok ( window_handle) , Ok ( display_handle) ) =
394+ ( parent. window_handle ( ) , parent. display_handle ( ) )
395+ {
396+ self . parent . replace ( crate :: desktop:: WindowHandle :: new (
397+ window_handle. as_raw ( ) ,
398+ display_handle. as_raw ( ) ,
399+ ) ) ;
386400 }
387401 self
388402 }
0 commit comments