Comments (5)
The easiest route would be to save and restore the clipboard functions before/after the backend initialization. IE:
auto defaultSetClipboardTextFn = io.SetClipboardTextFn;
auto defaultGetClipboardTextFn = io.GetClipboardTextFn;
auto defaultClipboardUserData = io.ClipboardUserData;
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
io.SetClipboardTextFn = defaultSetClipboardTextFn;
io.GetClipboardTextFn = defaultGetClipboardTextFn;
io.ClipboardUserData = defaultClipboardUserData;
from imgui.
The easiest route would be to save and restore the clipboard functions before/after the backend initialization. IE:
auto defaultSetClipboardTextFn = io.SetClipboardTextFn; auto defaultGetClipboardTextFn = io.GetClipboardTextFn; ImGui_ImplSDL2_InitForOpenGL(window, gl_context); io.SetClipboardTextFn = defaultSetClipboardTextFn; io.GetClipboardTextFn = defaultGetClipboardTextFn;
That is actually a clever solution, how didn't I think of that. Thank you!
I'll keep the issue open for a bit, in case someone comments with a direct way to get the default clipboard implementation.
EDIT:
For this solution to work correctly, one needs to set the ClipboardUserData as well, since it is set to nullptr in the SDL2 implementation, thus ImGui throws an exception when reading the clipboard by trying to clear the nullptr.
Amended solution that works for me:
auto defaultSetClipboardTextFn = io.SetClipboardTextFn;
auto defaultGetClipboardTextFn = io.GetClipboardTextFn;
auto defaultClipboardUserData = io.ClipboardUserData;
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
io.SetClipboardTextFn = defaultSetClipboardTextFn;
io.GetClipboardTextFn = defaultGetClipboardTextFn;
io.ClipboardUserData = defaultClipboardUserData;
from imgui.
ClipboardUserData
Oops yeah, that's my bad. Sorry about that! 😅
from imgui.
Also make sure that what you perceive as hanging isn’t some kind of symbol loading performed by the debugger (in which case you may set it up to lazily load symbols on crash only).
from imgui.
Also make sure that what you perceive as hanging isn’t some kind of symbol loading performed by the debugger (in which case you may set it up to lazily load symbols on crash only).
Thanks for your input, ocornut!
It wasn't a debuggers fault, as the same hanging is happening when manually running the binary compiled in release mode. In addition, the freezing happens every time the clipboard is accessed, not just the first time after running the program.
Assuming there is no intended way to explicitly access the default clipboard implementation and there is a work-around that I'm happy with, I'll close the issue as resolved 👍
from imgui.
Related Issues (20)
- Dummy does not respect SetNextItemAllowOverlap HOT 2
- Cancelling of touchpad double-tap dragging by keyboard gets lost HOT 4
- Edit ImGui's Window Title to add a button HOT 1
- HiDPI with Emscripten and GLFW
- ImGui not using the entire screen surface with Android NDK HOT 2
- Windows + V doesn't paste value using SDL HOT 4
- DragFloat: incorrect work of clamp value, when we set it by ctrl+click HOT 1
- Strange endian behaviour causing ImU32 colors to be flipped HOT 5
- How to know why glad failed to load. HOT 1
- Can't hide "Hide tab bar" button when window is in dock HOT 8
- implot breaks on IMGUI_DEFINE_MATH_OPERATORS HOT 4
- Dealing with the glfw window HOT 4
- Issue with ImGui_ImplMetal_Shutdown - Crashes inside ImGui_ImplMetal_DestroyFontsTexture HOT 2
- no payload received for std::string HOT 7
- OpenGL backend + OpenCascades: black screen is shown. HOT 4
- Dynamic Error Modals - spawning them with runtime errors - handling their return values HOT 8
- Mouse position issue HOT 5
- Weird behaviour when setting ImGuiStyle::Alpha before ImGui::Begin when docked HOT 2
- Slight lag on opening comboboxes HOT 8
- Lag when changing mouse cursor (was: lag hovering over text inputs) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.