Skip to content

Conversation

@forkercat
Copy link
Contributor

Description

Hi Christian, thank you for wrapping ImGui in Swift! I am actually using the package in my personal project. Really enjoy it.

This PR is update the version to v1.86. In the version v1.82, I was not able to fix the keyboard issue, so I decided to wrap the latest commit from cimgui and then update the backend files accordingly.

Next step, I plan to update docking branch as well. Would be nice to have it documented in HOWTO.md as well.

Please let me know if you find formatting issues or somewhere you think can be improved. I am new to Swift. Glad to read your code and learn! Thank you.

Detailed Design

1st Commit - Update to 1.86 and update README/HOWTO

After running make update I made these updates to resolve warnings/errors:

  • Update patch_fix_ifdefs.diff to resolve errors
  • Update Exceptions.swift to exclude new unresolved identifiers
  • Add escapingCallbackExceptions in ArgT.swift to avoid adding @escaping to the type ImGuiErrorLogCallback which is actually not a callback function
  • Update FunctionBodyRenderer.swift to suppress warning (dangling pointer) when generating UnsafeMutableBufferPointer. It is needed since after update there is a new usage using this type.

Documentation Updates:

  • Update README.md and HOWTO.md. I think it would be great to include steps about how to wrap more functions.

2nd Commit - Update backend (1.86) to support keyboard/gamepad/clipboard events

I basically followed imgui_impl_osx.mm in imgui 1.86.

  • ImGui_ImplOSX_Init now has NSView as parameter
  • Fix keyboard issue and use kVK_XXX in Carbon
  • Support game controller - I tested it with my Xbox controller 🎮
  • Support clipboard - I tested it
  • Add some access modifiers and re-order classes/functions - I tried to keep it aligned with the Obj-C backend file as it would be easier to compare and make changes

I played around with the demo and I didn't find any issue yet.

Documentation

I updated the README.md and HOWTO.md to include more details.

Documentation and comments from the original Obj-C backend file are kept.

Testing

make lint
make test
make build-release

For wrapping: No errors after make update.
For backends: I tested keyboard/mouse/gamepad/clipboard. All work as expected.

Performance

N/A

Source Impact

No.

Checklist

  • I've read the Contribution Guidelines
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (to the extent possible).
  • I've added benchmarks covering new functionality (if appropriate).
  • I've verified that my change does not break any existing tests or introduce unexpected benchmark regressions.
  • I've updated the documentation (if appropriate).

@forkercat forkercat mentioned this pull request Jan 1, 2022
6 tasks
@ctreffs
Copy link
Owner

ctreffs commented Mar 16, 2022

Hi Junhao,

thank you so much for this perfect PR.
I've not seen this being opened and so just found out about it. I'm very sorry for not merging this sooner!
Great work and thank you for your contribution!

@ctreffs ctreffs self-assigned this Mar 16, 2022
@ctreffs ctreffs added the enhancement New feature or request label Mar 16, 2022
@ctreffs ctreffs merged commit 9a521cb into ctreffs:master Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants