Bug 1880394 - Give the icon to the dialog window class, and revert bug 1880226. r=win-reviewers,handyman

This is to be landed after the merge. I think this is better / more
consistent, and avoids relying on mis-documented window style flags in
MSDN.

Differential Revision: https://phabricator.services.mozilla.com/D201894
This commit is contained in:
Emilio Cobos Álvarez 2024-02-19 10:15:00 +00:00
Родитель fb929a6abc
Коммит 7758e3494a
1 изменённых файлов: 19 добавлений и 19 удалений

Просмотреть файл

@ -1221,18 +1221,19 @@ static LPWSTR const gStockApplicationIcon = MAKEINTRESOURCEW(32512);
/* static */
const wchar_t* nsWindow::ChooseWindowClass(WindowType aWindowType) {
switch (aWindowType) {
case WindowType::Invisible:
return RegisterWindowClass(kClassNameHidden, 0, gStockApplicationIcon);
case WindowType::Dialog:
return RegisterWindowClass(kClassNameDialog, 0, nullptr);
case WindowType::Popup:
return RegisterWindowClass(kClassNameDropShadow, 0,
gStockApplicationIcon);
default:
return RegisterWindowClass(GetMainWindowClass(), 0,
gStockApplicationIcon);
}
const wchar_t* className = [aWindowType] {
switch (aWindowType) {
case WindowType::Invisible:
return kClassNameHidden;
case WindowType::Dialog:
return kClassNameDialog;
case WindowType::Popup:
return kClassNameDropShadow;
default:
return GetMainWindowClass();
}
}();
return RegisterWindowClass(className, 0, gStockApplicationIcon);
}
/**************************************************************
@ -1332,7 +1333,6 @@ DWORD nsWindow::WindowStyle() {
// Return nsWindow extended styles
DWORD nsWindow::WindowExStyle() {
MOZ_ASSERT_IF(mIsAlert, mWindowType == WindowType::Dialog);
switch (mWindowType) {
case WindowType::Child:
return 0;
@ -1343,18 +1343,18 @@ DWORD nsWindow::WindowExStyle() {
}
return extendedStyle;
}
case WindowType::Dialog: {
if (mIsAlert) {
return WS_EX_TOOLWINDOW;
}
return WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME;
}
case WindowType::Sheet:
MOZ_FALLTHROUGH_ASSERT("Sheets are macOS specific");
case WindowType::Dialog:
case WindowType::TopLevel:
case WindowType::Invisible:
break;
}
if (mIsAlert) {
MOZ_ASSERT(mWindowType == WindowType::Dialog,
"Expect alert windows to have type=dialog");
return WS_EX_TOOLWINDOW;
}
return WS_EX_WINDOWEDGE;
}