@@ -3,6 +3,7 @@ use std::iter::once;
33use std:: ops:: BitAnd ;
44use std:: os:: windows:: prelude:: { OsStrExt , OsStringExt } ;
55use std:: sync:: atomic:: { AtomicBool , Ordering } ;
6+ use std:: sync:: LazyLock ;
67use std:: { io, mem, ptr} ;
78
89use windows_sys:: core:: { HRESULT , PCWSTR } ;
@@ -23,7 +24,6 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
2324 WINDOWPLACEMENT ,
2425} ;
2526
26- use crate :: utils:: Lazy ;
2727use crate :: window:: CursorIcon ;
2828
2929pub fn encode_wide ( string : impl AsRef < OsStr > ) -> Vec < u16 > {
@@ -251,25 +251,26 @@ pub type GetPointerDeviceRects = unsafe extern "system" fn(
251251pub type GetPointerTouchInfo =
252252 unsafe extern "system" fn ( pointer_id : u32 , touch_info : * mut POINTER_TOUCH_INFO ) -> BOOL ;
253253
254- pub ( crate ) static GET_DPI_FOR_WINDOW : Lazy < Option < GetDpiForWindow > > =
255- Lazy :: new ( || get_function ! ( "user32.dll" , GetDpiForWindow ) ) ;
256- pub ( crate ) static ADJUST_WINDOW_RECT_EX_FOR_DPI : Lazy < Option < AdjustWindowRectExForDpi > > =
257- Lazy :: new ( || get_function ! ( "user32.dll" , AdjustWindowRectExForDpi ) ) ;
258- pub ( crate ) static GET_DPI_FOR_MONITOR : Lazy < Option < GetDpiForMonitor > > =
259- Lazy :: new ( || get_function ! ( "shcore.dll" , GetDpiForMonitor ) ) ;
260- pub ( crate ) static ENABLE_NON_CLIENT_DPI_SCALING : Lazy < Option < EnableNonClientDpiScaling > > =
261- Lazy :: new ( || get_function ! ( "user32.dll" , EnableNonClientDpiScaling ) ) ;
262- pub ( crate ) static SET_PROCESS_DPI_AWARENESS_CONTEXT : Lazy < Option < SetProcessDpiAwarenessContext > > =
263- Lazy :: new ( || get_function ! ( "user32.dll" , SetProcessDpiAwarenessContext ) ) ;
264- pub ( crate ) static SET_PROCESS_DPI_AWARENESS : Lazy < Option < SetProcessDpiAwareness > > =
265- Lazy :: new ( || get_function ! ( "shcore.dll" , SetProcessDpiAwareness ) ) ;
266- pub ( crate ) static SET_PROCESS_DPI_AWARE : Lazy < Option < SetProcessDPIAware > > =
267- Lazy :: new ( || get_function ! ( "user32.dll" , SetProcessDPIAware ) ) ;
268- pub ( crate ) static GET_POINTER_FRAME_INFO_HISTORY : Lazy < Option < GetPointerFrameInfoHistory > > =
269- Lazy :: new ( || get_function ! ( "user32.dll" , GetPointerFrameInfoHistory ) ) ;
270- pub ( crate ) static SKIP_POINTER_FRAME_MESSAGES : Lazy < Option < SkipPointerFrameMessages > > =
271- Lazy :: new ( || get_function ! ( "user32.dll" , SkipPointerFrameMessages ) ) ;
272- pub ( crate ) static GET_POINTER_DEVICE_RECTS : Lazy < Option < GetPointerDeviceRects > > =
273- Lazy :: new ( || get_function ! ( "user32.dll" , GetPointerDeviceRects ) ) ;
274- pub ( crate ) static GET_POINTER_TOUCH_INFO : Lazy < Option < GetPointerTouchInfo > > =
275- Lazy :: new ( || get_function ! ( "user32.dll" , GetPointerTouchInfo ) ) ;
254+ pub ( crate ) static GET_DPI_FOR_WINDOW : LazyLock < Option < GetDpiForWindow > > =
255+ LazyLock :: new ( || get_function ! ( "user32.dll" , GetDpiForWindow ) ) ;
256+ pub ( crate ) static ADJUST_WINDOW_RECT_EX_FOR_DPI : LazyLock < Option < AdjustWindowRectExForDpi > > =
257+ LazyLock :: new ( || get_function ! ( "user32.dll" , AdjustWindowRectExForDpi ) ) ;
258+ pub ( crate ) static GET_DPI_FOR_MONITOR : LazyLock < Option < GetDpiForMonitor > > =
259+ LazyLock :: new ( || get_function ! ( "shcore.dll" , GetDpiForMonitor ) ) ;
260+ pub ( crate ) static ENABLE_NON_CLIENT_DPI_SCALING : LazyLock < Option < EnableNonClientDpiScaling > > =
261+ LazyLock :: new ( || get_function ! ( "user32.dll" , EnableNonClientDpiScaling ) ) ;
262+ pub ( crate ) static SET_PROCESS_DPI_AWARENESS_CONTEXT : LazyLock <
263+ Option < SetProcessDpiAwarenessContext > ,
264+ > = LazyLock :: new ( || get_function ! ( "user32.dll" , SetProcessDpiAwarenessContext ) ) ;
265+ pub ( crate ) static SET_PROCESS_DPI_AWARENESS : LazyLock < Option < SetProcessDpiAwareness > > =
266+ LazyLock :: new ( || get_function ! ( "shcore.dll" , SetProcessDpiAwareness ) ) ;
267+ pub ( crate ) static SET_PROCESS_DPI_AWARE : LazyLock < Option < SetProcessDPIAware > > =
268+ LazyLock :: new ( || get_function ! ( "user32.dll" , SetProcessDPIAware ) ) ;
269+ pub ( crate ) static GET_POINTER_FRAME_INFO_HISTORY : LazyLock < Option < GetPointerFrameInfoHistory > > =
270+ LazyLock :: new ( || get_function ! ( "user32.dll" , GetPointerFrameInfoHistory ) ) ;
271+ pub ( crate ) static SKIP_POINTER_FRAME_MESSAGES : LazyLock < Option < SkipPointerFrameMessages > > =
272+ LazyLock :: new ( || get_function ! ( "user32.dll" , SkipPointerFrameMessages ) ) ;
273+ pub ( crate ) static GET_POINTER_DEVICE_RECTS : LazyLock < Option < GetPointerDeviceRects > > =
274+ LazyLock :: new ( || get_function ! ( "user32.dll" , GetPointerDeviceRects ) ) ;
275+ pub ( crate ) static GET_POINTER_TOUCH_INFO : LazyLock < Option < GetPointerTouchInfo > > =
276+ LazyLock :: new ( || get_function ! ( "user32.dll" , GetPointerTouchInfo ) ) ;
0 commit comments