-
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
Fix build for wayland #212
Conversation
Fix build for wayland
Fixed it. I also removed the generate steps and added a generate script. This is only required for developers. I would update the wiki, if this pull request gets merged. |
The wayland developer wiki should be updated to following content if this pull request gets merged. Generating wayland source/header filesA helper script located at
|
TestingInstall the xorg-xeyes utility and run it with:
X11
Move the mouse over the window and the xeyes should move, because glfw uses X11. Wayland
Move the mouse over the window and the xeyes should not move, because glfw uses wayland. Codepackage main
import (
"log"
"runtime"
"time"
"github.com/go-gl/gl/v3.2-core/gl"
"github.com/r0l1/glfw/v3.2/glfw"
)
const (
winWidth = 400
winHeight = 500
fps = time.Second / 30
)
func init() {
runtime.LockOSThread()
}
func main() {
if err := glfw.Init(); err != nil {
log.Fatalln(err)
}
glfw.WindowHint(glfw.ContextVersionMajor, 3)
glfw.WindowHint(glfw.ContextVersionMinor, 2)
glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)
glfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)
win, err := glfw.CreateWindow(winWidth, winHeight, "Nuklear Demo", nil, nil)
if err != nil {
log.Fatalln(err)
}
win.MakeContextCurrent()
width, height := win.GetSize()
log.Printf("glfw: created window %dx%d", width, height)
if err := gl.Init(); err != nil {
log.Fatalln("opengl: init failed:", err)
}
gl.Viewport(0, 0, int32(width), int32(height))
for !win.ShouldClose() {
win.SwapBuffers()
glfw.PollEvents()
time.Sleep(fps)
}
} |
Works as intended for me. Though I get this error: PlatformError: Wayland: Focusing a window requires user interaction |
I have the same problem and after some research I found two possible causes: It seams, that glfw's wayland support has improved a lot in the new upcoming 3.3 release and that we'll have to wait for it's first public release. Nevertheless I suggest to add initial wayland support to this package as initial base for 3.3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't use Linux on desktop day to day, so I can't review this very thoroughly.
However, from a general look, I don't see any major issues (just minor things that aren't worth blocking the PR for). The changes are isolated to Wayland, and it currently doesn't work, so I don't have objections to moving forward with this.
LGTM.
Thanks @r0l1 and @thomasruiz for working on this, and @tapir for reviewing! |
Thanks for merging! Hope we'll have full wayland support in 3.3... |
@@ -24,8 +24,6 @@ | |||
// | |||
//======================================================================== | |||
|
|||
#define _GNU_SOURCE | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I'm reinstating _GNU_SOURCE here, which documents what you should do if you want to remove it again: bac7f0e
This is a work in progress pull request to get the wayland issue fixed as soon as possible.
This is based on #199 work.
Right now the build progress fails with:
Any hints how to fix this?
Thanks!