diff options
author | crupest <crupest@outlook.com> | 2019-12-13 01:02:47 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-12-13 01:02:47 +0800 |
commit | 9110574bb51e9e2959842a7641f598d34c3cd847 (patch) | |
tree | 96ee1f5b3c40095e4e923fc763de0663ee6a01aa /src/win/native | |
parent | f2aa96fba0b72eeeadf5160ea5df2c8143ec8aa0 (diff) | |
download | cru-9110574bb51e9e2959842a7641f598d34c3cd847.tar.gz cru-9110574bb51e9e2959842a7641f598d34c3cd847.tar.bz2 cru-9110574bb51e9e2959842a7641f598d34c3cd847.zip |
...
Diffstat (limited to 'src/win/native')
-rw-r--r-- | src/win/native/ui_application.cpp | 11 | ||||
-rw-r--r-- | src/win/native/window.cpp | 3 | ||||
-rw-r--r-- | src/win/native/window_render_target.cpp | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/win/native/ui_application.cpp b/src/win/native/ui_application.cpp index f3a7f1dc..0ae8ee81 100644 --- a/src/win/native/ui_application.cpp +++ b/src/win/native/ui_application.cpp @@ -24,6 +24,12 @@ WinUiApplication::WinUiApplication() { } instance = this; + IUiApplication::instance = this; + + instance_handle_ = ::GetModuleHandleW(nullptr); + if (!instance_handle_) + throw Win32Error(::GetLastError(), + "Failed to get module(instance) handle."); log::Logger::GetInstance()->AddSource( std::make_unique<::cru::platform::win::WinDebugLoggerSource>()); @@ -37,7 +43,10 @@ WinUiApplication::WinUiApplication() { cursor_manager_ = std::make_unique<WinCursorManager>(); } -WinUiApplication::~WinUiApplication() { instance = nullptr; } +WinUiApplication::~WinUiApplication() { + IUiApplication::instance = nullptr; + instance = nullptr; +} int WinUiApplication::Run() { MSG msg; diff --git a/src/win/native/window.cpp b/src/win/native/window.cpp index 517426ff..6fd94838 100644 --- a/src/win/native/window.cpp +++ b/src/win/native/window.cpp @@ -43,6 +43,9 @@ WinNativeWindow::WinNativeWindow(WinUiApplication* application, window_manager->RegisterWindow(hwnd_, this); + SetCursor(application->GetCursorManager()->GetSystemCursor( + cru::platform::native::SystemCursorType::Arrow)); + window_render_target_ = std::make_unique<WindowRenderTarget>( application->GetDirectFactory(), hwnd_); } diff --git a/src/win/native/window_render_target.cpp b/src/win/native/window_render_target.cpp index f501b4dd..f15aeb6e 100644 --- a/src/win/native/window_render_target.cpp +++ b/src/win/native/window_render_target.cpp @@ -29,6 +29,7 @@ WindowRenderTarget::WindowRenderTarget(DirectGraphFactory* factory, HWND hwnd) swap_chain_desc.Scaling = DXGI_SCALING_NONE; swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // all apps must use this SwapEffect + swap_chain_desc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED; swap_chain_desc.Flags = 0; // Get the final swap chain for this window from the DXGI factory. |