Skip to content

Commit 4823cc1

Browse files
committed
[Bundle] ImGuiPlatformIO::Platform_Get/Set/ClipboardTextFn, Platform_OpenInShellFn published via HybridCallback
1 parent d725b07 commit 4823cc1

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

imgui.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11023,7 +11023,8 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
1102311023
IM_ASSERT(g.IO.ConfigErrorRecoveryEnableAssert || g.IO.ConfigErrorRecoveryEnableDebugLog || g.IO.ConfigErrorRecoveryEnableTooltip || g.ErrorCallback != NULL);
1102411024

1102511025
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
11026-
// Remap legacy names
11026+
#ifndef IMGUI_BUNDLE_PYTHON_API
11027+
// Remao legacy names
1102711028
if (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos)
1102811029
{
1102911030
g.IO.ConfigNavMoveSetMousePos = true;
@@ -11040,6 +11041,7 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
1104011041
g.PlatformIO.Platform_GetClipboardTextFn = [](ImGuiContext* ctx) { return ctx->IO.GetClipboardTextFn(ctx->IO.ClipboardUserData); };
1104111042
if (g.IO.SetClipboardTextFn != NULL && (g.PlatformIO.Platform_SetClipboardTextFn == NULL || g.PlatformIO.Platform_SetClipboardTextFn == Platform_SetClipboardTextFn_DefaultImpl))
1104211043
g.PlatformIO.Platform_SetClipboardTextFn = [](ImGuiContext* ctx, const char* text) { return ctx->IO.SetClipboardTextFn(ctx->IO.ClipboardUserData, text); };
11044+
#endif
1104311045
#endif
1104411046

1104511047
// 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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4199,13 +4199,20 @@ struct ImGuiPlatformIO
41994199

42004200
// Optional: Access OS clipboard
42014201
// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
4202-
const char* (*Platform_GetClipboardTextFn)(ImGuiContext* ctx);
4203-
void (*Platform_SetClipboardTextFn)(ImGuiContext* ctx, const char* text);
4202+
// [ADAPT_IMGUI_BUNDLE]
4203+
// const char* (*Platform_GetClipboardTextFn)(ImGuiContext* ctx);
4204+
// void (*Platform_SetClipboardTextFn)(ImGuiContext* ctx, const char* text);
4205+
BundleHybridCallback<BundleHybridStr(ImGuiContext*)> Platform_GetClipboardTextFn;
4206+
BundleHybridCallback<void(ImGuiContext*, const char*)> Platform_SetClipboardTextFn;
4207+
// [/ADAPT_IMGUI_BUNDLE]
42044208
void* Platform_ClipboardUserData;
42054209

42064210
// Optional: Open link/folder/file in OS Shell
42074211
// (default to use ShellExecuteW() on Windows, system() on Linux/Mac)
4208-
bool (*Platform_OpenInShellFn)(ImGuiContext* ctx, const char* path);
4212+
// [ADAPT_IMGUI_BUNDLE]
4213+
//bool (*Platform_OpenInShellFn)(ImGuiContext* ctx, const char* path);
4214+
BundleHybridCallback<bool(ImGuiContext*, const char*)> Platform_OpenInShellFn;
4215+
// [/ADAPT_IMGUI_BUNDLE]
42094216
void* Platform_OpenInShellUserData;
42104217

42114218
// 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)