Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[contrib.glfw3] New version 3.4.0.20240817 #22395

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

ypujante
Copy link
Contributor

@ypujante ypujante commented Aug 18, 2024

Release notes:

  • Major clipboard changes: the clipboard now uses the browser events to handle cut, copy and paste
  • Added a way to tweak the timeouts for the Super + Key workaround (Super is also known as Meta or Cmd)
  • Added a way to set which keys are allowed to be handled by the browser
  • Added a convenient API to open a URL (emscripten::glfw3::OpenURL)
  • Added a convenient API to detect if the runtime platform is Apple (emscripten::glfw3::IsRuntimePlatformApple),
    mostly used for keyboard shortcuts (Ctrl vs. Cmd).
  • Added GLFW/emscripten_glfw3_version.h with EMSCRIPTEN_GLFW_VERSION define for compilation time version detection
  • EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 port define now also contains the version

Warning

Breaking changes!
The clipboard async API has been removed.
Check the Clipboard support section for details on how to deal with the clipboard in your application.

@sbc100
Copy link
Collaborator

sbc100 commented Aug 21, 2024

Does it really make sense to add misc new function such as OpenURL and IsRuntimePlatformApple to the glfw library?

Why not stick to the GLFW API and put those APIs in another library?

@ypujante
Copy link
Contributor Author

@sbc100 thank you for providing feedback.

glfw already has the concept of platform but it is a compile time concept because it is meant to be compiled and run on a given platform. I absolutely need the concept of runtime platform for the internals of the library so I just expose it because it is being needed by other libraries (ex: ImGui which now supports emscripten-glfw).

For openurl it uses a deferred click approach which is also already implemented in the libraries. So it is trivial to add as well.

These functions are in their own headers and you don't have to use if you don't want to. It is not changing the glfw API in any shape or form.

Am I supposed to create a brand new library for 2 completely unrelated functions and add a new contrib port for them? I don't think that would even be accepted and even if it was, honestly I don't want to go down this route given the amount of work/maintenance...

@sbc100
Copy link
Collaborator

sbc100 commented Aug 21, 2024

i just don't see how those function are related to GLFW itself. They just seem like misc unrelated functions. I can't stop you from developing your library however you want, but its seems like its evolving from a port of glfw to something more than that.

@sbc100
Copy link
Collaborator

sbc100 commented Aug 21, 2024

Perhaps those two new function could live in emscripten itself?

@ypujante
Copy link
Contributor Author

i just don't see how those function are related to GLFW itself. They just seem like misc unrelated functions. I can't stop you from developing your library however you want, but its seems like its evolving from a port of glfw to something more than that.

Like I said I do appreciate your feedback and input. At this time I would like to proceed with these changes. I am waiting for these to submit a PR on ImGui to add full support for clipboard using my library (library_glfw.js has no support whatsoever for clipboard and SDL has only library support for clipboard, meaning you cannot copy/paste with another application... which makes my library the only emscripten library with full clipboard support... and this change requires to know the runtime platform).

ImGui::GetIO().ConfigMacOSXBehaviors = emscripten::glfw3::IsRuntimePlatformApple();

FWIW, SDL offers an SDL_OpenURL api and I believe I would not be surprised if GLFW 3.5 adds it as well.

Thanks

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I guess the point of the contrib ports is so that you can forge your own way.

I would like you to consider those functions for inclusion upstream somehow though so others (who don't use glfw) could also benefit (assuming they are useful APIs to have).

@sbc100 sbc100 merged commit 5583c90 into emscripten-core:main Aug 21, 2024
27 checks passed
@ypujante
Copy link
Contributor Author

@sbc100

Well I guess the point of the contrib ports is so that you can forge your own way.

This is true, but I do genuinely appreciate your feedback and point of view. Having somebody external offer their perspective is always valuable. I am definitely not planning to turn emscripten-glfw into a bag of random unrelated functions.

I would like you to consider those functions for inclusion upstream somehow though so others (who don't use glfw) could also benefit (assuming they are useful APIs to have).

That is a fair point. I can take a look at providing similar APIs with library_html5.js if you think that would be the right place for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants