Mercurial > minori
diff dep/animia/src/win/win32.cc @ 202:71832ffe425a
animia: re-add kvm fd source
this is all being merged from my wildly out-of-date laptop. SORRY!
in other news, I edited the CI file to install the wayland client
as well, so the linux CI build might finally get wayland stuff.
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 02 Jan 2024 06:05:06 -0500 |
parents | bc1ae1810855 |
children |
line wrap: on
line diff
--- a/dep/animia/src/win/win32.cc Sun Nov 19 19:13:28 2023 -0500 +++ b/dep/animia/src/win/win32.cc Tue Jan 02 06:05:06 2024 -0500 @@ -1,3 +1,10 @@ +/* + * win/win32.cc: support for Windows + * + * Surprisingly, this is the one time where Microsoft actually + * does it fairly OK. Everything has a pretty simple API, despite + * the stupid wide string stuff. +*/ #include "animia/win/win32.h" #include "animia.h" #include "animia/util/win32.h" @@ -24,9 +31,9 @@ } static std::wstring GetWindowText(HWND hwnd) { - const int estimated_size = ::GetWindowTextLengthW(hwnd); + const auto estimated_size = ::GetWindowTextLengthW(hwnd); + std::wstring buffer(estimated_size + 1, L'\0'); - std::wstring buffer(estimated_size + 1, L'\0'); const auto size = ::GetWindowTextW(hwnd, &buffer.front(), buffer.length()); /* GetWindowTextLength docs: "Under certain conditions, the GetWindowTextLength function may return a value @@ -160,7 +167,7 @@ return TRUE; } -bool Win32WinTools::EnumerateWindows(window_proc_t window_proc) { +bool EnumerateWindows(window_proc_t window_proc) { if (!window_proc) return false; @@ -171,4 +178,4 @@ return ::EnumWindows(EnumWindowsProc, param) != FALSE; } -} // namespace animia::internal::win32 \ No newline at end of file +} // namespace animia::internal::win32