From 456b58377a00fa6c6ed9f6404c3ab998de617883 Mon Sep 17 00:00:00 2001 From: Joshua Minor Date: Wed, 4 Mar 2026 23:21:47 -0800 Subject: [PATCH 1/2] Updated imgui to 1.92.6-docking --- .gitmodules | 2 +- ImGuiColorTextEdit | 2 +- Makefile | 20 ++++--------- imgui | 2 +- main.cpp | 70 +++++++++++++--------------------------------- 5 files changed, 28 insertions(+), 68 deletions(-) diff --git a/.gitmodules b/.gitmodules index 343fb29..e81c525 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "imgui"] path = imgui - url = https://github.com/corentin-plouet/imgui.git + url = https://github.com/ocornut/imgui.git [submodule "ImGuiColorTextEdit"] path = ImGuiColorTextEdit url = https://github.com/BalazsJako/ImGuiColorTextEdit.git diff --git a/ImGuiColorTextEdit b/ImGuiColorTextEdit index 0a88824..ca2f9f1 160000 --- a/ImGuiColorTextEdit +++ b/ImGuiColorTextEdit @@ -1 +1 @@ -Subproject commit 0a88824f7de8d0bd11d8419066caa7d3469395c4 +Subproject commit ca2f9f1462e3b60e56351bc466acda448c5ea50d diff --git a/Makefile b/Makefile index 7bd175d..da2e593 100644 --- a/Makefile +++ b/Makefile @@ -16,26 +16,25 @@ EXE = sql-gui SOURCES = main.cpp -SOURCES += imgui/examples/imgui_impl_sdl.cpp imgui/examples/imgui_impl_opengl3.cpp +SOURCES += imgui/backends/imgui_impl_sdl2.cpp imgui/backends/imgui_impl_opengl3.cpp SOURCES += imgui/imgui.cpp imgui/imgui_demo.cpp imgui/imgui_draw.cpp imgui/imgui_widgets.cpp imgui/imgui_tables.cpp SOURCES += ImGuiColorTextEdit/TextEditor.cpp SOURCES += sqlite/sqlite3.c OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) -CFLAGS = -I./imgui/examples/ -I./imgui/ -I./imgui/backends -I./sqlite +CFLAGS = -I./imgui/ -I./imgui/backends -I./sqlite CFLAGS += -g -Wall -Wformat LIBS = -CXXFLAGS = -std=c++11 $(CFLAGS) +CXXFLAGS = -std=c++17 $(CFLAGS) ##--------------------------------------------------------------------- ## OPENGL LOADER ##--------------------------------------------------------------------- -## Using OpenGL loader: gl3w [default] -SOURCES += imgui/examples/libs/gl3w/GL/gl3w.c -CFLAGS += -Iimgui/examples/libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W +## Using OpenGL loader: imgui's built-in loader (default since 1.91+) +## No external loader needed - imgui_impl_opengl3.cpp includes its own loader. ## Using OpenGL loader: glew ## (This assumes a system-wide installation) @@ -89,21 +88,12 @@ endif %.o:ImGuiColorTextEdit/%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< -%.o:imgui/examples/%.cpp - $(CXX) $(CXXFLAGS) -c -o $@ $< - %.o:imgui/backends/%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< %.o:imgui/%.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< -%.o:imgui/examples/libs/gl3w/GL/%.c - $(CC) $(CFLAGS) -c -o $@ $< - -%.o:imgui/examples/libs/glad/src/%.c - $(CC) $(CFLAGS) -c -o $@ $< - %.o:sqlite/%.c $(CC) $(CFLAGS) -c -o $@ $< diff --git a/imgui b/imgui index e0a7a13..2a1b69f 160000 --- a/imgui +++ b/imgui @@ -1 +1 @@ -Subproject commit e0a7a138e85685512d73d86b8b51d5e86980cd48 +Subproject commit 2a1b69f05748ad909f03acf4533447cac1331611 diff --git a/main.cpp b/main.cpp index f5a1087..d931203 100644 --- a/main.cpp +++ b/main.cpp @@ -1,38 +1,20 @@ // dear imgui: standalone example application for SDL2 + OpenGL // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. // (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.) -// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.) #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" #include "imgui_impl_opengl3.h" #include #include #include #include "ImGuiColorTextEdit/TextEditor.h" -// About Desktop OpenGL function loaders: -// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers. -// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad). -// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own. -#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) -#include // Initialize with gl3wInit() -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) -#include // Initialize with glewInit() -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) -#include // Initialize with gladLoadGL() -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) -#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors. -#include // Initialize with glbinding::Binding::initialize() -#include -using namespace gl; -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) -#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors. -#include // Initialize with glbinding::initialize() -#include -using namespace gl; +// GL includes are handled by imgui_impl_opengl3_loader.h +#if defined(IMGUI_IMPL_OPENGL_ES2) +#include #else -#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM +#include #endif void DisplayTable(char **result, int rows, int cols) @@ -109,28 +91,6 @@ int main(int argc, char**argv) SDL_GL_MakeCurrent(window, gl_context); SDL_GL_SetSwapInterval(1); // Enable vsync - // Initialize OpenGL loader -#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) - bool err = gl3wInit() != 0; -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) - bool err = glewInit() != GLEW_OK; -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) - bool err = gladLoadGL() == 0; -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) - bool err = false; - glbinding::Binding::initialize(); -#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) - bool err = false; - glbinding::initialize([](const char* name) { return (glbinding::ProcAddress)SDL_GL_GetProcAddress(name); }); -#else - bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization. -#endif - if (err) - { - fprintf(stderr, "Failed to initialize OpenGL loader!\n"); - return 1; - } - // Setup Dear ImGui context IMGUI_CHECKVERSION(); ImGui::CreateContext(); @@ -138,7 +98,6 @@ int main(int argc, char**argv) io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; - io.ConfigFlags |= ImGuiConfigFlags_EnablePowerSavingMode; // Setup Dear ImGui style ImGui::StyleColorsLight(); @@ -214,7 +173,6 @@ int main(int argc, char**argv) // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. - ImGui_ImplSDL2_WaitForEvent(); SDL_Event event; while (SDL_PollEvent(&event)) { @@ -227,7 +185,7 @@ int main(int argc, char**argv) // Start the Dear ImGui frame ImGui_ImplOpenGL3_NewFrame(); - ImGui_ImplSDL2_NewFrame(window); + ImGui_ImplSDL2_NewFrame(); ImGui::NewFrame(); if (show_demo_window) @@ -267,7 +225,7 @@ int main(int argc, char**argv) auto shift = io.KeyShift; auto ctrl = io.ConfigMacOSXBehaviors ? io.KeySuper : io.KeyCtrl; auto alt = io.ConfigMacOSXBehaviors ? io.KeyCtrl : io.KeyAlt; - if (ctrl && !shift && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter), false)) { + if (ctrl && !shift && !alt && ImGui::IsKeyPressed(ImGuiKey_Enter, false)) { do_query = true; } @@ -529,9 +487,21 @@ int main(int argc, char**argv) // Rendering ImGui::Render(); glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); - glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); + glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w); glClear(GL_COLOR_BUFFER_BIT); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); + + // Update and Render additional Platform Windows + // (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere.) + if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) + { + SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow(); + SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext(); + ImGui::UpdatePlatformWindows(); + ImGui::RenderPlatformWindowsDefault(); + SDL_GL_MakeCurrent(backup_current_window, backup_current_context); + } + SDL_GL_SwapWindow(window); } From 56d582fb5e43570fec7d501fbaf02077c13b01b9 Mon Sep 17 00:00:00 2001 From: Joshua Minor Date: Wed, 4 Mar 2026 23:38:05 -0800 Subject: [PATCH 2/2] Update CI actions --- .github/workflows/build.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 47741f2..a5c9a47 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -54,9 +54,9 @@ jobs: # ls -l Linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive @@ -76,16 +76,16 @@ jobs: zip -r sql-gui-linux.zip sql-gui fonts - name: Archive Product - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: - name: sql-gui-linux.zip + name: sql-gui-linux path: sql-gui-linux.zip MacOS: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive @@ -104,9 +104,9 @@ jobs: zip -r sql-gui-mac.zip sql-gui fonts - name: Archive Product - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: - name: sql-gui-mac.zip + name: sql-gui-mac path: sql-gui-mac.zip # Emscripten: