1
1
#![ doc = include_str ! ( "../README.md" ) ]
2
+ #![ deny( unsafe_op_in_unsafe_fn) ]
2
3
3
4
#[ cfg( target_os = "macos" ) ]
4
5
#[ macro_use]
@@ -56,7 +57,7 @@ macro_rules! make_dispatch {
56
57
match self {
57
58
$(
58
59
$( #[ $attr] ) *
59
- Self :: $name( inner) => inner. set_buffer( buffer, width, height) ,
60
+ Self :: $name( inner) => unsafe { inner. set_buffer( buffer, width, height) } ,
60
61
) *
61
62
}
62
63
}
@@ -90,7 +91,7 @@ impl GraphicsContext {
90
91
window : & W ,
91
92
display : & D ,
92
93
) -> Result < Self , SwBufError > {
93
- Self :: from_raw ( window. raw_window_handle ( ) , display. raw_display_handle ( ) )
94
+ unsafe { Self :: from_raw ( window. raw_window_handle ( ) , display. raw_display_handle ( ) ) }
94
95
}
95
96
96
97
/// Creates a new instance of this struct, using the provided raw window and display handles
@@ -108,22 +109,23 @@ impl GraphicsContext {
108
109
(
109
110
RawWindowHandle :: Xlib ( xlib_window_handle) ,
110
111
RawDisplayHandle :: Xlib ( xlib_display_handle) ,
111
- ) => Dispatch :: X11 ( x11:: X11Impl :: new ( xlib_window_handle, xlib_display_handle) ?) ,
112
+ ) => Dispatch :: X11 ( unsafe {
113
+ x11:: X11Impl :: new ( xlib_window_handle, xlib_display_handle) ?
114
+ } ) ,
112
115
#[ cfg( all( feature = "wayland" , any( target_os = "linux" , target_os = "freebsd" ) ) ) ]
113
116
(
114
117
RawWindowHandle :: Wayland ( wayland_window_handle) ,
115
118
RawDisplayHandle :: Wayland ( wayland_display_handle) ,
116
- ) => Dispatch :: Wayland ( wayland:: WaylandImpl :: new (
117
- wayland_window_handle,
118
- wayland_display_handle,
119
- ) ?) ,
119
+ ) => Dispatch :: Wayland ( unsafe {
120
+ wayland:: WaylandImpl :: new ( wayland_window_handle, wayland_display_handle) ?
121
+ } ) ,
120
122
#[ cfg( target_os = "windows" ) ]
121
123
( RawWindowHandle :: Win32 ( win32_handle) , _) => {
122
- Dispatch :: Win32 ( win32:: Win32Impl :: new ( & win32_handle) ?)
124
+ Dispatch :: Win32 ( unsafe { win32:: Win32Impl :: new ( & win32_handle) ? } )
123
125
}
124
126
#[ cfg( target_os = "macos" ) ]
125
127
( RawWindowHandle :: AppKit ( appkit_handle) , _) => {
126
- Dispatch :: CG ( cg:: CGImpl :: new ( appkit_handle) ?)
128
+ Dispatch :: CG ( unsafe { cg:: CGImpl :: new ( appkit_handle) ? } )
127
129
}
128
130
#[ cfg( target_arch = "wasm32" ) ]
129
131
( RawWindowHandle :: Web ( web_handle) , _) => Dispatch :: Web ( web:: WebImpl :: new ( web_handle) ?) ,
0 commit comments