Can you get the monitor which a window is currently on?

The function glfwGetWindowMonitor only gives you a monitor if the window is fullscreen. Is there a way to get the monitor which a non-fullscreen window is on?

I understand that windows can span multiple monitors, but usually it’s “primarily” associated with one monitor at a time. This is the monitor whose DPI scaling applies to the window contents, the monitor which the window is vsynced against, etc.

I believe the SDL2 function SDL_GetWindowDisplayIndex does essentially what I want, and I’m wondering if there’s a GLFW equivalent.

Hi @mort and welcome to the GLFW forum,

Is there a way to get the monitor which a non-fullscreen window is on?

Currently no, but there is an issue with some example code and a couple of PRs for this, see: