swaywm / go-wlroots Goto Github PK
View Code? Open in Web Editor NEWGo binding for wlroots
License: MIT License
Go binding for wlroots
License: MIT License
# github.com/swaywm/go-wlroots/wlroots
In file included from wlroots.go:25,
from _cgo_export.c:4:
/usr/include/wlr/types/wlr_surface.h:1:2: warning: #warning "wlr/types/wlr_surface.h has been deprecated and will be removed in the future. Use wlr/types/wlr_compositor.h and wlr/types/wlr_subcompositor.h." [-Wcpp]
1 | #warning "wlr/types/wlr_surface.h has been deprecated and will be removed in the future. Use wlr/types/wlr_compositor.h and wlr/types/wlr_subcompositor.h."
| ^~~~~~~
# github.com/swaywm/go-wlroots/wlroots
In file included from wlroots/wlroots.go:25:
/usr/include/wlr/types/wlr_surface.h:1:2: warning: #warning "wlr/types/wlr_surface.h has been deprecated and will be removed in the future. Use wlr/types/wlr_compositor.h and wlr/types/wlr_subcompositor.h." [-Wcpp]
1 | #warning "wlr/types/wlr_surface.h has been deprecated and will be removed in the future. Use wlr/types/wlr_compositor.h and wlr/types/wlr_subcompositor.h."
| ^~~~~~~
# github.com/swaywm/go-wlroots/wlroots
wlroots/wlroots.go:197:30: not enough arguments in call to (_Cfunc_wlr_xdg_shell_create)
have (*_Ctype_struct_wl_display)
want (*_Ctype_struct_wl_display, _Ctype_uint)
wlroots/wlroots.go:258:96: cannot use _cgo0 (variable of type *_Ctype_struct_wlr_xdg_surface) as type *_Ctype_struct_wlr_xdg_toplevel in argument to _Cfunc_wlr_xdg_toplevel_set_activated
wlroots/wlroots.go:262:62: cannot use _Ctype_uint32_t(width) (value of type _Ctype_uint) as type _Ctype_int in variable declaration
wlroots/wlroots.go:262:81: cannot use _Ctype_uint32_t(height) (value of type _Ctype_uint) as type _Ctype_int in variable declaration
wlroots/wlroots.go:262:82: cannot use _cgo0 (variable of type *_Ctype_struct_wlr_xdg_surface) as type *_Ctype_struct_wlr_xdg_toplevel in argument to _Cfunc_wlr_xdg_toplevel_set_size
wlroots/wlroots.go:266:88: cannot use _cgo0 (variable of type *_Ctype_struct_wlr_xdg_surface) as type *_Ctype_struct_wlr_xdg_toplevel in argument to _Cfunc_wlr_xdg_toplevel_set_tiled
wlroots/wlroots.go:270:71: cannot use _cgo0 (variable of type *_Ctype_struct_wlr_xdg_surface) as type *_Ctype_struct_wlr_xdg_toplevel in argument to _Cfunc_wlr_xdg_toplevel_send_close
wlroots/wlroots.go:574:73: cannot use _cgo1 (variable of type *_Ctype_struct_wlr_input_device) as type *_Ctype_struct_wlr_keyboard in argument to _Cfunc_wlr_seat_set_keyboard
wlroots/wlroots.go:940:22: event.time_msec undefined (type *_Ctype_struct_wlr_event_keyboard_key has no field or method time_msec)
wlroots/wlroots.go:940:47: event.keycode undefined (type *_Ctype_struct_wlr_event_keyboard_key has no field or method keycode)
wlroots/wlroots.go:940:47: too many errors
To be clear, the window in question is the one owned by the wayland backend, rather than a client window.
This results in memory leaks.
The fix is to use runtime.SetFinalizer
(see e.g. https://github.com/emersion/go-tsm/blob/master/vte.go#L47).
Hi @alexbakker,
My friend and I just came across go-wlroots today, and we just wanted to say we are quite impressed with what you've managed to implement thus far. It is really exciting to see a bare bones Wayland compositor implemented in Go, that is still useful.
When we tried to build the project, we ran into a minor build error (at rev e84b42a):
# github.com/swaywm/go-wlroots/wlroots
wlroots/wlroots.go:754:21: too many arguments in call to _Cfunc_wlr_output_commit
have (*_Ctype_struct_wlr_output, nil, nil)
want (*_Ctype_struct_wlr_output)
wlroots/wlroots.go:814:19: m.p.flags undefined (type *_Ctype_struct_wlr_output_mode has no field or method flags)
make: *** [Makefile:6: tinywl] Error 2
I have wlroots v0.7.0 installed.
$ pacman -Q wlroots
wlroots 0.7.0-1
Wish you a really lovely start of the autumn and can't state how excited I am to have found this project of yours!
Cheerful regards,
Robin & Daniel
has the sway team abandoned go-wlroots?
It would be a more idiomatic API to use channels to pass events like OnNewInput and OnNewOutput. I'm not 100% sure how to would be implemented but it should probably be function that return a channel and the function itself will register a callback, something like that:
func (b Backend) NewOutputChan() chan Output {
var c chan Output
b.OnNewOutput(func(o Output) {
c <- o
})
return c
}
Whenever I build i have some errors thrown
mkdir -p build/bin wayland-scanner private-code /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml wlroots/xdg-shell-protocol.c wayland-scanner server-header /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml wlroots/xdg-shell-protocol.h go build -o build/bin/tinywl github.com/swaywm/go-wlroots/cmd/tinywl In file included from _cgo_export.c:4: log.go: In function '_wlr_log_inner_cb': log.go:14:3: warning: implicit declaration of function 'vasprintf'; did you mean 'vsprintf'? [-Wimplicit-function-declaration]
this is on a fresh arch install with wlroots, wayland, wayland protocols, and go installed.
Quoting the official release notes:
To migrate from the old API to the new one:
Replace wlr_output_make_current calls with wlr_output_attach_render
Replace wlr_output_swap_buffers calls with wlr_output_set_damage and wlr_output_commit
Replace wlr_output_damage_make_current calls with wlr_output_damage_attach_render
Replace wlr_output_damage_swap_buffers with wlr_output_set_damage and wlr_output_commit
Replace wlr_output.needs_swap with wlr_output.needs_frame
Replace wlr_output.events.swap_buffers with wlr_output.events.precommit
This applies at least to
and maybe some others.
Would be nice if this supported Go modules instead of being a legacy-style project
It would be great to comment each function in go-wlroots and export it as godoc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.