Skip to content

Commit

Permalink
Reformat all macros with cargo run -p windows_fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Jun 7, 2021
1 parent 9e644d8 commit 0f959e6
Show file tree
Hide file tree
Showing 23 changed files with 141 additions and 197 deletions.
26 changes: 12 additions & 14 deletions crates/bindings/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@ fn main() -> std::io::Result<()> {
let tokens = windows_macros::generate! {
Windows::Foundation::{IReference, IStringable, PropertyValue},
Windows::Win32::System::Com::{
CoCreateGuid, CoTaskMemAlloc, CoTaskMemFree, CLSIDFromProgID, CoInitializeEx, CoCreateInstance,
IAgileObject, COINIT_MULTITHREADED, COINIT_APARTMENTTHREADED, CLSCTX_ALL,
CLSIDFromProgID, CoCreateGuid, CoCreateInstance, CoInitializeEx, CoTaskMemAlloc,
CoTaskMemFree, IAgileObject, CLSCTX_ALL, COINIT_APARTMENTTHREADED,
COINIT_MULTITHREADED,
},
Windows::Win32::System::Diagnostics::Debug::{
GetLastError, FormatMessageW, FORMAT_MESSAGE_ALLOCATE_BUFFER, FORMAT_MESSAGE_FROM_SYSTEM,
FORMAT_MESSAGE_IGNORE_INSERTS,
FormatMessageW, GetLastError, FORMAT_MESSAGE_ALLOCATE_BUFFER,
FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_IGNORE_INSERTS,
},
Windows::Win32::System::Memory::{
GetProcessHeap, HeapAlloc, HeapFree, HEAP_NONE,
},
Windows::Win32::System::OleAutomation::{BSTR, GetErrorInfo, IErrorInfo, SetErrorInfo},
Windows::Win32::System::Memory::{GetProcessHeap, HeapAlloc, HeapFree, HEAP_NONE},
Windows::Win32::System::OleAutomation::{GetErrorInfo, IErrorInfo, SetErrorInfo, BSTR},
Windows::Win32::System::SystemServices::{
GetProcAddress, LoadLibraryA, FreeLibrary, CO_E_NOTINITIALIZED, E_POINTER,
},
Windows::Win32::System::Threading::{
CreateEventA, SetEvent, WaitForSingleObject,
FreeLibrary, GetProcAddress, LoadLibraryA, CO_E_NOTINITIALIZED, E_POINTER,
},
Windows::Win32::System::WindowsProgramming::CloseHandle,
Windows::Win32::System::Threading::{CreateEventA, SetEvent, WaitForSingleObject},
Windows::Win32::System::WinRT::{
IRestrictedErrorInfo, ILanguageExceptionErrorInfo2, IWeakReference, IWeakReferenceSource,
ILanguageExceptionErrorInfo2, IRestrictedErrorInfo, IWeakReference,
IWeakReferenceSource,
},
Windows::Win32::System::WindowsProgramming::CloseHandle,
};

let mut path = windows_gen::workspace_dir();
Expand Down
2 changes: 1 addition & 1 deletion examples/buffer/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
windows::build! {
Windows::Foundation::{MemoryBuffer, IMemoryBufferReference},
Windows::Foundation::{IMemoryBufferReference, MemoryBuffer},
Windows::Win32::System::WinRT::IMemoryBufferByteAccess,
};
}
41 changes: 21 additions & 20 deletions examples/clock/bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ fn main() {
Windows::Foundation::Numerics::Matrix3x2,
Windows::Win32::Graphics::Direct2D::{
CLSID_D2D1Shadow, D2D1CreateFactory, ID2D1Bitmap1, ID2D1Device, ID2D1DeviceContext,
ID2D1Effect, ID2D1Factory1, ID2D1SolidColorBrush, ID2D1StrokeStyle, D2D1_ALPHA_MODE_IGNORE,
D2D1_ALPHA_MODE_PREMULTIPLIED, D2D1_BITMAP_OPTIONS_CANNOT_DRAW, D2D1_BITMAP_OPTIONS_TARGET,
D2D1_BITMAP_PROPERTIES1, D2D1_BRUSH_PROPERTIES, D2D1_CAP_STYLE_ROUND,
D2D1_CAP_STYLE_TRIANGLE, D2D1_COLOR_F, D2D1_COMPOSITE_MODE_SOURCE_OVER,
D2D1_DEBUG_LEVEL_INFORMATION, D2D1_DEVICE_CONTEXT_OPTIONS_NONE, D2D1_ELLIPSE,
D2D1_FACTORY_OPTIONS, D2D1_FACTORY_TYPE_SINGLE_THREADED, D2D1_INTERPOLATION_MODE_LINEAR,
D2D1_PIXEL_FORMAT, D2D1_STROKE_STYLE_PROPERTIES, D2D1_UNIT_MODE_DIPS, D2D_POINT_2F,
D2D_RECT_F, D2D_SIZE_F, D2D_SIZE_U,
ID2D1Effect, ID2D1Factory1, ID2D1SolidColorBrush, ID2D1StrokeStyle,
D2D1_ALPHA_MODE_IGNORE, D2D1_ALPHA_MODE_PREMULTIPLIED, D2D1_BITMAP_OPTIONS_CANNOT_DRAW,
D2D1_BITMAP_OPTIONS_TARGET, D2D1_BITMAP_PROPERTIES1, D2D1_BRUSH_PROPERTIES,
D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_TRIANGLE, D2D1_COLOR_F,
D2D1_COMPOSITE_MODE_SOURCE_OVER, D2D1_DEBUG_LEVEL_INFORMATION,
D2D1_DEVICE_CONTEXT_OPTIONS_NONE, D2D1_ELLIPSE, D2D1_FACTORY_OPTIONS,
D2D1_FACTORY_TYPE_SINGLE_THREADED, D2D1_INTERPOLATION_MODE_LINEAR, D2D1_PIXEL_FORMAT,
D2D1_STROKE_STYLE_PROPERTIES, D2D1_UNIT_MODE_DIPS, D2D_POINT_2F, D2D_RECT_F,
D2D_SIZE_F, D2D_SIZE_U,
},
Windows::Win32::Graphics::Direct3D11::{
D3D11CreateDevice, ID3D11Device, D3D11_CREATE_DEVICE_BGRA_SUPPORT,
D3D11_CREATE_DEVICE_DEBUG, D3D11_SDK_VERSION, D3D_DRIVER_TYPE, D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP,
D3D11_CREATE_DEVICE_DEBUG, D3D11_SDK_VERSION, D3D_DRIVER_TYPE,
D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_WARP,
},
Windows::Win32::Graphics::Dxgi::{
CreateDXGIFactory1, IDXGIDevice, IDXGIFactory2, IDXGIFactory7, IDXGIOutput, IDXGISurface,
IDXGISwapChain1, DXGI_ERROR_UNSUPPORTED, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN,
DXGI_PRESENT_TEST, DXGI_SAMPLE_DESC, DXGI_SWAP_CHAIN_DESC1,
CreateDXGIFactory1, IDXGIDevice, IDXGIFactory2, IDXGIFactory7, IDXGIOutput,
IDXGISurface, IDXGISwapChain1, DXGI_ERROR_UNSUPPORTED, DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_FORMAT_UNKNOWN, DXGI_PRESENT_TEST, DXGI_SAMPLE_DESC, DXGI_SWAP_CHAIN_DESC1,
DXGI_SWAP_CHAIN_FULLSCREEN_DESC, DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL,
DXGI_USAGE_RENDER_TARGET_OUTPUT,
},
Expand All @@ -37,13 +38,13 @@ fn main() {
UI_ANIMATION_UPDATE_RESULT,
},
Windows::Win32::UI::WindowsAndMessaging::{
CreateWindowExA, DefWindowProcA, DispatchMessageA, GetMessageA, GetWindowLongPtrA,
LoadCursorW, PeekMessageA, PostQuitMessage, RegisterClassA, SetWindowLongPtrA,
SetWindowLongA, GetWindowLongA,
CREATESTRUCTA, CS_HREDRAW, CS_VREDRAW, CW_USEDEFAULT, GWLP_USERDATA, HWND, IDC_HAND,
LPARAM, MSG, PM_REMOVE, SIZE_MINIMIZED, WINDOW_LONG_PTR_INDEX, WM_ACTIVATE, WM_DESTROY,
WM_DISPLAYCHANGE, WM_NCCREATE, WM_PAINT, WM_QUIT, WM_SIZE, WM_USER, WNDCLASSA, WPARAM,
WS_OVERLAPPEDWINDOW, WS_VISIBLE,
CreateWindowExA, DefWindowProcA, DispatchMessageA, GetMessageA, GetWindowLongA,
GetWindowLongPtrA, LoadCursorW, PeekMessageA, PostQuitMessage, RegisterClassA,
SetWindowLongA, SetWindowLongPtrA, CREATESTRUCTA, CS_HREDRAW, CS_VREDRAW,
CW_USEDEFAULT, GWLP_USERDATA, HWND, IDC_HAND, LPARAM, MSG, PM_REMOVE, SIZE_MINIMIZED,
WINDOW_LONG_PTR_INDEX, WM_ACTIVATE, WM_DESTROY, WM_DISPLAYCHANGE, WM_NCCREATE,
WM_PAINT, WM_QUIT, WM_SIZE, WM_USER, WNDCLASSA, WPARAM, WS_OVERLAPPEDWINDOW,
WS_VISIBLE,
},
};
}
3 changes: 1 addition & 2 deletions examples/com_uri/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fn main() {
windows::build! {
Windows::Win32::System::OleAutomation::BSTR,
Windows::Win32::System::Com::CreateUri,
Windows::Win32::System::Com::CreateUri, Windows::Win32::System::OleAutomation::BSTR,
};
}
5 changes: 1 addition & 4 deletions examples/core_app/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
fn main() {
windows::build! {
Windows::ApplicationModel::Core::*,
Windows::UI::Core::*,
};
windows::build! {Windows::ApplicationModel::Core::*, Windows::UI::Core::*};
}
64 changes: 13 additions & 51 deletions examples/d3d12/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,60 +1,22 @@
fn main() {
windows::build! {
Windows::Win32::Graphics::Direct3D12::*,
Windows::Win32::Graphics::Dxgi::*,
Windows::Win32::Graphics::Direct3D11::{
D3D_FEATURE_LEVEL_11_0,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST
D3D_FEATURE_LEVEL_11_0, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
},
Windows::Win32::Graphics::Direct3D12::*,
Windows::Win32::Graphics::Dxgi::*,
Windows::Win32::Graphics::Hlsl::*,
Windows::Win32::System::SystemServices::{GetModuleHandleA, HINSTANCE, PSTR},
Windows::Win32::System::Threading::{CreateEventA, WaitForSingleObject},
Windows::Win32::System::WindowsProgramming::INFINITE,
Windows::Win32::UI::DisplayDevices::RECT,
Windows::Win32::UI::WindowsAndMessaging::{
AdjustWindowRect,
CREATESTRUCTA,
CreateWindowExA,
CS_HREDRAW,
CS_VREDRAW,
CW_USEDEFAULT,
DefWindowProcA,
DispatchMessageA,
GetWindowLongA,
GetWindowLongPtrA,
GWLP_USERDATA,
IDC_ARROW,
LoadCursorW,
MSG,
PeekMessageA,
PM_REMOVE,
PostQuitMessage,
RegisterClassExA,
SetWindowLongA,
SetWindowLongPtrA,
ShowWindow,
SW_SHOW,
TranslateMessage,
WM_CREATE,
WM_DESTROY,
WM_KEYDOWN,
WM_KEYUP,
WM_PAINT,
WM_QUIT,
WNDCLASS_STYLES,
WNDCLASSEXA,
WS_OVERLAPPEDWINDOW,
},
Windows::Win32::System::SystemServices::{
GetModuleHandleA,
HINSTANCE,
PSTR,
},
Windows::Win32::System::Threading::{
CreateEventA,
WaitForSingleObject
},
Windows::Win32::System::WindowsProgramming::{
INFINITE
},
Windows::Win32::UI::DisplayDevices::{
RECT
AdjustWindowRect, CreateWindowExA, DefWindowProcA, DispatchMessageA, GetWindowLongA,
GetWindowLongPtrA, LoadCursorW, PeekMessageA, PostQuitMessage, RegisterClassExA,
SetWindowLongA, SetWindowLongPtrA, ShowWindow, TranslateMessage, CREATESTRUCTA,
CS_HREDRAW, CS_VREDRAW, CW_USEDEFAULT, GWLP_USERDATA, IDC_ARROW, MSG, PM_REMOVE,
SW_SHOW, WM_CREATE, WM_DESTROY, WM_KEYDOWN, WM_KEYUP, WM_PAINT, WM_QUIT, WNDCLASSEXA,
WNDCLASS_STYLES, WS_OVERLAPPEDWINDOW,
},
};
}
2 changes: 1 addition & 1 deletion examples/event/bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ fn main() {
Windows::Win32::System::Threading::{
CreateEventW, SetEvent, WaitForSingleObject, WAIT_OBJECT_0,
},
Windows::Win32::System::WindowsProgramming::CloseHandle
Windows::Win32::System::WindowsProgramming::CloseHandle,
};
}
6 changes: 3 additions & 3 deletions examples/ocr/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fn main() {
windows::build! {
Windows::Graphics::Imaging::{SoftwareBitmap, BitmapDecoder},
Windows::Media::Ocr::{OcrEngine, OcrResult},
Windows::Storage::{FileAccessMode, StorageFile},
Windows::Foundation::IAsyncOperation,
Windows::Graphics::Imaging::{BitmapDecoder, SoftwareBitmap},
Windows::Media::Ocr::{OcrEngine, OcrResult},
Windows::Storage::Streams::IRandomAccessStream,
Windows::Storage::{FileAccessMode, StorageFile},
};
}
18 changes: 8 additions & 10 deletions examples/overlapped/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
fn main() {
windows::build! {
Windows::Win32::Storage::FileSystem::{
CreateFileA, ReadFile, FILE_GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
},
Windows::Win32::System::SystemServices::GetOverlappedResult,
Windows::Win32::System::Threading::{
CreateEventA, WaitForSingleObject, WAIT_OBJECT_0,
},
Windows::Win32::System::Diagnostics::Debug::{GetLastError, ERROR_IO_PENDING},
Windows::Win32::System::WindowsProgramming::CloseHandle,
Windows::Win32::Storage::FileSystem::{
CreateFileA, ReadFile, FILE_FLAG_OVERLAPPED, FILE_GENERIC_READ, FILE_SHARE_READ,
OPEN_EXISTING,
},
Windows::Win32::System::Diagnostics::Debug::{GetLastError, ERROR_IO_PENDING},
Windows::Win32::System::SystemServices::GetOverlappedResult,
Windows::Win32::System::Threading::{CreateEventA, WaitForSingleObject, WAIT_OBJECT_0},
Windows::Win32::System::WindowsProgramming::CloseHandle,
};
}
4 changes: 2 additions & 2 deletions examples/rss/bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ fn main() {
windows::build! {
Windows::Foundation::Collections::IVector,
Windows::Foundation::{IAsyncOperationWithProgress, Uri},

Windows::Web::Syndication::{
ISyndicationText, RetrievalProgress, SyndicationClient, SyndicationFeed, SyndicationItem,
ISyndicationText, RetrievalProgress, SyndicationClient, SyndicationFeed,
SyndicationItem,
},
};
}
2 changes: 1 addition & 1 deletion examples/simple/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
windows::build! {Windows::UI::Colors, Windows::UI::Color};
windows::build! {Windows::UI::Color, Windows::UI::Colors};
}
8 changes: 4 additions & 4 deletions examples/spellchecker/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
fn main() {
windows::build! {
Windows::Win32::Globalization::{
ISpellChecker, SpellCheckerFactory, ISpellCheckerFactory, IEnumSpellingError,
ISpellingError, CORRECTIVE_ACTION_NONE, CORRECTIVE_ACTION_DELETE,
CORRECTIVE_ACTION_REPLACE, CORRECTIVE_ACTION_GET_SUGGESTIONS,
IEnumSpellingError, ISpellChecker, ISpellCheckerFactory, ISpellingError,
SpellCheckerFactory, CORRECTIVE_ACTION_DELETE, CORRECTIVE_ACTION_GET_SUGGESTIONS,
CORRECTIVE_ACTION_NONE, CORRECTIVE_ACTION_REPLACE,
},
Windows::Win32::System::Com::IEnumString,
Windows::Win32::System::SystemServices::{BOOL, PWSTR, S_FALSE},
Windows::Win32::System::Com::IEnumString
};
}
4 changes: 2 additions & 2 deletions examples/webview2/bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ fn main() {
Windows::Win32::System::Threading::GetCurrentThreadId,
Windows::Win32::UI::DisplayDevices::{POINT, RECT, SIZE},
Windows::Win32::UI::HiDpi::{
PROCESS_DPI_AWARENESS, SetProcessDpiAwareness, PROCESS_PER_MONITOR_DPI_AWARE
SetProcessDpiAwareness, PROCESS_DPI_AWARENESS, PROCESS_PER_MONITOR_DPI_AWARE,
},
Windows::Win32::UI::KeyboardAndMouseInput::SetFocus,
Windows::Win32::UI::MenusAndResources::HMENU,
Windows::Win32::UI::WindowsAndMessaging::*
Windows::Win32::UI::WindowsAndMessaging::*,
};
}
3 changes: 1 addition & 2 deletions examples/xaml_app/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
fn main() {
windows::build! {
Windows::ApplicationModel::Activation::*,
Windows::ApplicationModel::Activation::*, Windows::UI::Xaml::Controls::TextBox,
Windows::UI::Xaml::*,
Windows::UI::Xaml::Controls::TextBox,
};
}
3 changes: 1 addition & 2 deletions examples/xml/bindings/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fn main() {
windows::build! {
Windows::Data::Xml::Dom::XmlDocument,
Windows::Data::Xml::Dom::XmlElement
Windows::Data::Xml::Dom::XmlDocument, Windows::Data::Xml::Dom::XmlElement,
};
}
10 changes: 6 additions & 4 deletions tests/build_groups/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
fn main() {
windows::build! {
// TODO: IKeyValuePair should not need to be needed here https://github.com/microsoft/windows-rs/issues/772
Windows::Foundation::{IStringable, Collections::{IVector, IMap, IKeyValuePair}},
Windows::Foundation::{
Collections::{IKeyValuePair, IMap, IVector},
IStringable,
},

// Test for https://github.com/microsoft/windows-rs/issues/699
Windows::Win32::System::Diagnostics::{
Debug::GetLastError,
ProcessSnapshotting::PssCaptureSnapshot,
}
Debug::GetLastError, ProcessSnapshotting::PssCaptureSnapshot,
},
};
}
2 changes: 1 addition & 1 deletion tests/handles/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
windows::build! {
Windows::Win32::System::SystemServices::{HANDLE, PSTR, PWSTR},
Windows::Win32::Graphics::Gdi::HGDIOBJ,
Windows::Win32::System::SystemServices::{HANDLE, PSTR, PWSTR},
};
}
2 changes: 1 addition & 1 deletion tests/implement/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fn main() {
windows::build! {
Windows::Foundation::{IStringable, IClosable},
// TODO: Dependency tracking is a little too conservative for the implement macro at the moment.
Windows::ApplicationModel::Activation::*,
Windows::Foundation::{IClosable, IStringable},
Windows::UI::Xaml::*,
};
}
2 changes: 1 addition & 1 deletion tests/interop/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fn main() {
windows::build! {
Windows::Win32::System::WinRT::RoActivateInstance,
Windows::Foundation::Collections::StringMap,
Windows::Win32::System::WinRT::RoActivateInstance,
Windows::Win32::UI::RadialInput::IRadialControllerInterop,
};
}
8 changes: 4 additions & 4 deletions tests/unions/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fn main() {
windows::build! {
Windows::Win32::System::SystemServices::OVERLAPPED,
Windows::Win32::UI::ColorSystem::WhitePoint,
Windows::Win32::Graphics::Direct3D12::{
D3D12_INDIRECT_ARGUMENT_DESC, D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW,
D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT,
D3D12_INDIRECT_ARGUMENT_DESC, D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT,
D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW,
},
Windows::Win32::System::SystemServices::OVERLAPPED,
Windows::Win32::UI::ColorSystem::WhitePoint,
};
}
Loading

0 comments on commit 0f959e6

Please sign in to comment.