feat: add BrowserWindow.isSnapped() (#46079)

* feat: add BrowserWindow.isSnapped() on Windows

* docs: mark _Readonly_
This commit is contained in:
Shelley Vohr 2025-03-24 12:09:14 +01:00 committed by GitHub
parent 47cf4e7bfd
commit 9ec14b91e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 52 additions and 0 deletions

View file

@ -1488,6 +1488,22 @@ bool NativeWindowViews::IsMenuBarVisible() const {
return root_view_.is_menu_bar_visible();
}
bool NativeWindowViews::IsSnapped() const {
#if BUILDFLAG(IS_WIN)
// IsWindowArranged() is not a part of any header file.
// https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindowarranged
using IsWindowArrangedFuncType = BOOL(WINAPI*)(HWND);
static const auto is_window_arranged_func =
reinterpret_cast<IsWindowArrangedFuncType>(
base::win::GetUser32FunctionPointer("IsWindowArranged"));
return is_window_arranged_func
? is_window_arranged_func(GetAcceleratedWidget())
: false;
#else
return false;
#endif
}
void NativeWindowViews::SetBackgroundMaterial(const std::string& material) {
NativeWindow::SetBackgroundMaterial(material);