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

No icon if initially fullscreen with GLFW_VISIBLE hint set to GLFW_FALSE #1163

Open
ghuser404 opened this Issue Dec 23, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@ghuser404

ghuser404 commented Dec 23, 2017

I think this issue started happening with the latest Windows 10 update. I've seen it happen in other app too. Not sure if GLFW needs to change anything, but leaving this just for future reference.

  1. Set GLFW_VISIBLE hint to GLFW_FALSE
  2. Create window
  3. Set window monitor to some valid monitor
  4. Show window
  5. Set window monitor to NULL

You'll see that there is no icon near the window title. This works fine if not initially setting GLFW_VISIBLE hint to GLFW_FALSE.

@elmindreda

This comment has been minimized.

Member

elmindreda commented Dec 24, 2017

Is it as if WS_SYSMENU is missing after leaving full screen?

@ghuser404

This comment has been minimized.

ghuser404 commented Dec 24, 2017

Almost. Without WS_SYSMENU the minimize/maximize/close boxes are also absent.
Also, the WS_SYSMENU is not missing as inspected via inspect.exe.

@elmindreda

This comment has been minimized.

Member

elmindreda commented Jan 9, 2018

Unable to reproduce on Windows 7 with

#include <GLFW/glfw3.h>

#include <stdlib.h>

int main(int argc, char** argv)
{
    GLFWwindow* window;
    const GLFWvidmode* mode;

    if (!glfwInit())
        exit(EXIT_FAILURE);

    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);

    window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    mode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    glfwSetWindowMonitor(window, glfwGetPrimaryMonitor(),
                         0, 0, mode->width, mode->height, mode->refreshRate);

    // NOTE: glfwSetWindowMonitor with a monitor already performs a show
    glfwShowWindow(window);

    glfwSetWindowMonitor(window, NULL, 0, 0, 640, 480, 0);

    while (!glfwWindowShouldClose(window))
        glfwWaitEvents();

    glfwTerminate();
    exit(EXIT_SUCCESS);
}

Will test on Windows 10 when I get the chance.

@ghuser404

This comment has been minimized.

ghuser404 commented Jan 9, 2018

I tested your code snippet on my machine with Windows 10, and yes - the issue is there. Commenting out glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); fixes the problem.

Looking forward to your test results on Windows 10.

@elmindreda

This comment has been minimized.

Member

elmindreda commented Jan 9, 2018

@ghuser404 Yay for successful clean-room test case and thank you for testing!

@elmindreda

This comment has been minimized.

Member

elmindreda commented Jan 10, 2018

Verified on Windows 10.

@elmindreda elmindreda added the verified label Jan 10, 2018

@elmindreda

This comment has been minimized.

Member

elmindreda commented Jan 10, 2018

Cannot reproduce it with the boing example's full screen toggling on Windows 10.

@IanLilleyT

This comment has been minimized.

IanLilleyT commented Feb 26, 2018

Related problem that happens in boing on Windows 10 only when you start the app in fullscreen:

Start app in fullscreen:

GLFWmonitor* primaryMonitor = glfwGetPrimaryMonitor();
const GLFWvidmode* videoMode = glfwGetVideoMode(primaryMonitor);
window = glfwCreateWindow( videoMode->width, videoMode->height, "Boing (classic Amiga demo)", primaryMonitor, NULL );

and hardcode some window dims for key_callback:

void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods )
{
    if (action != GLFW_PRESS)
        return;

    if (key == GLFW_KEY_ESCAPE && mods == 0)
        glfwSetWindowShouldClose(window, GLFW_TRUE);
    if ((key == GLFW_KEY_ENTER && mods == GLFW_MOD_ALT) ||
        (key == GLFW_KEY_F11 && mods == GLFW_MOD_ALT))
    {
        if (glfwGetWindowMonitor(window))
        {
            glfwSetWindowMonitor(window, NULL, 20, 20, 400, 400, 0);
        }
        else
        {
            GLFWmonitor* monitor = glfwGetPrimaryMonitor();
            if (monitor)
            {
                const GLFWvidmode* mode = glfwGetVideoMode(monitor);
                glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);
            }
        }
    }
}

And voila! The title bar icon is gone when you ALT+ENTER into windowed mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment