Mercurial > minori
diff dep/animia/src/win/win32.cc @ 191:0fc126d52de4
animia: multiple stylistic choices
win.class_name is now used to store bundle IDs on OS X,
add some little explanations here and there for dumb stuff
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 07 Dec 2023 01:48:04 -0500 |
parents | cdf79282d647 |
children | bc1ae1810855 |
line wrap: on
line diff
--- a/dep/animia/src/win/win32.cc Wed Dec 06 21:26:13 2023 -0500 +++ b/dep/animia/src/win/win32.cc Thu Dec 07 01:48:04 2023 -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