From 9dbc54aad6df15a8865343a4e7ecfbad19543a2b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 8 Sep 2019 09:12:39 +0530 Subject: [PATCH] Fix comparison of video modes of equal area This fixes the bug of video modes being discarded if they had a different resolution but the same area as another mode. Upstream: https://github.com/glfw/glfw/commit/2777f6a754a469eb9b71b4d241ca5f3b1ce5a9b1 --- glfw/monitor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/glfw/monitor.c b/glfw/monitor.c index 046147202..c25148e3c 100644 --- a/glfw/monitor.c +++ b/glfw/monitor.c @@ -56,6 +56,10 @@ static int compareVideoModes(const void* fp, const void* sp) if (farea != sarea) return farea - sarea; + // Then sort on width + if (fm->width != sm->width) + return fm->width - sm->width; + // Lastly sort on refresh rate return fm->refreshRate - sm->refreshRate; }