Skip to content

Commit

Permalink
sokol_imgui.h: update for Dear ImGui 1.91.1 (fixed #1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Sep 10, 2024
1 parent 9018678 commit 1eb96dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Updates

### 10-Sep-2024

- Update sokol_imgui.h for Dear ImGui and cimgui version 1.91.1. This
breaks compatibility with older ImGui versions.
Fixes issue https://github.com/floooh/sokol/issues/1105.

### 02-Sep-2024

- Minor breaking change in sokol_gfx.h: The enum item `SG_FILTER_NONE` has been
Expand Down
14 changes: 8 additions & 6 deletions util/sokol_imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1844,13 +1844,13 @@ static const char* _simgui_fs_source_dummy = "";
#endif

#if !defined(SOKOL_IMGUI_NO_SOKOL_APP)
static void _simgui_set_clipboard(void* user_data, const char* text) {
(void)user_data;
static void _simgui_set_clipboard(ImGuiContext* ctx, const char* text) {
(void)ctx;
sapp_set_clipboard_string(text);
}

static const char* _simgui_get_clipboard(void* user_data) {
(void)user_data;
static const char* _simgui_get_clipboard(ImGuiContext* ctx) {
(void)ctx;
return sapp_get_clipboard_string();
}
#endif
Expand Down Expand Up @@ -2200,13 +2200,15 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) {
ImGui::CreateContext();
ImGui::StyleColorsDark();
ImGuiIO* io = &ImGui::GetIO();
ImGuiPlatformIO* pio = &ImGui::GetPlatformIO();
if (!_simgui.desc.no_default_font) {
io->Fonts->AddFontDefault();
}
#else
igCreateContext(NULL);
igStyleColorsDark(igGetStyle());
ImGuiIO* io = igGetIO();
ImGuiPlatformIO* pio = igGetPlatformIO();
if (!_simgui.desc.no_default_font) {
ImFontAtlas_AddFontDefault(io->Fonts, NULL);
}
Expand All @@ -2218,8 +2220,8 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) {
if (!_simgui.desc.disable_set_mouse_cursor) {
io->BackendFlags |= ImGuiBackendFlags_HasMouseCursors;
}
io->SetClipboardTextFn = _simgui_set_clipboard;
io->GetClipboardTextFn = _simgui_get_clipboard;
pio->Platform_SetClipboardTextFn = _simgui_set_clipboard;
pio->Platform_GetClipboardTextFn = _simgui_get_clipboard;
#endif
io->ConfigWindowsResizeFromEdges = !_simgui.desc.disable_windows_resize_from_edges;

Expand Down

0 comments on commit 1eb96dd

Please sign in to comment.