Hi, I’ve just upgraded to glfw 3.2 and it seems the hint

glfwWindowHint(GLFW_MAXIMIZED, 1)

does have no effect

If I try to use


then it works instead.

I’ve built glfw from sources with CodeBlocks on Windows 7 x64 using the TDM-GCC compiler, and I’m using the dll version of the library.

The snippet of code I have used is

 If glfwInit()       
    glfwWindowHint(#GLFW_OPENGL_DEBUG_CONTEXT, 1)
    glfwWindowHint(#GLFW_CONTEXT_VERSION_MAJOR, 1)
    glfwWindowHint(#GLFW_CONTEXT_VERSION_MINOR, 0)      
    glfwWindowHint(#GLFW_MAXIMIZED, 1)
    window = glfwCreateWindow(640, 480, "TEST", #Null, #Null)

	If window   
		Debug PeekS(glGetString_(#GL_VENDOR),-1,#PB_Ascii)
		Debug PeekS(glGetString_(#GL_RENDERER),-1,#PB_Ascii)
		Debug PeekS(glGetString_(#GL_VERSION),-1,#PB_Ascii)     
		glfwSetKeyCallback(window, @key_callback())
		glfwSetCharCallback(window, @char_Callback())
		While (glfwWindowShouldClose(window) = 0)


Don’t mind the strange (to you) syntax, it’s a BASIC language.

Did I do something wrong ?



prior to creating a non fullscreen window with glfw 3.2 built from source works for me (I get a fullscreen window), perhaps there is an issue with the BASIC bindings? Have you tried altering an example program from glfw source and seeing if that works?

Hi Doug, thank you for your reply.

I’ve made the bindings for this BASIC (PureBasic) and I’ve maintained them for some time, this is the first time I encountered a problem. This does not mean I could have made some error obviously !

But I find hard to believe it has to do with the bindings because glfwWindowHint() works for the other hints.
The only difference it’s a different (and new in 3.2) constant, which I’ve checked and it’s ok

#define GLFW_MAXIMIZED  0x00020008

#GLFW_MAXIMIZED = $00020008

I tried to modify one of the C samples: title.c

I’ve changed it this way:

if (!glfwInit())

glfwWindowHint(GLFW_MAXIMIZED , GL_TRUE) ;   <-- added this

window = glfwCreateWindow(400, 400, "LUIS TEST", NULL, NULL); changed string to be sure

if (!window)

And the window is not maximized.

Thinking it could have been something related to my specific DLL I built, to be sure I replaced the DLL with one from the official zip you can download from GLFW site.
Tried lib-vc2013, replaced the DLL, tried the same exe (title.exe) and again the window is not being maximized.

At this point I think my bindings and the DLL I built could be excluded. Do you agree ?

It’s true the exe it’s still built with my C compiler, but it would be really weird if that’s the cause.

Can you maybe share the dll and exe and maybe the source you tested on your computer so I would test it on mine ?

Or if you have other ideas…

EDIT: tried the modified C exe (title.c) and the prebuilt DLL even on Windows 10 x64 (inside a VM).
Same result. No maximizing.

I can confirm this. Putting glfwWindowHint(GLFW_MAXIMIZED, GL_TRUE) before glfwCreateWindow in tests or examples doesn’t open maximized window for me. This is on Windows 7 64-bit with 3.2 built from source.

@ mmozeiko

Thanks for confirming this, same OS I’m using.
But as I said I tested on win10 and it’s the same.
Strange thing it’s working for Doug. (?)

I tested using Windows 8.1 64bit, tested both dll and lib builds and 64bit, 32bit release and debug variations. So far I just get the expected results.

I used my own code and the sample boing, adding the hint before the window creation:

window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL );

My compiler is Visual Studio 2015 update 2, projects were either hand made or via cmake.

If you could both post some information on your setups we may be able to track down something you have in common vs my setup before filing an issue.

Doug, I don’t know what to post about my setup really !

As I said I’m using Win 7 x64 SP1, and I mentioned the compiler and ide used in the first post.
CMake 2.8, and I created a Make file for CodeBlocks to build the library.

Tried 32 and 64 bits builds.

Remember I tried under Win 10 too.

EDIT: tried Win 8.1 x64 too, prebuilt DLL, same result.

EDIT: tried boing too just to be sure, same result.

What else could be relevant ? Just ask and I’ll post more info if required.

On the other hand, I had a look at GLFW sources.
If I followed them correctly, they seem to add the style WS_MAXIMIZE to create the window with CreateWindowEx().
The flags used seems to be:

WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; added for a decorated window
WS_MAXIMIZEBOX | WS_THICKFRAME; added for a resizable window

and WS_MAXIMIZE if the maximizing hint is specified

and then the window is shown with

void _glfwPlatformShowWindow(_GLFWwindow* window)
    ShowWindow(window->win32.handle, SW_SHOW);

I think the problem is this approach, using WS_MAXIMIZE

I always had problems to make that flag work reliably and to cope with other flags, and I’m not alone, do a search on internet about it.

Most of the code I’ve encountered simply used SW_SHOWMAXIMIZED instead of SW_SHOW because people get frustrated by it. That works. I know according to the documentation it shouldn’t be required but as I said I never saw WS_MAXIMIZE work reliably when you are fiddling around with the other style flags.

Doug … did you launch the exe from the command line of from the ide ? Did you try both ? Both ways work ?

Oh, this is interesting.
If I run executable from cmd.exe or by double click in Explorer, then windows is NOT maximized.
But if I run executable from MSVS IDE (by Ctrl+F5 or F5), then it IS maximized.

Yes, that’s why I asked that apparently silly question :slight_smile:

I think it has something to do with this

and probably the way the IDE launch the exe

sometime it can cause the flag specified in showwindow() to be ignored (or better, overridden).

I think it’s always a good idea to try these kind of things outside the IDE to be sure.

So IF does work from the IDE but not from the console (or explorer) for Doug too, we may say we are all in the same boat and the thing is generalized. We’ll see…

I had launched from the IDE (both with and without debugger attached), and from a command line, all of which worked as expected (I get a maximized window).

Trying from double clicking Explorer gives a non maximized window, so we have a reproducible bug! Adding glfwMaximizeWindow(window) after the create window works on all methods, so it sounds like there is a work around for now.

@luis - if you have a Github account do you want to file this issue yourself? Otherwise I can do this.


No, I don’t have one, if you can do it for this time only I thank you, in the future if I find some other bug I’ll create an account to not waste other people time :slight_smile:

Can you link this thread to the report ? In case there is something useful in what I mentioned about WS_MAXIMIZE, the STARTUPINFO structure etc.

Thanks !

Thanks for reporting and helping to track down this bug! I’ve opened the issue below:


Thank you Doug.

This might be fixed now.