1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

emscripten: Handle unsupported glfwGetVideoMode()

This commit is contained in:
Cody Tapscott 2023-01-18 08:59:20 -07:00
parent 08aed0c70a
commit 5492a2cf94

View File

@ -765,6 +765,11 @@ static void ImGui_ImplGlfw_UpdateMonitors()
int x, y;
glfwGetMonitorPos(glfw_monitors[n], &x, &y);
const GLFWvidmode* vid_mode = glfwGetVideoMode(glfw_monitors[n]);
if (vid_mode == NULL) { // Failed to get Video mode (e.g. Emscripten does not support this function)
bd->WantUpdateMonitors = false;
platform_io.Monitors.resize(0);
return;
}
monitor.MainPos = monitor.WorkPos = ImVec2((float)x, (float)y);
monitor.MainSize = monitor.WorkSize = ImVec2((float)vid_mode->width, (float)vid_mode->height);
#if GLFW_HAS_MONITOR_WORK_AREA