Commit graph

292 commits

Author SHA1 Message Date
InKryption
c95bc37306 glfw: make comment into doc comment 2021-11-23 12:12:55 -07:00
InKryption
77eeadd407 glfw: update possible errors comment
Add 'FormatUnavailable' as a possible error to the 'getClipboardString' comment, which can set it on wayland
2021-11-23 11:07:14 -07:00
InKryption
6127fa267f glfw: re-instate prong
Bring back the 'c.GLFW_NOT_INITIALIZED' prong in 'convertError', such that if it is ever passed that error code, we can differentiate it from just an invalid input; because it is a valid input, we just guarantee that it won't occur.
2021-11-23 11:06:19 -07:00
InKryption
b35a7b4fad glfw: Change error unions into normal returns, in accordance with the new guarantee to never encounter 'GLFW_NOT_INITIALIZED', and update tests 2021-11-22 12:59:11 -07:00
InKryption
88e0d37325 glfw: enum-ify 'Joystick.jid', set 'InvalidEnum' as unreachable, and run zig fmt 2021-11-22 12:59:11 -07:00
InKryption
aae3ea8577 constify unmutated variables in build files 2021-11-22 12:59:11 -07:00
InKryption
d9e2505b59 glfw: amend and update various TODOs pertaining to force-init changes 2021-11-22 12:59:11 -07:00
InKryption
da392d89a7 glfw: assert initialized in proc address getter functions 2021-11-22 12:59:11 -07:00
InKryption
43b2502e3a glfw: fix for getClipboardString reaching unreachable prong on linux CI 2021-11-22 12:59:11 -07:00
InKryption
ef7ada052c glfw: Revert error denormalization 2021-11-22 12:59:11 -07:00
InKryption
44fee8f1f1 glfw: force init error type work around 2021-11-22 12:59:11 -07:00
InKryption
9f241b5109 glfw: Remove 'NotInitialized' error 2021-11-22 12:59:11 -07:00
InKryption
42f0d15584 glfw: force init in Window.zig 2021-11-22 12:59:11 -07:00
InKryption
76d2b8ad9f glfw: force init in vulkan.zig 2021-11-22 12:59:11 -07:00
InKryption
4e22d5811e glfw: force init in time.zig 2021-11-22 12:59:11 -07:00
InKryption
1c33e85af3 glfw: force init in opengl.zig 2021-11-22 12:59:11 -07:00
InKryption
fb115b79e5 glfw: force init in Monitor.zig 2021-11-22 12:59:11 -07:00
InKryption
526bff1d5b glfw: force init in Joystick.zig 2021-11-22 12:59:11 -07:00
InKryption
c90f879709 glfw: force init in key.zig 2021-11-22 12:59:11 -07:00
InKryption
c6310dc377 glfw: force init in main.zig 2021-11-22 12:59:11 -07:00
InKryption
de1e6391c6 glfw: force init in Cursor.zig 2021-11-22 12:59:11 -07:00
InKryption
fba8bb1cb2 glfw: force init in clipboard.zig 2021-11-22 12:59:11 -07:00
InKryption
400e86888b glfw: force init before using init dependent functions 2021-11-22 12:59:11 -07:00
Stephen Gutekanst
7d47233d7a glfw: patch GLFW sources to workaround a bug where Zig and Mach C headers conflict
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-21 12:31:55 -07:00
Stephen Gutekanst
ae39a840e8 glfw: update system_sdk to use latest MacOS 12.0 SDK
Updates us to using the newer SDK https://github.com/hexops/sdk-macos-12.0

