@@ -13,37 +13,24 @@ use std::ptr;
13
13
use std:: sync:: mpsc:: { self , Sender } ;
14
14
use std:: thread:: { self , JoinHandle } ;
15
15
use 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};
21
16
use 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 ;
26
19
use windows:: Win32 :: Graphics :: Direct3D11 :: {
27
20
D3D11CreateDevice , ID3D11Device , ID3D11DeviceContext , D3D11_CREATE_DEVICE_FLAG ,
28
21
D3D11_SDK_VERSION ,
29
22
} ;
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 } ;
36
24
use windows:: Win32 :: Graphics :: Gdi :: ReleaseDC ;
37
25
use windows:: Win32 :: Graphics :: Gdi :: COLOR_BACKGROUND ;
26
+ use windows:: Win32 :: Graphics :: Gdi :: { GetDC , HBRUSH , HDC } ;
27
+ use windows:: Win32 :: System :: LibraryLoader :: { GetModuleHandleA , GetProcAddress } ;
38
28
use 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 ,
42
31
} ;
43
32
use windows:: Win32 :: UI :: WindowsAndMessaging :: { CS_OWNDC , MSG , WM_CLOSE } ;
44
- // use winapi::um::winuser::{WNDCLASSA, WS_OVERLAPPEDWINDOW};
45
33
use windows:: Win32 :: UI :: WindowsAndMessaging :: { WNDCLASSA , WS_OVERLAPPEDWINDOW } ;
46
- // use wio::com::ComPtr;
47
34
48
35
pub ( crate ) const HIDDEN_WINDOW_SIZE : c_int = 16 ;
49
36
@@ -289,7 +276,7 @@ pub(crate) struct DCGuard<'a> {
289
276
impl Drop for HiddenWindow {
290
277
fn drop ( & mut self ) {
291
278
unsafe {
292
- winuser :: PostMessageA ( self . window , WM_CLOSE , WPARAM ( 0 ) , LPARAM ( 0 ) ) ;
279
+ PostMessageA ( self . window , WM_CLOSE , WPARAM ( 0 ) , LPARAM ( 0 ) ) ;
293
280
if let Some ( join_handle) = self . join_handle . take ( ) {
294
281
drop ( join_handle. join ( ) ) ;
295
282
}
@@ -351,7 +338,7 @@ impl HiddenWindow {
351
338
lpszMenuName : PCSTR :: null ( ) ,
352
339
lpszClassName : window_class_name,
353
340
} ;
354
- let window_class_atom = winuser :: RegisterClassA ( & window_class) ;
341
+ let window_class_atom = RegisterClassA ( & window_class) ;
355
342
assert_ne ! ( window_class_atom, 0 ) ;
356
343
}
357
344
@@ -373,9 +360,9 @@ impl HiddenWindow {
373
360
sender. send ( SendableHWND ( window) ) . unwrap ( ) ;
374
361
375
362
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) ;
379
366
if msg. message == WM_CLOSE {
380
367
break ;
381
368
}
0 commit comments