latest imgui breaks the CinderBlock (SetClipboardTextFn, GetClipboardTextFn)
q-depot opened this issue · comments
Hi Simon,
I've pulled the latest imgui subrepo and it doesn't compile anymore, I think the ImGui syntax for SetClipboardTextFn and GetClipboardTextFn have changed adding an extra "void* user_data" argument.
I've updated the Cinder-ImGui code and it does compile, but I'm not sure how the clipboard works so I didn't submit a pull request or tested anything, you might want to double check it.
CinderImGui.cpp #1004
#ifndef CINDER_LINUX
// clipboard callbacks
io.SetClipboardTextFn = []( void* user_data, const char* text ){
const char* text_end = text + strlen(text);
char* buf = (char*)malloc(text_end - text + 1);
memcpy(buf, text, text_end-text);
buf[text_end-text] = '\0';
Clipboard::setString( buf );
free(buf);
};
io.GetClipboardTextFn = []( void* user_data ){
string str = Clipboard::getString();
static vector<char> strCopy;
strCopy = vector<char>(str.begin(), str.end());
strCopy.push_back('\0');
return (const char *) &strCopy[0];
};
#endif```
same problem here
the code above should fix it
Thanks Andrea, I'll look into that asap!
you can find a commit here to fix the issue
q-depot@ef9772f