cinder / Cinder

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
http://libcinder.org
Other
5.27k stars 939 forks source link

Fix glitches when using ImGui in an app with multiple windows #2242

Closed totalgee closed 3 years ago

totalgee commented 3 years ago
totalgee commented 3 years ago

Note that there are some other calls to toPixels() in the Cinder ImGui code, e.g. in the various mouse and keyboard Event handlers. These seem to work fine (so I didn't change them, though they could easily be fixed by using event->getWindow()->toPixels()). Presumably the current window is correct in these callbacks, since you're directly interacting with them... (let me know if you want me to change these, too, I initially opted for the minimum fix that corrected my issue ;-) This also seems to be the case with the resize handler, although there we have no direct way to get the window, but it could easily be "fixed" by binding the window in the signal handler, similar to what is done for the update signal handler. Again, let me know if you want that change to be made.

richardeakin commented 3 years ago

Nice find, this fix makes sense to me.

richardeakin commented 3 years ago

I think if it makes sense to you for these other winder->toPixel changes to happen it would be more robust and can review it, though for now happy to merge this.

totalgee commented 3 years ago

I think if it makes sense to you for these other winder->toPixel changes to happen it would be more robust and can review it, though for now happy to merge this.

Okay, I decided to make these changes, since I was in the code, and if I don't do it now I'll forget about it. See #2243 (this one can stay closed). Thanks!