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

Can I change a borderless window size? #76

Open
vertexi opened this issue Dec 1, 2023 · 3 comments
Open

Can I change a borderless window size? #76

vertexi opened this issue Dec 1, 2023 · 3 comments
Labels

Comments

@vertexi
Copy link

vertexi commented Dec 1, 2023

I want to create a window that borderless = true and resizable = true. But according to GLFW's document

GLFW_DECORATED specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values are GLFW_TRUE and GLFW_FALSE. This hint is ignored for full screen windows.

So, I wonder if I can write some code to detect the mouse whether drag the corner of window or not, then call function like setwindowsize().

@pthom
Copy link
Owner

pthom commented Dec 1, 2023

you should try. ImGui provides ImGui::GetMousePos() + ImGui::IsMouseDown() which could help you.

But you may experience difficulties. You are fighting against the OS and/or Glfw.

@pthom pthom changed the title Can I change the window size dynamically? Can I change a borderless window size? Dec 6, 2023
@pthom
Copy link
Owner

pthom commented Jan 3, 2024

This is now possible, see new content of AppWindowParams:

struct AppWindowParams
{
    std::string windowTitle;

    WindowGeometry windowGeometry;

    // if true, then save & restore from last run
    bool restorePreviousGeometry = false;

    bool resizable = true;
    bool hidden = false;

    bool   borderless = false;
    bool   borderlessMovable = true;
    bool   borderlessResizable = true;
    bool   borderlessClosable = true;
    ImVec4 borderlessHighlightColor = ImVec4(0.2f, 0.4f, 1.f, 0.3f);


    EdgeInsets edgeInsets;
    bool       handleEdgeInsets = true;
};

@vertexi
Copy link
Author

vertexi commented Jan 4, 2024

Magnificent work! Thank you.

@vertexi vertexi closed this as completed Jan 4, 2024
@pthom pthom added the faq label May 22, 2024
@pthom pthom reopened this May 22, 2024
@pthom pthom closed this as completed Sep 7, 2024
@pthom pthom reopened this Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants