diff options
Diffstat (limited to 'src/win/native/cursor.cpp')
-rw-r--r-- | src/win/native/cursor.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/win/native/cursor.cpp b/src/win/native/cursor.cpp index a0f9dd6c..096f3fdf 100644 --- a/src/win/native/cursor.cpp +++ b/src/win/native/cursor.cpp @@ -1,22 +1,22 @@ #include "cru/win/native/cursor.hpp" -#include "cru/common/format.hpp" #include "cru/common/logger.hpp" #include "cru/win/native/exception.hpp" #include <stdexcept> namespace cru::platform::native::win { -WinCursor::WinCursor(HCURSOR handle, bool auto_delete) { +WinCursor::WinCursor(HCURSOR handle, bool auto_destroy) { handle_ = handle; - auto_delete_ = auto_delete; + auto_destroy_ = auto_destroy; } WinCursor::~WinCursor() { - if (auto_delete_) { + if (auto_destroy_) { if (!::DestroyCursor(handle_)) { - // This is not a fetal error but might still need notice. - log::Warn(L"Failed to destroy a cursor. Last error code: {}", + // This is not a fetal error but might still need notice because it may + // cause leak. + log::Warn("Failed to destroy a cursor. Last error code: {}", ::GetLastError()); } } @@ -27,7 +27,7 @@ WinCursor* LoadWinCursor(const wchar_t* name) { const auto handle = static_cast<HCURSOR>(::LoadImageW( NULL, name, IMAGE_CURSOR, SM_CYCURSOR, SM_CYCURSOR, LR_SHARED)); if (handle == NULL) { - throw Win32Error(::GetLastError(), "Failed to get system cursor."); + throw Win32Error(::GetLastError(), "Failed to load system cursor."); } return new WinCursor(handle, false); } @@ -38,11 +38,11 @@ WinCursorManager::WinCursorManager() sys_hand_(LoadWinCursor(IDC_HAND)) {} std::shared_ptr<WinCursor> WinCursorManager::GetSystemWinCursor( - SystemCursor type) { + SystemCursorType type) { switch (type) { - case SystemCursor::Arrow: + case SystemCursorType::Arrow: return sys_arrow_; - case SystemCursor::Hand: + case SystemCursorType::Hand: return sys_hand_; default: throw std::runtime_error("Unknown system cursor value."); |