@@ -13,37 +13,24 @@ use std::ptr;
1313use std:: sync:: mpsc:: { self , Sender } ;
1414use std:: thread:: { self , JoinHandle } ;
1515use windows:: core:: { Interface , PCSTR } ;
16- // use winapi::shared::dxgi::{IDXGIAdapter, IDXGIDevice};
17- // use winapi::shared::minwindef::{self, FALSE, UINT};
18- // use winapi::shared::ntdef::{HANDLE, LPCSTR};
19- use windows:: Win32 :: Foundation :: { HANDLE , HINSTANCE , HMODULE , LPARAM , LRESULT , WPARAM } ;
20- // use winapi::shared::windef::{HBRUSH, HDC, HWND};
2116use windows:: Win32 :: Foundation :: HWND ;
22- use windows:: Win32 :: Graphics :: Gdi :: { GetDC , HBRUSH , HDC } ;
23- // use winapi::shared::winerror::{self, S_OK};
24- use windows:: Win32 :: Graphics :: Dxgi :: { IDXGIAdapter , IDXGIDevice } ;
25- // use winapi::um::d3d11::{D3D11CreateDevice, ID3D11Device, ID3D11DeviceContext, D3D11_SDK_VERSION};
17+ use windows:: Win32 :: Foundation :: { HANDLE , HINSTANCE , HMODULE , LPARAM , LRESULT , WPARAM } ;
18+ use windows:: Win32 :: Graphics :: Direct3D :: D3D_DRIVER_TYPE_HARDWARE ;
2619use windows:: Win32 :: Graphics :: Direct3D11 :: {
2720 D3D11CreateDevice , ID3D11Device , ID3D11DeviceContext , D3D11_CREATE_DEVICE_FLAG ,
2821 D3D11_SDK_VERSION ,
2922} ;
30- // use winapi::um::d3dcommon::D3D_DRIVER_TYPE_HARDWARE;
31- use windows:: Win32 :: Graphics :: Direct3D :: D3D_DRIVER_TYPE_HARDWARE ;
32- // use winapi::um::libloaderapi;
33- use windows:: Win32 :: System :: LibraryLoader :: { GetModuleHandleA , GetProcAddress } ;
34- // use windows::Win32::System::LibraryLoader::GetProcAddress;
35- // use winapi::um::winuser::{self, COLOR_BACKGROUND, CS_OWNDC, MSG, WM_CLOSE};
23+ use windows:: Win32 :: Graphics :: Dxgi :: { IDXGIAdapter , IDXGIDevice } ;
3624use windows:: Win32 :: Graphics :: Gdi :: ReleaseDC ;
3725use windows:: Win32 :: Graphics :: Gdi :: COLOR_BACKGROUND ;
26+ use windows:: Win32 :: Graphics :: Gdi :: { GetDC , HBRUSH , HDC } ;
27+ use windows:: Win32 :: System :: LibraryLoader :: { GetModuleHandleA , GetProcAddress } ;
3828use windows:: Win32 :: UI :: WindowsAndMessaging :: {
39- self as winuser, CreateWindowExA , DefWindowProcA , GetClassInfoA , GetWindowLongPtrA ,
40- SetWindowLongPtrA , CREATESTRUCTA , GWLP_USERDATA , HCURSOR , HICON , HMENU , WINDOW_EX_STYLE ,
41- WM_NCCREATE ,
29+ CreateWindowExA , DefWindowProcA , DispatchMessageA , GetClassInfoA , GetMessageA , PostMessageA ,
30+ RegisterClassA , TranslateMessage , HCURSOR , HICON , HMENU , WINDOW_EX_STYLE ,
4231} ;
4332use windows:: Win32 :: UI :: WindowsAndMessaging :: { CS_OWNDC , MSG , WM_CLOSE } ;
44- // use winapi::um::winuser::{WNDCLASSA, WS_OVERLAPPEDWINDOW};
4533use windows:: Win32 :: UI :: WindowsAndMessaging :: { WNDCLASSA , WS_OVERLAPPEDWINDOW } ;
46- // use wio::com::ComPtr;
4734
4835pub ( crate ) const HIDDEN_WINDOW_SIZE : c_int = 16 ;
4936
@@ -289,7 +276,7 @@ pub(crate) struct DCGuard<'a> {
289276impl Drop for HiddenWindow {
290277 fn drop ( & mut self ) {
291278 unsafe {
292- winuser :: PostMessageA ( self . window , WM_CLOSE , WPARAM ( 0 ) , LPARAM ( 0 ) ) ;
279+ PostMessageA ( self . window , WM_CLOSE , WPARAM ( 0 ) , LPARAM ( 0 ) ) ;
293280 if let Some ( join_handle) = self . join_handle . take ( ) {
294281 drop ( join_handle. join ( ) ) ;
295282 }
@@ -351,7 +338,7 @@ impl HiddenWindow {
351338 lpszMenuName : PCSTR :: null ( ) ,
352339 lpszClassName : window_class_name,
353340 } ;
354- let window_class_atom = winuser :: RegisterClassA ( & window_class) ;
341+ let window_class_atom = RegisterClassA ( & window_class) ;
355342 assert_ne ! ( window_class_atom, 0 ) ;
356343 }
357344
@@ -373,9 +360,9 @@ impl HiddenWindow {
373360 sender. send ( SendableHWND ( window) ) . unwrap ( ) ;
374361
375362 let mut msg: MSG = mem:: zeroed ( ) ;
376- while winuser :: GetMessageA ( & mut msg, window, 0 , 0 ) != false {
377- winuser :: TranslateMessage ( & msg) ;
378- winuser :: DispatchMessageA ( & msg) ;
363+ while GetMessageA ( & mut msg, window, 0 , 0 ) != false {
364+ TranslateMessage ( & msg) ;
365+ DispatchMessageA ( & msg) ;
379366 if msg. message == WM_CLOSE {
380367 break ;
381368 }
0 commit comments