#2903·glfw

Wayland lacks fullscreen monitor selection.

Author: SylvanSerenityCreated Sep 18, 2026Updated Sep 18, 2026

Breaking Case

As far as I can tell, GLFW's Wayland support provides no way to set fullscreen windows for the following case:

  • Using GLFW's Wayland platform.
  • First monitor returned from glfwGetMonitors() is NOT the system's primary monitor or current monitor.
  • Attempt to enable fullscreen window on current/system primary monitor.

Cause

  • On Wayland, glfwGetPrimaryMonitor() returns the first available monitor and glfwSetWindowPosCallback() does not work.
  • If you call glfwSetWindowMonitor() using the "primary" monitor returned from glfwGetPrimaryMonitor(), or a monitor derived from window position (since Wayland doesn't support window positioning), it will just use the first available monitor, even if that is not the system's primary monitor.
  • glfwMaximizeWindow() with glfwSetWindowAttrib(me.w.h.raw, c.GLFW_DECORATED, c.GLFW_FALSE) shows the taskbar. Manual window sizing is also impossible without knowing what size to set it to, i.e., the monitor size.
  • Even if you add a custom Wayland surface enter listener, you can't register it because Wayland only supports at most one surface listener at a time, which GLFW is already using!

Discussion

While you can derive the current monitor using window position and comparing it to the bounds of the enumerated monitors on Win32 and X11 (maybe Cocoa?), the fact that Wayland does not allow you to manipulate window position means you cannot do the same. As previously mentioned, Wayland does expose a surface listener for enter and leave events, but GLFW's implementation not only keeps it private, but also prevents you from getting it using your own listeners. One work around may be to add a subsurface on top of the window and add a listener to that, but that seems a bit of a hefty workaround.

This seems to be causing problems in other libraries too, such as Cubyz and tev.

Solution

I think the glfwGetCurrentMonitor() feature request (#1699) is the best solution to this problem. It solves a common implementation myself and others have had to manually implement, and Wayland supports this well with the wl_surface_listener struct's enter callback.