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

How to remove the round corners #18

Open
CybernetHacker14 opened this issue Nov 3, 2022 · 1 comment
Open

How to remove the round corners #18

CybernetHacker14 opened this issue Nov 3, 2022 · 1 comment

Comments

@CybernetHacker14
Copy link

I am trying to render an ImGui dockspace, and using certain parts of your code in combination with glfw.

However, the resulting window has round corners, and hence, it might be introducing certain padding/space.
Screenshot_1

How do I remove the round corners? I need to test whether this is causing that gap.

@jschroedl
Copy link

jschroedl commented Jan 4, 2023

It looks like you're on Windows 11. You can use DWM calls to turn off the rounded corners if needed. Something like this:

namespace {
   . . . 
   
   auto set_square_corners(HWND handle) -> void {
        if (composition_enabled()) {
            DWM_WINDOW_CORNER_PREFERENCE no_round_corners{ DWMWCP_DONOTROUND };

            // Will return E_INVALIDARG on non-Windows 11 systems.
            ::DwmSetWindowAttribute(handle, DWMWA_WINDOW_CORNER_PREFERENCE, &no_round_corners, sizeof(no_round_corners));
        }
    }
}

Then in BorderlessWindow::BorderlessWindow(), call it with set_square_corners(handle.get());

You could obviously add code to switch the corners to round/square as desired.

See DWM_WINDOW_CORNER_PREFERENCE enumeration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants