Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Use clear color for non exclusive fullscreen border, fix maximize for borderless window switching to exclusive fs. #82031

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre

if (p_fullscreen || p_borderless) {
r_style |= WS_POPUP; // p_borderless was WS_EX_TOOLWINDOW in the past.
if (p_fullscreen && p_multiwindow_fs) {
if ((p_fullscreen && p_multiwindow_fs) || p_maximized) {
r_style |= WS_BORDER; // Allows child windows to be displayed on top of full screen.
}
} else {
Expand Down Expand Up @@ -2829,6 +2829,30 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA

// Process window messages.
switch (uMsg) {
case WM_NCPAINT: {
if (RenderingServer::get_singleton() && (windows[window_id].borderless || (windows[window_id].fullscreen && windows[window_id].multiwindow_fs))) {
Color color = RenderingServer::get_singleton()->get_default_clear_color();
HDC hdc = GetWindowDC(hWnd);
if (hdc) {
HPEN pen = CreatePen(PS_SOLID, 1, RGB(color.r * 255.f, color.g * 255.f, color.b * 255.f));
if (pen) {
HGDIOBJ prev_pen = SelectObject(hdc, pen);
HGDIOBJ prev_brush = SelectObject(hdc, GetStockObject(NULL_BRUSH));

RECT rc;
GetWindowRect(hWnd, &rc);
OffsetRect(&rc, -rc.left, -rc.top);
Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom);

SelectObject(hdc, prev_pen);
SelectObject(hdc, prev_brush);
DeleteObject(pen);
}
ReleaseDC(hWnd, hdc);
}
return 0;
}
} break;
case WM_NCHITTEST: {
if (windows[window_id].mpass) {
return HTTRANSPARENT;
Expand Down
Loading