mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Wayland: Move DPI fallback work to output done
This removes the dependency on the (unspecified) ordering of geometry and mode events in wl_output. Based on feedback from @linkmauve and @caramelli. Related to #1792.
This commit is contained in:
parent
729c9988d0
commit
b925a54ef1
@ -81,22 +81,21 @@ static void outputHandleMode(void* data,
|
||||
monitor->modes[monitor->modeCount - 1] = mode;
|
||||
|
||||
if (flags & WL_OUTPUT_MODE_CURRENT)
|
||||
{
|
||||
monitor->wl.currentMode = monitor->modeCount - 1;
|
||||
|
||||
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
|
||||
{
|
||||
// If Wayland does not provide a physical size, assume the default 96 DPI
|
||||
monitor->widthMM = (int) (width * 25.4f / 96.f);
|
||||
monitor->heightMM = (int) (height * 25.4f / 96.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void outputHandleDone(void* data, struct wl_output* output)
|
||||
{
|
||||
struct _GLFWmonitor *monitor = data;
|
||||
|
||||
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
|
||||
{
|
||||
// If Wayland does not provide a physical size, assume the default 96 DPI
|
||||
const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode];
|
||||
monitor->widthMM = (int) (mode->width * 25.4f / 96.f);
|
||||
monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
|
||||
}
|
||||
|
||||
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user