From 5691385a33dc359acb2fa74267d96a6bac85c924 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 20 Dec 2018 11:41:24 +0100 Subject: [PATCH] IO: Added BackendPlatformUserData, BackendRendererUserData, BackendLanguageUserData void* for storage use by back-ends. (#2004 + for cimgui) --- docs/CHANGELOG.txt | 1 + imgui.cpp | 1 + imgui.h | 11 +++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index edf16b603..350743cd1 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -60,6 +60,7 @@ Other Changes: This affects clamping window within the visible area: with this option enabled title bars need to be visible. (#899) - Window: Fixed using SetNextWindowPos() on a child window (which wasn't really documented) position the cursor as expected in the parent window, so there is no mismatch between the layout in parent and the position of the child window. +- IO: Added BackendPlatformUserData, BackendRendererUserData, BackendLanguageUserData void* for storage use by back-ends. - Style: Tweaked default value of style.DisplayWindowPadding from (20,20) to (19,19) so the default style as a value which is the same as the title bar height. - Demo: "Simple Layout" and "Style Editor" are now using tabs. diff --git a/imgui.cpp b/imgui.cpp index 1ec4a27a8..2aa675b49 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1111,6 +1111,7 @@ ImGuiIO::ImGuiIO() // Platform Functions BackendPlatformName = BackendRendererName = NULL; + BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL; GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; ClipboardUserData = NULL; diff --git a/imgui.h b/imgui.h index 431646b8f..dfe7cc752 100644 --- a/imgui.h +++ b/imgui.h @@ -1240,9 +1240,12 @@ struct ImGuiIO // (the imgui_impl_xxxx back-end files are setting those up for you) //------------------------------------------------------------------ - // Optional: Platform/Renderer back-end name (informational only! will be displayed in About Window) - const char* BackendPlatformName; - const char* BackendRendererName; + // Optional: Platform/Renderer back-end name (informational only! will be displayed in About Window) + User data for back-end/wrappers to store their own stuff. + const char* BackendPlatformName; // = NULL + const char* BackendRendererName; // = NULL + void* BackendPlatformUserData; // = NULL + void* BackendRendererUserData; // = NULL + void* BackendLanguageUserData; // = NULL // Optional: Access OS clipboard // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) @@ -1253,7 +1256,7 @@ struct ImGuiIO // 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) // (default to use native imm32 api on Windows) void (*ImeSetInputScreenPosFn)(int x, int y); - void* ImeWindowHandle; // (Windows) Set this to your HWND to get automatic IME cursor positioning. + void* ImeWindowHandle; // (Windows) Set this to your HWND to get automatic IME cursor positioning. #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // [OBSOLETE since 1.60+] Rendering function, will be automatically called in Render(). Please call your rendering function yourself now!