User pointer for callbacks? #875

Closed
opened 2016-10-15 01:05:02 +00:00 by zeyonaut · 2 comments
zeyonaut commented 2016-10-15 01:05:02 +00:00 (Migrated from github.com)

As you are pursuing multi-context, it would be useful to be able to set a pointer to user data when setting up the callbacks, similar to how GLFW does it. For example,

io.SetClipboardTextFn = [](const char* text)
    {
        glfwSetClipboardString(g_Window, text);
    };

The window must be a global variable in this case, but if a context specific pointer was given back, then an instance-local window could be passed in. Is this a feature you would be interested in implementing?

As you are pursuing multi-context, it would be useful to be able to set a pointer to user data when setting up the callbacks, similar to how GLFW does it. For example, ``` io.SetClipboardTextFn = [](const char* text) { glfwSetClipboardString(g_Window, text); }; ``` The window must be a global variable in this case, but if a context specific pointer was given back, then an instance-local window could be passed in. Is this a feature you would be interested in implementing?
ocornut commented 2016-10-15 08:40:39 +00:00 (Migrated from github.com)

I agree it would be a useful change. It'll be a breaking change but not everybody override it and breakage will be trivial so I think I'll just go for it.

I agree it would be a useful change. It'll be a breaking change but not everybody override it and breakage will be trivial so I think I'll just go for it.
ocornut commented 2016-10-15 09:37:23 +00:00 (Migrated from github.com)

Done

Done
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#875
No description provided.