Merge branch 'master' into docking

# Conflicts:
#	backends/imgui_impl_sdl3.cpp
#	backends/imgui_impl_sdl3.h
#	docs/CHANGELOG.txt
#	imgui_internal.h
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d332903..48082d0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -489,12 +489,12 @@
         popd
         make -C examples/example_sdl2_opengl3 -f Makefile.emscripten
 
-    - name: Build example_emscripten_wgpu
+    - name: Build example_glfw_wgpu
       run: |
         pushd emsdk-master
         source ./emsdk_env.sh
         popd
-        make -C examples/example_emscripten_wgpu -f Makefile.emscripten
+        make -C examples/example_glfw_wgpu -f Makefile.emscripten
 
   Android:
     runs-on: ubuntu-22.04
diff --git a/.gitignore b/.gitignore
index 211d21d..64b5e12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,8 +40,9 @@
 examples/*.out.js
 examples/*.out.wasm
 examples/example_glfw_opengl3/web/*
+examples/example_glfw_wgpu/web/*
+examples/example_glfw_wgpu/external/*
 examples/example_sdl2_opengl3/web/*
-examples/example_emscripten_wgpu/web/*
 
 ## JetBrains IDE artifacts
 .idea
diff --git a/backends/imgui_impl_sdl3.cpp b/backends/imgui_impl_sdl3.cpp
index e08a6c8..7e9a778 100644
--- a/backends/imgui_impl_sdl3.cpp
+++ b/backends/imgui_impl_sdl3.cpp
@@ -13,7 +13,7 @@
 // Issues:
 //  [ ] Platform: Multi-viewport: Minimized windows seems to break mouse wheel events (at least under Windows).
 //  [ ] Platform: Multi-viewport: ParentViewportID not honored, and so io.ConfigViewportsNoDefaultParent has no effect (minor).
-//  [x] Platform: Basic IME support. Position somehow broken in SDL3 + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
+//  [ ] Platform: IME SUPPORT IS BROKEN IN SDL3 BECAUSE INPUTS GETS SENT TO BOTH APP AND IME + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
 
 // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
 // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
@@ -26,6 +26,7 @@
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
 //  2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
+//  2024-04-15: Inputs: Re-enable calling SDL_StartTextInput()/SDL_StopTextInput() as SDL3 no longer enables it by default and should play nicer with IME.
 //  2024-02-13: Inputs: Fixed gamepad support. Handle gamepad disconnection. Added ImGui_ImplSDL3_SetGamepadMode().
 //  2023-11-13: Updated for recent SDL3 API changes.
 //  2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
@@ -129,6 +130,11 @@
         r.w = 1;
         r.h = (int)data->InputLineHeight;
         SDL_SetTextInputRect(&r);
+        SDL_StartTextInput();
+    }
+    else
+    {
+        SDL_StopTextInput();
     }
 }
 
diff --git a/backends/imgui_impl_sdl3.h b/backends/imgui_impl_sdl3.h
index c6979b9..ef5497e 100644
--- a/backends/imgui_impl_sdl3.h
+++ b/backends/imgui_impl_sdl3.h
@@ -14,6 +14,7 @@
 //  [ ] Platform: Multi-viewport: Minimized windows seems to break mouse wheel events (at least under Windows).
 //  [ ] Platform: Multi-viewport: ParentViewportID not honored, and so io.ConfigViewportsNoDefaultParent has no effect (minor).
 //  [x] Platform: Basic IME support. Position somehow broken in SDL3 + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
+//  [ ] Platform: IME SUPPORT IS BROKEN IN SDL3 BECAUSE INPUTS GETS SENT TO BOTH APP AND IME + app needs to call 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");' before SDL_CreateWindow()!.
 
 // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
 // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
diff --git a/backends/imgui_impl_wgpu.cpp b/backends/imgui_impl_wgpu.cpp
index a832445..6e82ebf 100644
--- a/backends/imgui_impl_wgpu.cpp
+++ b/backends/imgui_impl_wgpu.cpp
@@ -753,7 +753,7 @@
 
     // Create buffers with a default size (they will later be grown as needed)
     bd->pFrameResources = new FrameResources[bd->numFramesInFlight];
-    for (int i = 0; i < bd->numFramesInFlight; i++)
+    for (unsigned int i = 0; i < bd->numFramesInFlight; i++)
     {
         FrameResources* fr = &bd->pFrameResources[i];
         fr->IndexBuffer = nullptr;
diff --git a/docs/BACKENDS.md b/docs/BACKENDS.md
index e5aa79b..88a96a6 100644
--- a/docs/BACKENDS.md
+++ b/docs/BACKENDS.md
@@ -79,14 +79,14 @@
     imgui_impl_sdlrenderer2.cpp ; SDL_Renderer (optional component of SDL2 available from SDL 2.0.18+)
     imgui_impl_sdlrenderer3.cpp ; SDL_Renderer (optional component of SDL3 available from SDL 3.0.0+)
     imgui_impl_vulkan.cpp     ; Vulkan
-    imgui_impl_wgpu.cpp       ; WebGPU
+    imgui_impl_wgpu.cpp       ; WebGPU (web and desktop)
 
 List of high-level Frameworks Backends (combining Platform + Renderer):
 
     imgui_impl_allegro5.cpp
 
 Emscripten is also supported!
-The SDL+GL, GLFW+GL and SDL+WebGPU examples are all ready to build and run with Emscripten.
+The SDL+GL, GLFW+GL and GLFW+WebGPU examples are all ready to build and run with Emscripten.
 
 ### Backends for third-party frameworks, graphics API or other languages
 
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 8ef1744..9ff5a71 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -43,6 +43,16 @@
 
 Other changes:
 
+- Fonts: Fixed font ascent and descent calculation when a font hits exact integer values.
+  It is possible that some prior manual use of ImFontConfig::GlyphOffset may become
+  duplicate with this fix. (#7399, #7404) [@GamingMinds-DanielC]
+- Text, DrawList: Improved handling of long single-line wrapped text. Faster and
+  mitigitate issues with reading vertex indexing limits with 16-bit indices. (#7496, #5720)
+- Backends: SDL3: Fixed text inputs. Re-enable calling SDL_StartTextInput()/SDL_StopTextInput()
+  as SDL3 no longer enables it by default. (#7452, #6306, #6071, #1953) [@Green-Sky]
+- Examples: GLFW+WebGPU: Added support for WebGPU-native/Dawn (#7435, #7132) [@eliasdaler, @Zelif]
+- Examples: GLFW+WebGPU: Renamed example_emscripten_wgpu/ to example_glfw_wgpu/. (#7435, #7132)
+
 Docking+Viewports Branch:
 
 - Docking: when io.ConfigDockingWithShift is enabled, fixed help tooltip erroneously
diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md
index edaddb0..e813489 100644
--- a/docs/EXAMPLES.md
+++ b/docs/EXAMPLES.md
@@ -104,8 +104,8 @@
 (NB: imgui_impl_osx.mm is currently not as feature complete as other platforms backends.
  You may prefer to use the GLFW Or SDL backends, which will also support Windows and Linux.)
 
-[example_emscripten_wgpu/](https://github.com/ocornut/imgui/blob/master/examples/example_emscripten_wgpu/) <BR>
-Emcripten + GLFW + WebGPU example. <BR>
+[example_glfw_wgpu/](https://github.com/ocornut/imgui/blob/master/examples/example_glfw_wgpu/) <BR>
+GLFW + WebGPU example. Supports Emscripten (web) or Dawn (desktop) <BR>
 = main.cpp + imgui_impl_glfw.cpp + imgui_impl_wgpu.cpp
 Note that the 'example_glfw_opengl3' and 'example_sdl2_opengl3' examples also supports Emscripten!
 
diff --git a/examples/example_glfw_wgpu/CMakeLists.txt b/examples/example_glfw_wgpu/CMakeLists.txt
new file mode 100644
index 0000000..e682836
--- /dev/null
+++ b/examples/example_glfw_wgpu/CMakeLists.txt
@@ -0,0 +1,100 @@
+# Building for desktop (WebGPU-native) with Dawn:
+#  1. git clone https://github.com/google/dawn dawn
+#  2. cmake -B build -DIMGUI_DAWN_DIR=dawn
+#  3. cmake --build build
+# The resulting binary will be found at one of the following locations:
+#   * build/Debug/example_glfw_wgpu[.exe]
+#   * build/example_glfw_wgpu[.exe]
+
+# Building for Emscripten:
+#  1. Install Emscripten SDK following the instructions: https://emscripten.org/docs/getting_started/downloads.html
+#  2. Install Ninja build system
+#  3. emcmake cmake -G Ninja -B build
+#  3. cmake --build build
+#  4. emrun build/index.html
+
+cmake_minimum_required(VERSION 3.10.2)
+project(imgui_example_glfw_wgpu C CXX)
+
+if(NOT CMAKE_BUILD_TYPE)
+  set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
+endif()
+
+set(CMAKE_CXX_STANDARD 17) # Dawn requires C++17
+
+# Dear ImGui
+set(IMGUI_DIR ../../)
+
+# Libraries
+if(EMSCRIPTEN)
+  set(LIBRARIES glfw)
+  add_compile_options(-sDISABLE_EXCEPTION_CATCHING=1 -DIMGUI_DISABLE_FILE_FUNCTIONS=1)
+else()
+  # Dawn wgpu desktop
+  set(DAWN_FETCH_DEPENDENCIES ON)
+  set(IMGUI_DAWN_DIR CACHE PATH "Path to Dawn repository")
+  if (NOT IMGUI_DAWN_DIR)
+    message(FATAL_ERROR "Please specify the Dawn repository by setting IMGUI_DAWN_DIR")
+  endif()
+
+  option(DAWN_FETCH_DEPENDENCIES "Use fetch_dawn_dependencies.py as an alternative to using depot_tools" ON)
+
+  # Dawn builds many things by default - disable things we don't need
+  option(DAWN_BUILD_SAMPLES "Enables building Dawn's samples" OFF)
+  option(TINT_BUILD_CMD_TOOLS "Build the Tint command line tools" OFF)
+  option(TINT_BUILD_DOCS "Build documentation" OFF)
+  option(TINT_BUILD_TESTS "Build tests" OFF)
+  if (NOT APPLE)
+    option(TINT_BUILD_MSL_WRITER "Build the MSL output writer" OFF)
+  endif()
+  if(WIN32)
+    option(TINT_BUILD_SPV_READER "Build the SPIR-V input reader" OFF)
+    option(TINT_BUILD_WGSL_READER "Build the WGSL input reader" ON)
+    option(TINT_BUILD_GLSL_WRITER "Build the GLSL output writer" OFF)
+    option(TINT_BUILD_GLSL_VALIDATOR "Build the GLSL output validator" OFF)
+    option(TINT_BUILD_SPV_WRITER "Build the SPIR-V output writer" OFF)
+    option(TINT_BUILD_WGSL_WRITER "Build the WGSL output writer" ON)
+  endif()
+
+  add_subdirectory("${IMGUI_DAWN_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/dawn" EXCLUDE_FROM_ALL)
+
+  set(LIBRARIES webgpu_dawn webgpu_cpp webgpu_glfw glfw)
+endif()
+
+add_executable(example_glfw_wgpu
+  main.cpp
+  # backend files
+  ${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
+  ${IMGUI_DIR}/backends/imgui_impl_wgpu.cpp
+  # Dear ImGui files
+  ${IMGUI_DIR}/imgui.cpp
+  ${IMGUI_DIR}/imgui_draw.cpp
+  ${IMGUI_DIR}/imgui_demo.cpp
+  ${IMGUI_DIR}/imgui_tables.cpp
+  ${IMGUI_DIR}/imgui_widgets.cpp
+)
+target_include_directories(example_glfw_wgpu PUBLIC
+  ${IMGUI_DIR}
+  ${IMGUI_DIR}/backends
+)
+
+target_link_libraries(example_glfw_wgpu PUBLIC ${LIBRARIES})
+
+# Emscripten settings
+if(EMSCRIPTEN)
+  target_link_options(example_glfw_wgpu PRIVATE
+    "-sUSE_WEBGPU=1"
+    "-sUSE_GLFW=3"
+    "-sWASM=1"
+    "-sALLOW_MEMORY_GROWTH=1"
+    "-sNO_EXIT_RUNTIME=0"
+    "-sASSERTIONS=1"
+    "-sDISABLE_EXCEPTION_CATCHING=1"
+    "-sNO_FILESYSTEM=1"
+  )
+  set_target_properties(example_glfw_wgpu PROPERTIES OUTPUT_NAME "index")
+  # copy our custom index.html to build directory
+  add_custom_command(TARGET example_glfw_wgpu POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/web/index.html" $<TARGET_FILE_DIR:example_glfw_wgpu>
+  )
+endif()
diff --git a/examples/example_emscripten_wgpu/Makefile.emscripten b/examples/example_glfw_wgpu/Makefile.emscripten
similarity index 100%
rename from examples/example_emscripten_wgpu/Makefile.emscripten
rename to examples/example_glfw_wgpu/Makefile.emscripten
diff --git a/examples/example_emscripten_wgpu/README.md b/examples/example_glfw_wgpu/README.md
similarity index 89%
rename from examples/example_emscripten_wgpu/README.md
rename to examples/example_glfw_wgpu/README.md
index e60025d..399d431 100644
--- a/examples/example_emscripten_wgpu/README.md
+++ b/examples/example_glfw_wgpu/README.md
@@ -6,7 +6,7 @@
 
 - You may also refer to our [Continuous Integration setup](https://github.com/ocornut/imgui/tree/master/.github/workflows) for Emscripten setup.
 
-- Then build using `make -f Makefile.emscripten` while in the `example_emscripten_wgpu/` directory.
+- Then build using `make -f Makefile.emscripten` while in the `example_glfw_wgpu/` directory.
 
 - Requires recent Emscripten as WGPU is still a work-in-progress API.
 
@@ -18,7 +18,7 @@
 - Otherwise, generally you will need a local webserver:
   - Quoting [https://emscripten.org/docs/getting_started](https://emscripten.org/docs/getting_started/Tutorial.html#generating-html):<br>
 _"Unfortunately several browsers (including Chrome, Safari, and Internet Explorer) do not support file:// [XHR](https://emscripten.org/docs/site/glossary.html#term-xhr) requests, and can’t load extra files needed by the HTML (like a .wasm file, or packaged file data as mentioned lower down). For these browsers you’ll need to serve the files using a [local webserver](https://emscripten.org/docs/getting_started/FAQ.html#faq-local-webserver) and then open http://localhost:8000/hello.html."_
-  - Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
+  - Emscripten SDK has a handy `emrun` command: `emrun web/example_glfw_wgpu.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
   - You may use Python 3 builtin webserver: `python -m http.server -d web` (this is what `make serve` uses).
   - You may use Python 2 builtin webserver: `cd web && python -m SimpleHTTPServer`.
   - If you are accessing the files over a network, certain browsers, such as Firefox, will restrict Gamepad API access to secure contexts only (e.g. https only).
diff --git a/examples/example_emscripten_wgpu/main.cpp b/examples/example_glfw_wgpu/main.cpp
similarity index 80%
rename from examples/example_emscripten_wgpu/main.cpp
rename to examples/example_glfw_wgpu/main.cpp
index 43e93a2..4e47b83 100644
--- a/examples/example_emscripten_wgpu/main.cpp
+++ b/examples/example_glfw_wgpu/main.cpp
@@ -1,5 +1,6 @@
-// Dear ImGui: standalone example application for Emscripten, using GLFW + WebGPU
-// (Emscripten is a C++-to-javascript compiler, used to publish executables for the web. See https://emscripten.org/)
+// Dear ImGui: standalone example application for using GLFW + WebGPU
+// - Emscripten is supported for publishing on web. See https://emscripten.org.
+// - Dawn is used as a WebGPU implementation on desktop.
 
 // Learn about Dear ImGui:
 // - FAQ                  https://dearimgui.com/faq
@@ -11,11 +12,15 @@
 #include "imgui_impl_glfw.h"
 #include "imgui_impl_wgpu.h"
 #include <stdio.h>
+
 #ifdef __EMSCRIPTEN__
 #include <emscripten.h>
 #include <emscripten/html5.h>
 #include <emscripten/html5_webgpu.h>
+#else
+#include <webgpu/webgpu_glfw.h>
 #endif
+
 #include <GLFW/glfw3.h>
 #include <webgpu/webgpu.h>
 #include <webgpu/webgpu_cpp.h>
@@ -26,15 +31,16 @@
 #endif
 
 // Global WebGPU required states
+static WGPUInstance      wgpu_instance = nullptr;
 static WGPUDevice        wgpu_device = nullptr;
 static WGPUSurface       wgpu_surface = nullptr;
 static WGPUTextureFormat wgpu_preferred_fmt = WGPUTextureFormat_RGBA8Unorm;
 static WGPUSwapChain     wgpu_swap_chain = nullptr;
-static int               wgpu_swap_chain_width = 0;
-static int               wgpu_swap_chain_height = 0;
+static int               wgpu_swap_chain_width = 1280;
+static int               wgpu_swap_chain_height = 720;
 
 // Forward declarations
-static bool InitWGPU();
+static bool InitWGPU(GLFWwindow* window);
 static void CreateSwapChain(int width, int height);
 
 static void glfw_error_callback(int error, const char* description)
@@ -66,18 +72,19 @@
     // Make sure GLFW does not initialize any graphics context.
     // This needs to be done explicitly later.
     glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
-    GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+WebGPU example", nullptr, nullptr);
+    GLFWwindow* window = glfwCreateWindow(wgpu_swap_chain_width, wgpu_swap_chain_height, "Dear ImGui GLFW+WebGPU example", nullptr, nullptr);
     if (window == nullptr)
         return 1;
 
     // Initialize the WebGPU environment
-    if (!InitWGPU())
+    if (!InitWGPU(window))
     {
         if (window)
             glfwDestroyWindow(window);
         glfwTerminate();
         return 1;
     }
+    CreateSwapChain(wgpu_swap_chain_width, wgpu_swap_chain_height);
     glfwShowWindow(window);
 
     // Setup Dear ImGui context
@@ -115,7 +122,7 @@
     //io.Fonts->AddFontDefault();
 #ifndef IMGUI_DISABLE_FILE_FUNCTIONS
     //io.Fonts->AddFontFromFileTTF("fonts/segoeui.ttf", 18.0f);
-    io.Fonts->AddFontFromFileTTF("fonts/DroidSans.ttf", 16.0f);
+    //io.Fonts->AddFontFromFileTTF("fonts/DroidSans.ttf", 16.0f);
     //io.Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 16.0f);
     //io.Fonts->AddFontFromFileTTF("fonts/Cousine-Regular.ttf", 15.0f);
     //io.Fonts->AddFontFromFileTTF("fonts/ProggyTiny.ttf", 10.0f);
@@ -148,7 +155,7 @@
         // React to changes in screen size
         int width, height;
         glfwGetFramebufferSize((GLFWwindow*)window, &width, &height);
-        if (width != wgpu_swap_chain_width && height != wgpu_swap_chain_height)
+        if (width != wgpu_swap_chain_width || height != wgpu_swap_chain_height)
         {
             ImGui_ImplWGPU_InvalidateDeviceObjects();
             CreateSwapChain(width, height);
@@ -200,6 +207,11 @@
         // Rendering
         ImGui::Render();
 
+#ifndef __EMSCRIPTEN__
+        // Tick needs to be called in Dawn to display validation errors
+        wgpuDeviceTick(wgpu_device);
+#endif
+
         WGPURenderPassColorAttachment color_attachments = {};
         color_attachments.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
         color_attachments.loadOp = WGPULoadOp_Clear;
@@ -223,6 +235,15 @@
         WGPUCommandBuffer cmd_buffer = wgpuCommandEncoderFinish(encoder, &cmd_buffer_desc);
         WGPUQueue queue = wgpuDeviceGetQueue(wgpu_device);
         wgpuQueueSubmit(queue, 1, &cmd_buffer);
+
+#ifndef __EMSCRIPTEN__
+        wgpuSwapChainPresent(wgpu_swap_chain);
+#endif
+
+        wgpuTextureViewRelease(color_attachments.view);
+        wgpuRenderPassEncoderRelease(pass);
+        wgpuCommandEncoderRelease(encoder);
+        wgpuCommandBufferRelease(cmd_buffer);
     }
 #ifdef __EMSCRIPTEN__
     EMSCRIPTEN_MAINLOOP_END;
@@ -239,29 +260,72 @@
     return 0;
 }
 
-static bool InitWGPU()
+#ifndef __EMSCRIPTEN__
+static WGPUAdapter RequestAdapter(WGPUInstance instance)
 {
+    auto onAdapterRequestEnded = [](WGPURequestAdapterStatus status, WGPUAdapter adapter, const char* message, void* pUserData)
+    {
+        if (status == WGPURequestAdapterStatus_Success)
+            *(WGPUAdapter*)(pUserData) = adapter;
+        else
+            printf("Could not get WebGPU adapter: %s\n", message);
+};
+    WGPUAdapter adapter;
+    wgpuInstanceRequestAdapter(instance, nullptr, onAdapterRequestEnded, (void*)&adapter);
+    return adapter;
+}
+
+static WGPUDevice RequestDevice(WGPUAdapter& adapter)
+{
+    auto onDeviceRequestEnded = [](WGPURequestDeviceStatus status, WGPUDevice device, const char* message, void* pUserData)
+    {
+        if (status == WGPURequestDeviceStatus_Success)
+            *(WGPUDevice*)(pUserData) = device;
+        else
+            printf("Could not get WebGPU device: %s\n", message);
+    };
+    WGPUDevice device;
+    wgpuAdapterRequestDevice(adapter, nullptr, onDeviceRequestEnded, (void*)&device);
+    return device;
+}
+#endif
+
+static bool InitWGPU(GLFWwindow* window)
+{
+    wgpu::Instance instance = wgpuCreateInstance(nullptr);
+
+#ifdef __EMSCRIPTEN__
     wgpu_device = emscripten_webgpu_get_device();
     if (!wgpu_device)
         return false;
+#else
+    WGPUAdapter adapter = RequestAdapter(instance.Get());
+    if (!adapter)
+        return false;
+    wgpu_device = RequestDevice(adapter);
+#endif
 
-    wgpuDeviceSetUncapturedErrorCallback(wgpu_device, wgpu_error_callback, nullptr);
-
-    // Use C++ wrapper due to misbehavior in Emscripten.
-    // Some offset computation for wgpuInstanceCreateSurface in JavaScript
-    // seem to be inline with struct alignments in the C++ structure
+#ifdef __EMSCRIPTEN__
     wgpu::SurfaceDescriptorFromCanvasHTMLSelector html_surface_desc = {};
     html_surface_desc.selector = "#canvas";
-
     wgpu::SurfaceDescriptor surface_desc = {};
     surface_desc.nextInChain = &html_surface_desc;
-
-    wgpu::Instance instance = wgpuCreateInstance(nullptr);
     wgpu::Surface surface = instance.CreateSurface(&surface_desc);
+
     wgpu::Adapter adapter = {};
     wgpu_preferred_fmt = (WGPUTextureFormat)surface.GetPreferredFormat(adapter);
+#else
+    wgpu::Surface surface = wgpu::glfw::CreateSurfaceForWindow(instance, window);
+    if (!surface)
+        return false;
+    wgpu_preferred_fmt = WGPUTextureFormat_BGRA8Unorm;
+#endif
+
+    wgpu_instance = instance.MoveToCHandle();
     wgpu_surface = surface.MoveToCHandle();
 
+    wgpuDeviceSetUncapturedErrorCallback(wgpu_device, wgpu_error_callback, nullptr);
+
     return true;
 }
 
diff --git a/examples/example_emscripten_wgpu/web/index.html b/examples/example_glfw_wgpu/web/index.html
similarity index 94%
rename from examples/example_emscripten_wgpu/web/index.html
rename to examples/example_glfw_wgpu/web/index.html
index 82b1c42..a2a91c4 100644
--- a/examples/example_emscripten_wgpu/web/index.html
+++ b/examples/example_glfw_wgpu/web/index.html
@@ -3,7 +3,7 @@
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
-    <title>Dear ImGui Emscripten+WebGPU example</title>
+    <title>Dear ImGui Emscripten+GLFW+WebGPU example</title>
     <style>
         body { margin: 0; background-color: black }
         .emscripten {
@@ -63,6 +63,10 @@
 
       // Initialize the graphics adapter
       {
+          if (!navigator.gpu) {
+            throw Error("WebGPU not supported.");
+          }
+
           const adapter = await navigator.gpu.requestAdapter();
           const device = await adapter.requestDevice();
           Module.preinitializedWebGPUDevice = device;
diff --git a/examples/example_sdl3_sdlrenderer3/main.cpp b/examples/example_sdl3_sdlrenderer3/main.cpp
index 9740054..0f2200a 100644
--- a/examples/example_sdl3_sdlrenderer3/main.cpp
+++ b/examples/example_sdl3_sdlrenderer3/main.cpp
@@ -42,7 +42,7 @@
         printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError());
         return -1;
     }
-    SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
+    SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr, SDL_RENDERER_PRESENTVSYNC);
     if (renderer == nullptr)
     {
         SDL_Log("Error: SDL_CreateRenderer(): %s\n", SDL_GetError());
diff --git a/imgui.cpp b/imgui.cpp
index 1e3cce9..f5a3b5a 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -1,4 +1,4 @@
-// dear imgui, v1.90.5
+// dear imgui, v1.90.6 WIP
 // (main code and documentation)
 
 // Help:
@@ -1042,6 +1042,7 @@
 #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"  // warning: zero as null pointer constant                    // some standard header variations use #define NULL 0
 #pragma clang diagnostic ignored "-Wdouble-promotion"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
 #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"  // warning: implicit conversion from 'xxx' to 'float' may lose precision
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"            // warning: 'xxx' is an unsafe pointer used for buffer access
 #elif defined(__GNUC__)
 // We disable -Wpragmas because GCC doesn't provide a has_warning equivalent and some forks/patches may not follow the warning/version association.
 #pragma GCC diagnostic ignored "-Wpragmas"                  // warning: unknown option after '#pragma GCC diagnostic' kind
@@ -4705,6 +4706,27 @@
     io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;
 }
 
+// Calling SetupDrawListSharedData() is followed by SetCurrentFont() which sets up the remaining data.
+static void SetupDrawListSharedData()
+{
+    ImGuiContext& g = *GImGui;
+    ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
+    for (ImGuiViewportP* viewport : g.Viewports)
+        virtual_space.Add(viewport->GetMainRect());
+    g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4();
+    g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;
+    g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError);
+    g.DrawListSharedData.InitialFlags = ImDrawListFlags_None;
+    if (g.Style.AntiAliasedLines)
+        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines;
+    if (g.Style.AntiAliasedLinesUseTex && !(g.IO.Fonts->Flags & ImFontAtlasFlags_NoBakedLines))
+        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLinesUseTex;
+    if (g.Style.AntiAliasedFill)
+        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill;
+    if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset)
+        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset;
+}
+
 void ImGui::NewFrame()
 {
     IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
@@ -4750,23 +4772,9 @@
     // Setup current font and draw list shared data
     // FIXME-VIEWPORT: the concept of a single ClipRectFullscreen is not ideal!
     g.IO.Fonts->Locked = true;
+    SetupDrawListSharedData();
     SetCurrentFont(GetDefaultFont());
     IM_ASSERT(g.Font->IsLoaded());
-    ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
-    for (ImGuiViewportP* viewport : g.Viewports)
-        virtual_space.Add(viewport->GetMainRect());
-    g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4();
-    g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;
-    g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError);
-    g.DrawListSharedData.InitialFlags = ImDrawListFlags_None;
-    if (g.Style.AntiAliasedLines)
-        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines;
-    if (g.Style.AntiAliasedLinesUseTex && !(g.Font->ContainerAtlas->Flags & ImFontAtlasFlags_NoBakedLines))
-        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLinesUseTex;
-    if (g.Style.AntiAliasedFill)
-        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill;
-    if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset)
-        g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset;
 
     // Mark rendering data as invalid to prevent user who may have a handle on it to use it.
     for (ImGuiViewportP* viewport : g.Viewports)
diff --git a/imgui.h b/imgui.h
index 1476441..d84cd2f 100644
--- a/imgui.h
+++ b/imgui.h
@@ -1,4 +1,4 @@
-// dear imgui, v1.90.5
+// dear imgui, v1.90.6 WIP
 // (headers)
 
 // Help:
@@ -27,8 +27,8 @@
 
 // Library Version
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
-#define IMGUI_VERSION       "1.90.5"
-#define IMGUI_VERSION_NUM   19050
+#define IMGUI_VERSION       "1.90.6 WIP"
+#define IMGUI_VERSION_NUM   19051
 #define IMGUI_HAS_TABLE
 #define IMGUI_HAS_VIEWPORT          // Viewport WIP branch
 #define IMGUI_HAS_DOCK              // Docking WIP branch
@@ -132,6 +132,7 @@
 #pragma clang diagnostic ignored "-Wfloat-equal"                    // warning: comparing floating point with == or != is unsafe
 #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
 #pragma clang diagnostic ignored "-Wreserved-identifier"            // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"            // warning: 'xxx' is an unsafe pointer used for buffer access
 #elif defined(__GNUC__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpragmas"          // warning: unknown option after '#pragma GCC diagnostic' kind
diff --git a/imgui_demo.cpp b/imgui_demo.cpp
index cbbc3c0..2bc8720 100644
--- a/imgui_demo.cpp
+++ b/imgui_demo.cpp
@@ -1,4 +1,4 @@
-// dear imgui, v1.90.5
+// dear imgui, v1.90.6 WIP
 // (demo code)
 
 // Help:
@@ -132,6 +132,7 @@
 #pragma clang diagnostic ignored "-Wdouble-promotion"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
 #pragma clang diagnostic ignored "-Wreserved-id-macro"              // warning: macro name is a reserved identifier
 #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"  // warning: implicit conversion from 'xxx' to 'float' may lose precision
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"            // warning: 'xxx' is an unsafe pointer used for buffer access
 #elif defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wpragmas"                  // warning: unknown option after '#pragma GCC diagnostic' kind
 #pragma GCC diagnostic ignored "-Wint-to-pointer-cast"      // warning: cast to pointer from integer of different size
diff --git a/imgui_draw.cpp b/imgui_draw.cpp
index 648a056..699ed6d 100644
--- a/imgui_draw.cpp
+++ b/imgui_draw.cpp
@@ -1,4 +1,4 @@
-// dear imgui, v1.90.5
+// dear imgui, v1.90.6 WIP
 // (drawing and font code)
 
 /*
@@ -65,6 +65,7 @@
 #pragma clang diagnostic ignored "-Wdouble-promotion"               // warning: implicit conversion from 'float' to 'double' when passing argument to function  // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
 #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"  // warning: implicit conversion from 'xxx' to 'float' may lose precision
 #pragma clang diagnostic ignored "-Wreserved-identifier"            // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"            // warning: 'xxx' is an unsafe pointer used for buffer access
 #elif defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wpragmas"                  // warning: unknown option after '#pragma GCC diagnostic' kind
 #pragma GCC diagnostic ignored "-Wunused-function"          // warning: 'xxxx' defined but not used
@@ -2989,8 +2990,8 @@
         int unscaled_ascent, unscaled_descent, unscaled_line_gap;
         stbtt_GetFontVMetrics(&src_tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);
 
-        const float ascent = ImTrunc(unscaled_ascent * font_scale + ((unscaled_ascent > 0.0f) ? +1 : -1));
-        const float descent = ImTrunc(unscaled_descent * font_scale + ((unscaled_descent > 0.0f) ? +1 : -1));
+        const float ascent = ImCeil(unscaled_ascent * font_scale);
+        const float descent = ImFloor(unscaled_descent * font_scale);
         ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);
         const float font_off_x = cfg.GlyphOffset.x;
         const float font_off_y = cfg.GlyphOffset.y + IM_ROUND(dst_font->Ascent);
@@ -4085,6 +4086,8 @@
             {
                 x = start_x;
                 y += line_height;
+                if (y > clip_rect.w)
+                    break; // break out of main loop
                 word_wrap_eol = NULL;
                 s = CalcWordWrapNextLineStartA(s, text_end); // Wrapping skips upcoming blanks
                 continue;
diff --git a/imgui_internal.h b/imgui_internal.h
index df086e5..e192242 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -1,4 +1,4 @@
-// dear imgui, v1.90.5
+// dear imgui, v1.90.6 WIP
 // (internal structures/api)
 
 // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
@@ -88,6 +88,7 @@
 #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"  // warning: implicit conversion from 'xxx' to 'float' may lose precision
 #pragma clang diagnostic ignored "-Wmissing-noreturn"               // warning: function 'xxx' could be declared with attribute 'noreturn'
 #pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"            // warning: 'xxx' is an unsafe pointer used for buffer access
 #elif defined(__GNUC__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpragmas"                          // warning: unknown option after '#pragma GCC diagnostic' kind
diff --git a/imgui_tables.cpp b/imgui_tables.cpp
index 676c3b4..2999869 100644
--- a/imgui_tables.cpp
+++ b/imgui_tables.cpp
@@ -1,4 +1,4 @@
-// dear imgui, v1.90.5
+// dear imgui, v1.90.6 WIP
 // (tables and columns code)
 
 /*
@@ -228,6 +228,7 @@
 #pragma clang diagnostic ignored "-Wenum-enum-conversion"           // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_')
 #pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
 #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"  // warning: implicit conversion from 'xxx' to 'float' may lose precision
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"            // warning: 'xxx' is an unsafe pointer used for buffer access
 #elif defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wpragmas"                          // warning: unknown option after '#pragma GCC diagnostic' kind
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"                // warning: format not a string literal, format string not checked
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index 8361c5b..2dc6e51 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -1,4 +1,4 @@
-// dear imgui, v1.90.5
+// dear imgui, v1.90.6 WIP
 // (widgets code)
 
 /*
@@ -75,6 +75,7 @@
 #pragma clang diagnostic ignored "-Wenum-enum-conversion"           // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_')
 #pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
 #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"  // warning: implicit conversion from 'xxx' to 'float' may lose precision
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"            // warning: 'xxx' is an unsafe pointer used for buffer access
 #elif defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wpragmas"                          // warning: unknown option after '#pragma GCC diagnostic' kind
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"                // warning: format not a string literal, format string not checked