mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-12 12:09:02 +08:00
Backends: GLFW: Handle unsupported glfwGetVideoMode() for Emscripten. (#6096)
This is used to populate the monitor array, which is only a requirement for multi-viewport support (which is not supported by Emscripten anyway).
This commit is contained in:
parent
d822c65317
commit
6342275bbb
@ -21,6 +21,7 @@
|
|||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2023-01-18: Handle unsupported glfwGetVideoMode() call on e.g. Emscripten.
|
||||||
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
|
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
|
||||||
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
|
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
|
||||||
// 2022-10-18: Perform a dummy glfwGetError() read to cancel missing mouse cursors errors. Using GLFW_VERSION_COMBINED directly. (#5785)
|
// 2022-10-18: Perform a dummy glfwGetError() read to cancel missing mouse cursors errors. Using GLFW_VERSION_COMBINED directly. (#5785)
|
||||||
@ -759,12 +760,15 @@ static void ImGui_ImplGlfw_UpdateMonitors()
|
|||||||
int monitors_count = 0;
|
int monitors_count = 0;
|
||||||
GLFWmonitor** glfw_monitors = glfwGetMonitors(&monitors_count);
|
GLFWmonitor** glfw_monitors = glfwGetMonitors(&monitors_count);
|
||||||
platform_io.Monitors.resize(0);
|
platform_io.Monitors.resize(0);
|
||||||
|
bd->WantUpdateMonitors = false;
|
||||||
for (int n = 0; n < monitors_count; n++)
|
for (int n = 0; n < monitors_count; n++)
|
||||||
{
|
{
|
||||||
ImGuiPlatformMonitor monitor;
|
ImGuiPlatformMonitor monitor;
|
||||||
int x, y;
|
int x, y;
|
||||||
glfwGetMonitorPos(glfw_monitors[n], &x, &y);
|
glfwGetMonitorPos(glfw_monitors[n], &x, &y);
|
||||||
const GLFWvidmode* vid_mode = glfwGetVideoMode(glfw_monitors[n]);
|
const GLFWvidmode* vid_mode = glfwGetVideoMode(glfw_monitors[n]);
|
||||||
|
if (vid_mode == NULL)
|
||||||
|
continue; // Failed to get Video mode (e.g. Emscripten does not support this function)
|
||||||
monitor.MainPos = monitor.WorkPos = ImVec2((float)x, (float)y);
|
monitor.MainPos = monitor.WorkPos = ImVec2((float)x, (float)y);
|
||||||
monitor.MainSize = monitor.WorkSize = ImVec2((float)vid_mode->width, (float)vid_mode->height);
|
monitor.MainSize = monitor.WorkSize = ImVec2((float)vid_mode->width, (float)vid_mode->height);
|
||||||
#if GLFW_HAS_MONITOR_WORK_AREA
|
#if GLFW_HAS_MONITOR_WORK_AREA
|
||||||
@ -784,7 +788,6 @@ static void ImGui_ImplGlfw_UpdateMonitors()
|
|||||||
#endif
|
#endif
|
||||||
platform_io.Monitors.push_back(monitor);
|
platform_io.Monitors.push_back(monitor);
|
||||||
}
|
}
|
||||||
bd->WantUpdateMonitors = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_NewFrame()
|
void ImGui_ImplGlfw_NewFrame()
|
||||||
|
@ -98,6 +98,15 @@ Other changes:
|
|||||||
Note that Linux/Mac still have inconsistent support for multi-viewports. If you want to help see https://github.com/ocornut/imgui/issues/2117.
|
Note that Linux/Mac still have inconsistent support for multi-viewports. If you want to help see https://github.com/ocornut/imgui/issues/2117.
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
VERSION 1.89.3 (In Progress)
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Docking+Viewports Branch:
|
||||||
|
|
||||||
|
- Backends: GLFW: Handle unsupported glfwGetVideoMode() for Emscripten. (#6096)
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
VERSION 1.89.2 (Released 2023-01-05)
|
VERSION 1.89.2 (Released 2023-01-05)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user