Skip to content

Commit f113c20

Browse files
committed
[Bundle] ImGuiPlatformIO::Platform_Get/Set/ClipboardTextFn, Platform_OpenInShellFn published via HybridCallback
1 parent 30914bc commit f113c20

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

imgui.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -11073,7 +11073,8 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
1107311073
IM_ASSERT(g.IO.ConfigErrorRecoveryEnableAssert || g.IO.ConfigErrorRecoveryEnableDebugLog || g.IO.ConfigErrorRecoveryEnableTooltip || g.ErrorCallback != NULL);
1107411074

1107511075
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
11076-
// Remap legacy names
11076+
#ifndef IMGUI_BUNDLE_PYTHON_API
11077+
// Remao legacy names
1107711078
if (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos)
1107811079
{
1107911080
g.IO.ConfigNavMoveSetMousePos = true;
@@ -11090,6 +11091,7 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
1109011091
g.PlatformIO.Platform_GetClipboardTextFn = [](ImGuiContext* ctx) { return ctx->IO.GetClipboardTextFn(ctx->IO.ClipboardUserData); };
1109111092
if (g.IO.SetClipboardTextFn != NULL && (g.PlatformIO.Platform_SetClipboardTextFn == NULL || g.PlatformIO.Platform_SetClipboardTextFn == Platform_SetClipboardTextFn_DefaultImpl))
1109211093
g.PlatformIO.Platform_SetClipboardTextFn = [](ImGuiContext* ctx, const char* text) { return ctx->IO.SetClipboardTextFn(ctx->IO.ClipboardUserData, text); };
11094+
#endif
1109311095
#endif
1109411096

1109511097
// Perform simple check: error if Docking or Viewport are enabled _exactly_ on frame 1 (instead of frame 0 or later), which is a common error leading to loss of .ini data.

imgui.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -4247,13 +4247,20 @@ struct ImGuiPlatformIO
42474247

42484248
// Optional: Access OS clipboard
42494249
// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
4250-
const char* (*Platform_GetClipboardTextFn)(ImGuiContext* ctx);
4251-
void (*Platform_SetClipboardTextFn)(ImGuiContext* ctx, const char* text);
4250+
// [ADAPT_IMGUI_BUNDLE]
4251+
// const char* (*Platform_GetClipboardTextFn)(ImGuiContext* ctx);
4252+
// void (*Platform_SetClipboardTextFn)(ImGuiContext* ctx, const char* text);
4253+
BundleHybridCallback<BundleHybridStr(ImGuiContext*)> Platform_GetClipboardTextFn;
4254+
BundleHybridCallback<void(ImGuiContext*, const char*)> Platform_SetClipboardTextFn;
4255+
// [/ADAPT_IMGUI_BUNDLE]
42524256
void* Platform_ClipboardUserData;
42534257

42544258
// Optional: Open link/folder/file in OS Shell
42554259
// (default to use ShellExecuteW() on Windows, system() on Linux/Mac)
4256-
bool (*Platform_OpenInShellFn)(ImGuiContext* ctx, const char* path);
4260+
// [ADAPT_IMGUI_BUNDLE]
4261+
//bool (*Platform_OpenInShellFn)(ImGuiContext* ctx, const char* path);
4262+
BundleHybridCallback<bool(ImGuiContext*, const char*)> Platform_OpenInShellFn;
4263+
// [/ADAPT_IMGUI_BUNDLE]
42574264
void* Platform_OpenInShellUserData;
42584265

42594266
// Optional: Notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME on Windows)

0 commit comments

Comments
 (0)