@@ -172,38 +172,17 @@ fn handle_popup_size(popup_state: &Arc<Mutex<cef_app::PopupState>>, rect: Option
172172
173173/// Helper to convert DragOperationsMask to u32 in a cross-platform way.
174174fn drag_ops_to_u32 ( ops : DragOperationsMask ) -> u32 {
175- #[ cfg( target_os = "windows" ) ]
176- {
177- ops. as_ref ( ) . 0 as u32
178- }
179- #[ cfg( not( target_os = "windows" ) ) ]
180- {
181- ops. as_ref ( ) . 0
182- }
175+ crate :: cef_raw_to_u32!( ops. as_ref( ) . 0 )
183176}
184177
185178/// Helper to convert MediaAccessPermissionTypes bitmask to u32 in a cross-platform way.
186179fn media_permission_to_u32 ( permission : cef:: MediaAccessPermissionTypes ) -> u32 {
187- #[ cfg( target_os = "windows" ) ]
188- {
189- permission. get_raw ( ) as u32
190- }
191- #[ cfg( not( target_os = "windows" ) ) ]
192- {
193- permission. get_raw ( )
194- }
180+ crate :: cef_raw_to_u32!( permission. get_raw( ) )
195181}
196182
197183/// Helper to convert PermissionRequestTypes bitmask to u32 in a cross-platform way.
198184fn prompt_permission_to_u32 ( permission : cef:: PermissionRequestTypes ) -> u32 {
199- #[ cfg( target_os = "windows" ) ]
200- {
201- permission. get_raw ( ) as u32
202- }
203- #[ cfg( not( target_os = "windows" ) ) ]
204- {
205- permission. get_raw ( )
206- }
185+ crate :: cef_raw_to_u32!( permission. get_raw( ) )
207186}
208187
209188fn cef_resource_type_to_adblock_request_type ( resource_type : ResourceType ) -> & ' static str {
@@ -632,10 +611,7 @@ wrap_drag_handler! {
632611 if let Some ( drag_data) = drag_data {
633612 let drag_info = extract_drag_data_info( drag_data) ;
634613 if let Ok ( mut queues) = self . event_queues. lock( ) {
635- #[ cfg( target_os = "windows" ) ]
636- let mask: u32 = mask. as_ref( ) . 0 as u32 ;
637- #[ cfg( not( target_os = "windows" ) ) ]
638- let mask: u32 = mask. as_ref( ) . 0 ;
614+ let mask: u32 = crate :: cef_raw_to_u32!( mask. as_ref( ) . 0 ) ;
639615
640616 queues. drag_events. push_back( DragEvent :: Entered {
641617 drag_data: drag_info,
@@ -731,10 +707,7 @@ wrap_display_handler! {
731707 ) -> :: std:: os:: raw:: c_int {
732708 let message_str = message. map( |m| m. to_string( ) ) . unwrap_or_default( ) ;
733709 let source_str = source. map( |s| s. to_string( ) ) . unwrap_or_default( ) ;
734- #[ cfg( target_os = "windows" ) ]
735- let level: u32 = level. get_raw( ) as u32 ;
736- #[ cfg( not( target_os = "windows" ) ) ]
737- let level: u32 = level. get_raw( ) ;
710+ let level: u32 = crate :: cef_raw_to_u32!( level. get_raw( ) ) ;
738711
739712 if let Ok ( mut queues) = self . event_queues. lock( ) {
740713 queues. console_messages. push_back( ConsoleMessageEvent {
0 commit comments