@@ -63,11 +63,6 @@ use wry::WebViewBuilderExtWindows;
6363use wry:: { WebViewBuilderExtDarwin , WebViewExtDarwin } ;
6464
6565use tao:: {
66- dpi:: {
67- LogicalPosition as TaoLogicalPosition , LogicalSize as TaoLogicalSize ,
68- PhysicalPosition as TaoPhysicalPosition , PhysicalSize as TaoPhysicalSize ,
69- Position as TaoPosition , Size as TaoSize ,
70- } ,
7166 event:: { Event , StartCause , WindowEvent as TaoWindowEvent } ,
7267 event_loop:: {
7368 ControlFlow , DeviceEventFilter as TaoDeviceEventFilter , EventLoop , EventLoopBuilder ,
@@ -507,17 +502,15 @@ impl WindowEventWrapper {
507502 #[ allow( unused_variables) ] window : & WindowWrapper ,
508503 ) -> Self {
509504 let event = match event {
510- TaoWindowEvent :: Resized ( size) => WindowEvent :: Resized ( PhysicalSizeWrapper ( * size) . into ( ) ) ,
511- TaoWindowEvent :: Moved ( position) => {
512- WindowEvent :: Moved ( PhysicalPositionWrapper ( * position) . into ( ) )
513- }
505+ TaoWindowEvent :: Resized ( size) => WindowEvent :: Resized ( * size) ,
506+ TaoWindowEvent :: Moved ( position) => WindowEvent :: Moved ( * position) ,
514507 TaoWindowEvent :: Destroyed => WindowEvent :: Destroyed ,
515508 TaoWindowEvent :: ScaleFactorChanged {
516509 scale_factor,
517510 new_inner_size,
518511 } => WindowEvent :: ScaleFactorChanged {
519512 scale_factor : * scale_factor,
520- new_inner_size : PhysicalSizeWrapper ( * * new_inner_size) . into ( ) ,
513+ new_inner_size : * * new_inner_size,
521514 } ,
522515 TaoWindowEvent :: Focused ( focused) => {
523516 #[ cfg( not( windows) ) ]
@@ -571,7 +564,7 @@ impl WindowEventWrapper {
571564 & window. webviews ,
572565 window. has_children . load ( Ordering :: Relaxed ) ,
573566 ) ;
574- Self ( Some ( WindowEvent :: Resized ( PhysicalSizeWrapper ( size) . into ( ) ) ) )
567+ Self ( Some ( WindowEvent :: Resized ( size) ) )
575568 } else {
576569 Self ( None )
577570 }
@@ -605,102 +598,18 @@ impl From<MonitorHandleWrapper> for Monitor {
605598 fn from ( monitor : MonitorHandleWrapper ) -> Monitor {
606599 Self {
607600 name : monitor. 0 . name ( ) ,
608- position : PhysicalPositionWrapper ( monitor. 0 . position ( ) ) . into ( ) ,
609- size : PhysicalSizeWrapper ( monitor. 0 . size ( ) ) . into ( ) ,
601+ position : monitor. 0 . position ( ) ,
602+ size : monitor. 0 . size ( ) ,
610603 work_area : monitor. 0 . work_area ( ) ,
611604 scale_factor : monitor. 0 . scale_factor ( ) ,
612605 }
613606 }
614607}
615608
616- pub struct PhysicalPositionWrapper < T > ( pub TaoPhysicalPosition < T > ) ;
617-
618- impl < T > From < PhysicalPositionWrapper < T > > for PhysicalPosition < T > {
619- fn from ( position : PhysicalPositionWrapper < T > ) -> Self {
620- Self {
621- x : position. 0 . x ,
622- y : position. 0 . y ,
623- }
624- }
625- }
626-
627- impl < T > From < PhysicalPosition < T > > for PhysicalPositionWrapper < T > {
628- fn from ( position : PhysicalPosition < T > ) -> Self {
629- Self ( TaoPhysicalPosition {
630- x : position. x ,
631- y : position. y ,
632- } )
633- }
634- }
635-
636- struct LogicalPositionWrapper < T > ( TaoLogicalPosition < T > ) ;
637-
638- impl < T > From < LogicalPosition < T > > for LogicalPositionWrapper < T > {
639- fn from ( position : LogicalPosition < T > ) -> Self {
640- Self ( TaoLogicalPosition {
641- x : position. x ,
642- y : position. y ,
643- } )
644- }
645- }
646-
647- pub struct PhysicalSizeWrapper < T > ( pub TaoPhysicalSize < T > ) ;
648-
649- impl < T > From < PhysicalSizeWrapper < T > > for PhysicalSize < T > {
650- fn from ( size : PhysicalSizeWrapper < T > ) -> Self {
651- Self {
652- width : size. 0 . width ,
653- height : size. 0 . height ,
654- }
655- }
656- }
657-
658- impl < T > From < PhysicalSize < T > > for PhysicalSizeWrapper < T > {
659- fn from ( size : PhysicalSize < T > ) -> Self {
660- Self ( TaoPhysicalSize {
661- width : size. width ,
662- height : size. height ,
663- } )
664- }
665- }
666-
667- struct LogicalSizeWrapper < T > ( TaoLogicalSize < T > ) ;
668-
669- impl < T > From < LogicalSize < T > > for LogicalSizeWrapper < T > {
670- fn from ( size : LogicalSize < T > ) -> Self {
671- Self ( TaoLogicalSize {
672- width : size. width ,
673- height : size. height ,
674- } )
675- }
676- }
677-
678- pub struct SizeWrapper ( pub TaoSize ) ;
679-
680- impl From < Size > for SizeWrapper {
681- fn from ( size : Size ) -> Self {
682- match size {
683- Size :: Logical ( s) => Self ( TaoSize :: Logical ( LogicalSizeWrapper :: from ( s) . 0 ) ) ,
684- Size :: Physical ( s) => Self ( TaoSize :: Physical ( PhysicalSizeWrapper :: from ( s) . 0 ) ) ,
685- }
686- }
687- }
688-
689- pub struct PositionWrapper ( pub TaoPosition ) ;
690-
691- impl From < Position > for PositionWrapper {
692- fn from ( position : Position ) -> Self {
693- match position {
694- Position :: Logical ( s) => Self ( TaoPosition :: Logical ( LogicalPositionWrapper :: from ( s) . 0 ) ) ,
695- Position :: Physical ( s) => Self ( TaoPosition :: Physical ( PhysicalPositionWrapper :: from ( s) . 0 ) ) ,
696- }
697- }
698- }
699-
700609#[ cfg( desktop) ]
701610fn find_monitor_for_position (
702611 monitors : impl Iterator < Item = MonitorHandle > ,
703- window_position : TaoPosition ,
612+ window_position : Position ,
704613) -> Option < MonitorHandle > {
705614 monitors. into_iter ( ) . find ( |m| {
706615 let monitor_pos = m. position ( ) ;
@@ -986,8 +895,9 @@ impl WindowBuilder for WindowBuilderWrapper {
986895 if let Some ( prevent_overflow) = & config. prevent_overflow {
987896 window = match prevent_overflow {
988897 PreventOverflowConfig :: Enable ( true ) => window. prevent_overflow ( ) ,
989- PreventOverflowConfig :: Margin ( margin) => window
990- . prevent_overflow_with_margin ( TaoPhysicalSize :: new ( margin. width , margin. height ) . into ( ) ) ,
898+ PreventOverflowConfig :: Margin ( margin) => {
899+ window. prevent_overflow_with_margin ( PhysicalSize :: new ( margin. width , margin. height ) . into ( ) )
900+ }
991901 _ => window,
992902 } ;
993903 }
@@ -1001,28 +911,26 @@ impl WindowBuilder for WindowBuilderWrapper {
1001911 }
1002912
1003913 fn position ( mut self , x : f64 , y : f64 ) -> Self {
1004- self . inner = self . inner . with_position ( TaoLogicalPosition :: new ( x, y) ) ;
914+ self . inner = self . inner . with_position ( LogicalPosition :: new ( x, y) ) ;
1005915 self
1006916 }
1007917
1008918 fn inner_size ( mut self , width : f64 , height : f64 ) -> Self {
1009- self . inner = self
1010- . inner
1011- . with_inner_size ( TaoLogicalSize :: new ( width, height) ) ;
919+ self . inner = self . inner . with_inner_size ( LogicalSize :: new ( width, height) ) ;
1012920 self
1013921 }
1014922
1015923 fn min_inner_size ( mut self , min_width : f64 , min_height : f64 ) -> Self {
1016924 self . inner = self
1017925 . inner
1018- . with_min_inner_size ( TaoLogicalSize :: new ( min_width, min_height) ) ;
926+ . with_min_inner_size ( LogicalSize :: new ( min_width, min_height) ) ;
1019927 self
1020928 }
1021929
1022930 fn max_inner_size ( mut self , max_width : f64 , max_height : f64 ) -> Self {
1023931 self . inner = self
1024932 . inner
1025- . with_max_inner_size ( TaoLogicalSize :: new ( max_width, max_height) ) ;
933+ . with_max_inner_size ( LogicalSize :: new ( max_width, max_height) ) ;
1026934 self
1027935 }
1028936
@@ -2814,8 +2722,6 @@ impl<T: UserEvent> RuntimeHandle<T> for WryHandle<T> {
28142722
28152723 fn cursor_position ( & self ) -> Result < PhysicalPosition < f64 > > {
28162724 event_loop_window_getter ! ( self , EventLoopWindowTargetMessage :: CursorPosition ) ?
2817- . map ( PhysicalPositionWrapper )
2818- . map ( Into :: into)
28192725 . map_err ( |_| Error :: FailedToGetCursorPosition )
28202726 }
28212727
@@ -3142,8 +3048,6 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
31423048 . main_thread
31433049 . window_target
31443050 . cursor_position ( )
3145- . map ( PhysicalPositionWrapper )
3146- . map ( Into :: into)
31473051 . map_err ( |_| Error :: FailedToGetCursorPosition )
31483052 }
31493053
@@ -3385,24 +3289,20 @@ fn handle_user_message<T: UserEvent>(
33853289 . send (
33863290 window
33873291 . inner_position ( )
3388- . map ( |p| PhysicalPositionWrapper ( p) . into ( ) )
33893292 . map_err ( |_| Error :: FailedToSendMessage ) ,
33903293 )
33913294 . unwrap ( ) ,
33923295 WindowMessage :: OuterPosition ( tx) => tx
33933296 . send (
33943297 window
33953298 . outer_position ( )
3396- . map ( |p| PhysicalPositionWrapper ( p) . into ( ) )
33973299 . map_err ( |_| Error :: FailedToSendMessage ) ,
33983300 )
33993301 . unwrap ( ) ,
34003302 WindowMessage :: InnerSize ( tx) => tx
3401- . send ( PhysicalSizeWrapper ( inner_size ( & window, & webviews, has_children) ) . into ( ) )
3402- . unwrap ( ) ,
3403- WindowMessage :: OuterSize ( tx) => tx
3404- . send ( PhysicalSizeWrapper ( window. outer_size ( ) ) . into ( ) )
3303+ . send ( inner_size ( & window, & webviews, has_children) )
34053304 . unwrap ( ) ,
3305+ WindowMessage :: OuterSize ( tx) => tx. send ( window. outer_size ( ) ) . unwrap ( ) ,
34063306 WindowMessage :: IsFullscreen ( tx) => tx. send ( window. fullscreen ( ) . is_some ( ) ) . unwrap ( ) ,
34073307 WindowMessage :: IsMinimized ( tx) => tx. send ( window. is_minimized ( ) ) . unwrap ( ) ,
34083308 WindowMessage :: IsMaximized ( tx) => tx. send ( window. is_maximized ( ) ) . unwrap ( ) ,
@@ -3524,13 +3424,13 @@ fn handle_user_message<T: UserEvent>(
35243424 }
35253425 WindowMessage :: SetContentProtected ( protected) => window. set_content_protection ( protected) ,
35263426 WindowMessage :: SetSize ( size) => {
3527- window. set_inner_size ( SizeWrapper :: from ( size) . 0 ) ;
3427+ window. set_inner_size ( size) ;
35283428 }
35293429 WindowMessage :: SetMinSize ( size) => {
3530- window. set_min_inner_size ( size. map ( |s| SizeWrapper :: from ( s ) . 0 ) ) ;
3430+ window. set_min_inner_size ( size) ;
35313431 }
35323432 WindowMessage :: SetMaxSize ( size) => {
3533- window. set_max_inner_size ( size. map ( |s| SizeWrapper :: from ( s ) . 0 ) ) ;
3433+ window. set_max_inner_size ( size) ;
35343434 }
35353435 WindowMessage :: SetSizeConstraints ( constraints) => {
35363436 window. set_inner_size_constraints ( tao:: window:: WindowSizeConstraints {
@@ -3540,9 +3440,7 @@ fn handle_user_message<T: UserEvent>(
35403440 max_height : constraints. max_height ,
35413441 } ) ;
35423442 }
3543- WindowMessage :: SetPosition ( position) => {
3544- window. set_outer_position ( PositionWrapper :: from ( position) . 0 )
3545- }
3443+ WindowMessage :: SetPosition ( position) => window. set_outer_position ( position) ,
35463444 WindowMessage :: SetFullscreen ( fullscreen) => {
35473445 if fullscreen {
35483446 window. set_fullscreen ( Some ( Fullscreen :: Borderless ( None ) ) )
@@ -3587,7 +3485,7 @@ fn handle_user_message<T: UserEvent>(
35873485 window. set_cursor_icon ( CursorIconWrapper :: from ( icon) . 0 ) ;
35883486 }
35893487 WindowMessage :: SetCursorPosition ( position) => {
3590- let _ = window. set_cursor_position ( PositionWrapper :: from ( position) . 0 ) ;
3488+ let _ = window. set_cursor_position ( position) ;
35913489 }
35923490 WindowMessage :: SetIgnoreCursorEvents ( ignore) => {
35933491 let _ = window. set_ignore_cursor_events ( ignore) ;
@@ -4544,7 +4442,7 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
45444442 . inner
45454443 . window
45464444 . inner_size
4547- . unwrap_or_else ( || TaoPhysicalSize :: new ( 800 , 600 ) . into ( ) ) ;
4445+ . unwrap_or_else ( || PhysicalSize :: new ( 800 , 600 ) . into ( ) ) ;
45484446 let mut inner_size = window_builder
45494447 . inner
45504448 . window
@@ -5409,13 +5307,13 @@ fn inner_size(
54095307 window : & Window ,
54105308 webviews : & [ WebviewWrapper ] ,
54115309 has_children : bool ,
5412- ) -> TaoPhysicalSize < u32 > {
5310+ ) -> PhysicalSize < u32 > {
54135311 if !has_children && !webviews. is_empty ( ) {
54145312 use wry:: WebViewExtMacOS ;
54155313 let webview = webviews. first ( ) . unwrap ( ) ;
54165314 let view = unsafe { Retained :: cast_unchecked :: < objc2_app_kit:: NSView > ( webview. webview ( ) ) } ;
54175315 let view_frame = view. frame ( ) ;
5418- let logical: TaoLogicalSize < f64 > = ( view_frame. size . width , view_frame. size . height ) . into ( ) ;
5316+ let logical: LogicalSize < f64 > = ( view_frame. size . width , view_frame. size . height ) . into ( ) ;
54195317 return logical. to_physical ( window. scale_factor ( ) ) ;
54205318 }
54215319
@@ -5428,7 +5326,7 @@ fn inner_size(
54285326 window : & Window ,
54295327 webviews : & [ WebviewWrapper ] ,
54305328 has_children : bool ,
5431- ) -> TaoPhysicalSize < u32 > {
5329+ ) -> PhysicalSize < u32 > {
54325330 window. inner_size ( )
54335331}
54345332
0 commit comments