Also enables cross-compilation of the `mach/gpu` backend for macOS.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-21 12:31:55 -07:00
InKryption
3e0bf00015
glfw: window hint default values parity test with attributes (#81)
* glfw: window hint default values parity test with attributes
* glfw: add test-mode-only variable that controls whether to set or ignore the `Window.Hints` struct passed to `Window.create`, and inline `failedToCreateWindow`
* glfw: include `context_no_error` hint/attribute in test with comment, fix oversight in `create` concerning the `defer defaultHints()` statement

Co-authored-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>
2021-11-20 12:42:52 -07:00
InKryption
e024ced541 glfw: further reorganize Window.Attrib to match with Window.Hint. 2021-11-17 09:33:53 -07:00
InKryption
9e757e6433 glfw: reorganize Window.Attrib to be in the same style as Window.Hint 2021-11-17 09:33:53 -07:00
InKryption
70c7da4ea5 glfw: make glfw.Cursor.Shape public
Following a similar change made to types in 'Window.zig'
2021-11-16 19:33:24 -07:00
Silver
673ce14acf glfw: remove [*c] pointers from api and return lengthed strings when possible 2021-11-16 07:12:02 -07:00
InKryption
28a0aebd95
glfw: window hints rework (#71)
* glfw: make comments into doc comments
* glfw: Publicize Window.CursorPos, Window.Size, Window.Pos, and Window.FrameSize
* glfw: Make enum value name the same format as other enum value names
* glfw: Window hints rework patch
* glfw: Relegate `Window.hint` to testing; move it down to just above the tests to reflect this, add doc comment line
* glfw: handle error `Error.InvalidEnum` explicitly, for clear error message in this unlikely edge case
* glfw: instate `Hint.context_no_error` as a hint, as it actually is specified to be a Window creation hint by the docs, and affirm removal of `Hint.context_revision`, which isn't.
The docs don't seem to specify a default value for `Hints.context_no_error` to take on, so we could set it based on `std.debug.runtime_safety` like this.
* glfw: default `context_no_error` to `false`, and added a note of caution about its usage as suggested.
* glfw: Inline enum values of `ClientApi`, `ContextCreationApi`, `ContextRobustness`, `ContextReleaseBehavior`, and `OpenGlProfile` from consts.zig, and remove the now unused constants (replaced by aformentioned enum values).
* glfw: Reference `Window.Hint` enum instead of `Window.Hints` struct to ensure fields are the same
* glfw: add comment explaining default values of `Window.Hints`
* glfw: change `OpenGlProfile` to `OpenGLProfile` based on established naming convention
* glfw: Update actual declaration of `OpenGLProfile`
* glfw: call `Window.defaultHints` after window creation, not before
* glfw: remove 'consts.zig', and move `dont_care` directly into 'main.zig'; fix anything referencing it.
* glfw: put `Window.defaultHints` into defer statement to handle cleanup in all paths
* glfw: move `Hint.focused` to match position of `Hints.focused`
* glfw: do 'zig fmt glfw/src'
* glfw: Cull `Window.Hint` comments, polish remaining; match order entirely according to current GLFW docs
* glfw: Change `Window.Hints.*Api` to `Window.Hints.*API`

Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-15 18:41:16 -07:00
Ali Chraghi
50719f5347 glfw: fix typo prevents building for Wayland 2021-11-15 17:49:13 -07:00
Stephen Gutekanst
fd703e98e4 glfw: update setIcon hotfix for undefined behavior
See https://github.com/GLFW/glfw/pull/1986

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-16 00:22:45 +00:00
Silver
82a9cf616d glfw: patch more undefined behaviour
See glfw/glfw#1989
2021-11-15 16:22:39 -07:00
Ali Chraghi
83854e27a6 Update README.md 2021-11-15 16:14:38 -07:00
InKryption
e486794be3 glfw: Make enum value name the same format as other enum value names 2021-11-15 15:37:07 -07:00
InKryption
eef166e90b glfw: Publicize Window.CursorPos, Window.Size, Window.Pos, and Window.FrameSize 2021-11-15 15:37:07 -07:00
InKryption
2214e91ad5 glfw: make comments into doc comments 2021-11-15 15:37:07 -07:00
InKryption
220c285798 glfw: Update readme to reflect changes made to glfw.init 2021-11-10 11:42:24 -07:00
InKryption
f00367e696 glfw: Update tests in all other files to reflect changes made to glfw.init 2021-11-10 11:42:24 -07:00
InKryption
e9175fb9f1 glfw: change init function to accept hints as paramaters via new InitHints struct which has default field values reflecting the default values specified by GLFW current documentation, privatize hint-setting wrapper API, and update tests 2021-11-10 11:42:24 -07:00
Stephen Gutekanst
c4ecd49545 glfw: inform in PR template to send all PRs to main repository
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-07 20:57:31 -07:00
Stephen Gutekanst
5aee3671dd glfw: send pull requests to the main repository to avoid merge conflicts
When changes are merged to both hexops/mach and hexops/mach-glfw, we get a conflict
which is difficult to resolve with `git subtree`, particularly because we don't want
to squash commits for either repository (we prefer to maintain the full commit history
in both repos.)

Instead, require that all pull requests be sent to the main hexops/mach repository.
That's not as nice, I admit, but should be pretty easy to handle (literally just copy
changes over) and will ensure we can always keep both repos in sync easily and without
conflict.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-07 20:51:16 -07:00
Noora Heinsuo
0d84c25938 Fix code example (#1) 2021-11-07 18:43:38 -07:00
Stephen Gutekanst
9f906cfd94
glfw: fix linking difference between sysroot and non-sysroot (#63)
This effectively gives us the dependencies we need in any case, and works around ziglang/zig#10103

Importantly, this removes a blocker for landing WebGPU support in hexops/mach#62

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-05 12:20:24 -07:00
Stephen Gutekanst
9bc9984930 glfw: hot patch undefined behavior in GLFW that went unnoticed 6+ years
Upstream pull request: https://github.com/glfw/glfw/pull/1986

Article: https://devlog.hexops.com/2021/perfecting-glfw-for-zig-and-finding-undefined-behavior

Fixes hexops/mach#20

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 11:50:09 -07:00
Stephen Gutekanst
61e2b38250 glfw: add Vulkan example to README
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 01:14:46 -07:00
Stephen Gutekanst
6b9c28cec1 glfw: zig fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 01:00:56 -07:00
Stephen Gutekanst
c16d6bf615 glfw: improve ABI compatability with zig-vulkan library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 01:00:02 -07:00
Stephen Gutekanst
e0cf70f045 glfw: expose system SDK build options
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 21:47:48 -07:00