Is it possible to grey out/disable the window's close button

Hi guys,

I know that nothing will happen if you don’t assign anything to the window’s close button (X). Still you can click on it because it is enabled and not greyed out it by default. Is it possible to grey out/disable the close button of a window if you don’t want to use it?

Make the window borderless? Dunno how that works on Mac/Windows. That’s the easiest solution without messing with the Window Decorator/Window Manager.

So hide systems Titlebar and roll your own.

-Cass

Thanks Acry. I didn’t think about that. However, in this case the window controls like minimize/maximize would be gone as well. Is there a way to keep/restore these and only get rid of the close button?

How about https://wiki.libsdl.org/SDL_MinimizeWindow ? =)

1 Like

-Cass

How about if you make the close button behave like the Esc key, or back button, or menu key instead? This would be better expected behaviour from a user perspective. If I saw a grey close button, it would make me feel trapped and uneasy.

You are trapped.
IMHO, making X not close the Window (or show a Dialog to confirm closing
the Window) but something else in the menu is even more unexpected than
being greyed out or not doing anything.

Cheers,
Daniel