mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-18 01:14:19 +00:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_win32.cpp
This commit is contained in:
commit
5ea96c15cd
13 changed files with 170 additions and 75 deletions
49
imgui.cpp
49
imgui.cpp
|
|
@ -2115,6 +2115,10 @@ void ImFormatStringToTempBuffer(const char** out_buf, const char** out_buf_end,
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
// FIXME: Should rework API toward allowing multiple in-flight temp buffers (easier and safer for caller)
|
||||
// by making the caller acquire a temp buffer token, with either explicit or destructor release, e.g.
|
||||
// ImGuiTempBufferToken token;
|
||||
// ImFormatStringToTempBuffer(token, ...);
|
||||
void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end, const char* fmt, va_list args)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
|
@ -3876,7 +3880,7 @@ void ImGui::Shutdown()
|
|||
g.FontStack.clear();
|
||||
g.OpenPopupStack.clear();
|
||||
g.BeginPopupStack.clear();
|
||||
g.NavTreeNodeStack.clear();
|
||||
g.TreeNodeStack.clear();
|
||||
|
||||
g.CurrentViewport = g.MouseViewport = g.MouseLastHoveredViewport = NULL;
|
||||
g.Viewports.clear_delete();
|
||||
|
|
@ -7627,7 +7631,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||
window->DC.MenuBarAppending = false;
|
||||
window->DC.MenuColumns.Update(style.ItemSpacing.x, window_just_activated_by_user);
|
||||
window->DC.TreeDepth = 0;
|
||||
window->DC.TreeJumpToParentOnPopMask = 0x00;
|
||||
window->DC.TreeHasStackDataDepthMask = 0x00;
|
||||
window->DC.ChildWindows.resize(0);
|
||||
window->DC.StateStorage = &window->StateStorage;
|
||||
window->DC.CurrentColumns = NULL;
|
||||
|
|
@ -12722,7 +12726,7 @@ void ImGui::NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result)
|
|||
}
|
||||
|
||||
// Called by TreePop() to implement ImGuiTreeNodeFlags_NavLeftJumpsBackHere
|
||||
void ImGui::NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, ImGuiNavTreeNodeData* tree_node_data)
|
||||
void ImGui::NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, ImGuiTreeNodeStackData* tree_node_data)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NavMoveScoringItems = false;
|
||||
|
|
@ -19973,11 +19977,18 @@ static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__APPLE__) && defined(TARGET_OS_IPHONE) && !defined(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS)
|
||||
#ifndef IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||
#if defined(__APPLE__) && TARGET_OS_IPHONE
|
||||
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS)
|
||||
#if defined(_WIN32) && defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||||
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||||
#ifdef _WIN32
|
||||
#include <shellapi.h> // ShellExecuteA()
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "shell32")
|
||||
|
|
@ -19986,18 +19997,32 @@ static bool PlatformOpenInShellFn_DefaultImpl(ImGuiContext*, const char* path)
|
|||
{
|
||||
return (INT_PTR)::ShellExecuteA(NULL, "open", path, NULL, NULL, SW_SHOWDEFAULT) > 32;
|
||||
}
|
||||
#elif !defined(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS)
|
||||
#else
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
static bool PlatformOpenInShellFn_DefaultImpl(ImGuiContext*, const char* path)
|
||||
{
|
||||
#if __APPLE__
|
||||
const char* open_executable = "open";
|
||||
#if defined(__APPLE__)
|
||||
const char* args[] { "open", "--", path, NULL };
|
||||
#else
|
||||
const char* open_executable = "xdg-open";
|
||||
const char* args[] { "xdg-open", path, NULL };
|
||||
#endif
|
||||
ImGuiTextBuffer buf;
|
||||
buf.appendf("%s \"%s\"", open_executable, path);
|
||||
return system(buf.c_str()) != -1;
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
return false;
|
||||
if (!pid)
|
||||
{
|
||||
execvp(args[0], const_cast<char **>(args));
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int status;
|
||||
waitpid(pid, &status, 0);
|
||||
return WEXITSTATUS(status) == 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
static bool PlatformOpenInShellFn_DefaultImpl(ImGuiContext*, const char*) { return false; }
|
||||
#endif // Default shell handlers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue