-
Notifications
You must be signed in to change notification settings - Fork 182
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
Make the package go-gettable. #83
Conversation
The cgo to Go type conversion in `goDropCB` is unfinished and needs to be improved.
Add glfwSetCharModsCallback() support.
changelog updated
Use more idiomatic style for comments, which includes a space after the //. See https://code.google.com/p/go-wiki/wiki/CodeReviewComments#Comment_Senten ces. Remove references to LockOSThread Wiki example; simply mention runtime.LockOSThread() in README instead. Other than docs, there are no code or behavior changes.
Fix missing runtime.LockOSThread() in example code.
Improve documentation style slightly.
Closes #74.
Removed explanation already exists in README
Go style acronyms
Thanks for doing this work and discovery. Small note, you're missing one commit from devel_glfw3.1 branch, since my fork didn't have it.
Given the big nature of this change, let's give it at least 3+ days before merging. That will give everyone a chance to think it over, provide feedback, etc. I'll want to learn more about what it will take to update to newer revisions of GLFW. Would there be any reason to keep the current style wrapper-only available? |
Done.
Of course, I don't intend to rush anything, just to get the ball rollin' =).
Would you be able to elaborate on what you mean here?
Here are reasons that come to mind for me:
|
Currently, the added GLFW source is revision 5d525c4, which at this time is the latest. Suppose a week later new commits are pushed and I'd like to add that to a glfw3 with 5d525c4. How would I do that. That's what I want to try/learn more about. Perhaps make a Makefile or bash script, etc. |
I see, that makes sense. This seems to work for me:
I've tested it with actual changes to GLFW's sources in my own repository and it works good. I don't care about the bash script or not -- but if you want I can certainly add one to do the above (or something else?). |
That's great, thanks. No need for a script at this time. |
I still need to test this. Rather large change and I'm not sure about having to maintain our own GLFW source. Just a quick look at the code: Why not merge all darwin.go files? EDIT: Why do we have 3.1 changes on this PR? |
IMO the advantages of using the current 3.1 with many improvements, bug fixes, but a few remaining known issues outweigh using the older 3.0.4 that does not have many of 3.1's improvements and bug fixes. However, I understand the desire to use the latest GLFW may not be acceptable for everyone's needs. What about following Chrome's idea of having channels. We could have glfw3 stable, which follows official GLFW releases, and something like glfw3-dev that is updated more often. |
It's better to separate API breaking changes like in 3.1 and this. This is a change that can be useful for both master and devel. In the end we will tag master as "3.0" so that people can continue using it. If this change is useful it should exist in "3.0" also that's why I think the better method is to create a separate PR for master and then rebase devel. Most definitely we should not use an unstable GFLW version for our stable go package. |
Branches are not go-gettable, that's why my proposal is to have a distinct repo with that devel branch. |
How many people need to "go get" devel branch? Most people should use stable anyway. |
C files can have multiple functions declared with the same exact name. C has no concept of namespaces and these functions would collide and cause the C compiler to give you an error. For this reason people declare static functions throughout their code -- static functions can have the same name but they must exist in separate object files or else they will collide. Most C programmers (including GLFW's source throughout) use this practice and this is why they need to be in separate files.
@shurcooL made the 3.1 changes already and I didn't want to write this against old code that would be gone in a short time. I understand the desire to wait to merge this until GLFW 3.1 is officially released though, and we can certainly do that. I don't really have a preference as to whether the branches are go-gettable or not. The stable branch gets API-incompatible changes whenever a new GLFW version is released anyway -- so people will probably just go the vendoring route anyway IMHO. |
// glfw.c
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
#include "glfw/src/xkb_unicode.c"
#include "glfw/src/linux_joystick.c"
#include "glfw/src/posix_time.c"
#endif
#if defined(_GLFW_COCOA) || defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
#include "glfw/src/posix_tls.c"
#endif
#ifdef _GLFW_EGL
#include "glfw/src/egl_context.c"
#endif
#ifdef _GLFW_GLX
#include "glfw/src/glx_context.c"
#endif
#ifdef _GLFW_COCOA
#include "glfw/src/mach_time.c"
#endif
#ifdef _GLFW_WGL
#include "glfw/src/wgl_context.c"
#endif
#ifdef _GLFW_WIN32
#include "glfw/src/win32_clipboard.c"
#include "glfw/src/win32_init.c"
#include "glfw/src/win32_monitor.c"
#include "glfw/src/win32_time.c"
#include "glfw/src/win32_tls.c"
#include "glfw/src/win32_window.c"
#include "glfw/src/winmm_joystick.c"
#endif
#ifdef _GLFW_WAYLAND
#include "glfw/src/wl_clipboard.c"
#include "glfw/src/wl_init.c"
#include "glfw/src/wl_monitor.c"
#include "glfw/src/wl_window.c"
#endif
#ifdef _GLFW_X11
#include "glfw/src/x11_clipboard.c"
#include "glfw/src/x11_init.c"
#include "glfw/src/x11_monitor.c"
#include "glfw/src/x11_window.c"
#endif
#include "glfw/src/clipboard.c"
#include "glfw/src/context.c"
#include "glfw/src/init.c"
#include "glfw/src/input.c"
#include "glfw/src/joystick.c"
#include "glfw/src/monitor.c"
#include "glfw/src/time.c"
#include "glfw/src/window.c" I was not talking about the actual GLFW source but the shim files that start with "glfw_". |
Also this would be more organized as well: // cocoa_darwin.go
package glfw3
/*
#cgo CFLAGS: -x objective-c
#ifdef _GLFW_COCOA
#include "glfw/src/cocoa_clipboard.m"
#include "glfw/src/cocoa_init.m"
#include "glfw/src/cocoa_monitor.m"
#include "glfw/src/cocoa_window.m"
#include "glfw/src/iokit_joystick.m"
#include "glfw/src/nsgl_context.m"
#endif
*/
import "C" |
I am not talking about the sources. I am talking about the many glfw_foo_bar.c shim files in the root directory. The C code you pasted above produces the following errors on Linux:
This is because on Linux there are two statically declared |
I see. Any reason to separate cocoa*_darwin.go files though? I'm OK with merging this change as long as we keep the master branch in sync with stable GLFW. So I would really have these changes commit against master with GLFW 3.0.4 source included in the tree (glfw/glfw@eab31f2) Then we can have devel rebased to master and update the GLFW source to latest revision in git. |
I don't know enough about Objective-C to know for certain -- but just looking at this Apple page makes me think it may be a near-identical situation. Aside from that, I only argue for consistency reasons. |
Yeah, I agree. I think go-gl can host the stable version and one of our personal github accounts can host a devel version. But I'm okay with waiting for 3.1 to merge this PR into go-gl/glfw3. It can be merged into the 3.1 devel branch before then. |
I've made a new PR to merge this into the 3.1 development branch, please see #84. |
A lot of discussion took place in #82, lets move it to here now.
@shurcooL can you verify if the update of the GLFW sources (to the revision mentioned in the changelog) slimsag@0b95038 still works on OS X?
I can confirm that building on windows/amd64 and linux/amd64 works A-OK.
I do not have a freebsd machine, and I also do not have a machine with Wayland installed (
go get -tags "wayland" github.com/slimsag/glfw3
).Does anyone have comments/concerns/etc regarding this proposal?
Note that this includes @shurcooL's GLFW 3.1 changes.