Fix old windows code to use new window type

#2800
This commit is contained in:
Wojtek Figat
2026-02-11 23:29:13 +01:00
parent a3492e59ef
commit d4a7b3074e
3 changed files with 11 additions and 11 deletions

View File

@@ -112,7 +112,7 @@ LinuxWindow::LinuxWindow(const CreateWindowSettings& settings)
windowAttributes.border_pixel = XBlackPixel(display, screen);
windowAttributes.event_mask = KeyPressMask | KeyReleaseMask | StructureNotifyMask | ExposureMask;
if (!settings.IsRegularWindow)
if (settings.Type != WindowType::Regular)
{
windowAttributes.save_under = true;
windowAttributes.override_redirect = true;
@@ -126,7 +126,7 @@ LinuxWindow::LinuxWindow(const CreateWindowSettings& settings)
*/
unsigned long valueMask = CWBackPixel | CWBorderPixel | CWEventMask | CWColormap;
if (!settings.IsRegularWindow)
if (settings.Type != WindowType::Regular)
{
valueMask |= CWOverrideRedirect | CWSaveUnder;
}
@@ -183,7 +183,7 @@ LinuxWindow::LinuxWindow(const CreateWindowSettings& settings)
X11::XClassHint* classHint = X11::XAllocClassHint();
if (classHint)
{
const char* className = settings.IsRegularWindow ? "FlexEditor" : "FlaxPopup";
const char* className = settings.Type == WindowType::Regular ? "FlaxEditor" : "FlaxPopup";
classHint->res_name = const_cast<char*>(className);
classHint->res_class = const_cast<char*>(className);
@@ -234,7 +234,7 @@ LinuxWindow::LinuxWindow(const CreateWindowSettings& settings)
}
// Adjust type for utility windows
if (!settings.IsRegularWindow)
if (settings.Type != WindowType::Regular)
{
X11::Atom value = XInternAtom(display, "_NET_WM_WINDOW_TYPE_DOCK", 0);
X11::Atom wmType = XInternAtom(display, "_NET_WM_WINDOW_TYPE", 0);

View File

@@ -696,7 +696,7 @@ MacWindow::MacWindow(const CreateWindowSettings& settings)
Float2 pos = AppleUtils::PosToCoca(settings.Position);
NSRect frame = NSMakeRect(pos.X, pos.Y - settings.Size.Y, settings.Size.X, settings.Size.Y);
NSUInteger styleMask = NSWindowStyleMaskClosable;
if (settings.IsRegularWindow)
if (settings.Type == WindowType::Regular)
{
styleMask |= NSWindowStyleMaskTitled;
if (settings.AllowMinimize)

View File

@@ -108,7 +108,7 @@ WindowsWindow::WindowsWindow(const CreateWindowSettings& settings)
// Create window style flags
style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
#if WINDOWS_USE_NEW_BORDER_LESS
if (settings.IsRegularWindow)
if (settings.Type == WindowType::Regular)
style |= WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP;
#elif WINDOWS_USE_NEWER_BORDER_LESS
if (settings.Type == WindowType::Regular)
@@ -215,7 +215,7 @@ void WindowsWindow::Show()
// Show
ShowWindow(_handle, (_settings.AllowInput && _settings.ActivateWhenFirstShown) ? SW_SHOW : SW_SHOWNA);
#if WINDOWS_USE_NEW_BORDER_LESS
if (!_settings.HasBorder && _settings.IsRegularWindow)
if (!_settings.HasBorder && settings.Type == WindowType::Regular)
{
SetWindowPos(_handle, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
@@ -285,7 +285,7 @@ void WindowsWindow::SetBorderless(bool isBorderless, bool maximized)
lStyle |= WS_POPUP;
lStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
#if WINDOWS_USE_NEW_BORDER_LESS
if (_settings.IsRegularWindow)
if (_settings.Type == WindowType::Regular)
style |= WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP;
#elif WINDOWS_USE_NEWER_BORDER_LESS
if (_settings.Type == WindowType::Regular)
@@ -835,7 +835,7 @@ void WindowsWindow::UpdateRegion()
{
#if WINDOWS_USE_NEW_BORDER_LESS
// Use region to remove rounded corners of the window
if (!_settings.HasBorder && _settings.IsRegularWindow)
if (!_settings.HasBorder && _settings.Type == WindowType::Regular)
{
if (!_maximized && !_isResizing)
{
@@ -961,7 +961,7 @@ LRESULT WindowsWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NCCALCSIZE:
{
#if WINDOWS_USE_NEW_BORDER_LESS
if (wParam && !_settings.HasBorder && _settings.IsRegularWindow)
if (wParam && !_settings.HasBorder && _settings.Type == WindowType::Regular)
{
if (_maximized)
{
@@ -995,7 +995,7 @@ LRESULT WindowsWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
}
}
#elif WINDOWS_USE_NEWER_BORDER_LESS
if (wParam == TRUE && !_settings.HasBorder) // && _settings.IsRegularWindow)
if (wParam == TRUE && !_settings.HasBorder) // && _settings.Type == WindowType::Regular)
{
// In maximized mode fill the whole work area of the monitor (excludes task bar)
if (IsWindowMaximized(_handle))