Complete GLFW v3.4 integration and fix TODOs (supersedes #400)#414
Complete GLFW v3.4 integration and fix TODOs (supersedes #400)#414alexballas wants to merge 26 commits intogo-gl:masterfrom
Conversation
- Adds missing window hints and options added in GLFW v3.4 - Adds standard cursors added in v3.4 - Maps `GLFW_FEATURE_UNAVAILABLE` and `GLFW_FEATURE_UNIMPLEMENTED` ErrorCodes so they cleanly return without panicking the application. - Fixes C compiler warnings about `_GNU_SOURCE` being redefined by protecting the definition.
|
Some more items:
|
Add CI workflows, drop Travis, align v3.3/go.mod updates, and include v3.4 changelog items in README.
|
Brought this PR up to date with the latest go-gl commits. Everything should be in place now. |
|
I tested this on my wayland system (KDE, debian 13.4) with opengl ES 3.2. It seems to work fine, but I noticed the window doesn't actually render until the first SwapBuffers call. With x11, it just shows a black window, but in wayland there's no actual window, just the app's icon in the taskbar. Not a huge issue, since I can just add a SwapBuffers call right after I make the window. Also, I see the window isn't the size I asked for, but about 30% bigger in each dimension. Is this some hidpi thing? I am on a 4k 32" monitor |
|
Hello @hackbar What you describe matches typical Wayland behavior: unlike X11, a compositor may not show the toplevel until the client has attached and committed a real buffer, so seeing only the app icon until the first SwapBuffers is not surprising. This is also reflected in the vendored GLFW 3.4 Wayland code. In The size difference is most likely HiDPI / compositor scaling. In GLFW 3.4, window size and framebuffer size are separate: the window size is in screen coordinates, while the framebuffer size can be scaled for HiDPI. Could you check what GLFW reports on your setup? If GetSize() matches the requested size, but GetFramebufferSize() is larger and GetContentScale() is above 1.0, then this is most likely HiDPI / compositor scaling on Wayland. If GetSize() itself is larger than requested, that would point to an actual sizing issue. Thanks, |
|
Hmm, it looks my GetSize and GetFramebuffer size match what I requested, and ContentScale is 1 in both dimensions. This doesn't seem to match the window size I'm getting, which is 1.25 times larger. This does match the scale I set in kde's settings. Setting that to 100% does give me the same windows size as I requested. So it seems like wayland is doing some kind of scaling for me automatically? Is this a thing, or is there any way to change the setting? |
|
Could you check one more thing on top of the previous printout: what does If native Wayland still reports |
|
GetPlatforms return 0x60003. Even after the first buffer swap it's showing the framebuffer and window are the same size (what I requested) and the scale is 1.0. I'll try to see how KDE scaling works. I'd imagine the kwin compositor does things the standard wayland way, but maybe it's doing something weird. |
|
Could you check whether the compositor is advertising the needed protocols? |
|
Yeah, it has both those extensions:
interface: 'wp_viewporter', version: 1, name:
6
interface: 'wp_fractional_scale_manager_v1', version: 1, name:
8
…On Sun, Mar 22, 2026 at 10:31 PM Alex Ballas ***@***.***> wrote:
*alexballas* left a comment (go-gl/glfw#414)
<#414 (comment)>
Could you check whether the compositor is advertising the needed protocols?
wayland-info | rg 'wp_fractional_scale_manager_v1|wp_viewporter'
—
Reply to this email directly, view it on GitHub
<#414?email_source=notifications&email_token=ABWSMC24JRNY3KRV5O7SHED4SDDZNA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJQHAYTCMZUG43KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4108113476>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWSMC2EIDTO6CFIZLH4JXT4SDDZNAVCNFSM6AAAAACWBD44RSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMBYGEYTGNBXGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
A good next check is whether KWin is actually sending the fractional-scale callback for the window (the second grep I sent). GLFW should request it, but GetContentScale() will stay at 1.0 unless the compositor replies with preferred_scale. If you run the test with WAYLAND_DEBUG=1, we can check whether GLFW sends get_fractional_scale and whether KWin sends preferred_scale back. |
|
Which tests? just printing out the window/framebuffer/scaling sizes? |
|
here's the logs for printing the sizes etc: https://pastebin.com/zP2gYkZt |
|
Is there anything else I can do to help test this? Other than than the scaling, which I don't really mind once I figured out what was happening (my app is primarily fullscreen), it's working well for me. |
|
I have been meaning to review this but I'm afraid that I have very little time for open source at the moment due to writing my Master's thesis. |
|
FWIW, I have been using this PR in https://cogentcore.org apps for a week or so without any issues on my macbook. Given how difficult it is to actually use the PR code from another package (because 3.4 doesn't exist in any package that go modules know about), I haven't tested on other platforms. And also given that using this requires changing the import paths, perhaps it makes sense at this point to fast-track the approval, and then plan to address any issues that come up later? |
|
Agree. Since this requires explicit import changes, it won’t break existing integrations by default. We can address edge cases as they arise. |
|
Yeah, I think that makes a lot of sense. |
|
Perhaps @dmitshur has more time to look at it? |
This PR finalizes the migration to GLFW v3.4. It resolves the long-standing blockers from #400 and completes the remaining tasks required for a stable release.
This PR completes the GLFW v3.4 integration. It resolves the build failures and Wayland-related panics that stalled previous efforts.
Key Updates:
Thanks to @Geo25rey for the great start on this. I've finished the remaining work, including fixing the Windows/BSD linker errors and implementing the hybrid Linux builds. @Jacalz and @dmitshur, I also resolved the _GNU_SOURCE warnings and added the missing 3.4 hints/error handling to prevent Wayland panics. Ready for review!
@andydotxyz fyi