Skip to content

Add Wayland/EGL support - #124

Draft
Schievel1 wants to merge 30 commits into
scottdraves:masterfrom
Schievel1:wayland_egl
Draft

Schievel1 wants to merge 30 commits into
scottdraves:masterfrom
Schievel1:wayland_egl

Conversation

@Schievel1

@Schievel1 Schievel1 commented Oct 17, 2024

Copy link
Copy Markdown
Contributor

This adds wayland support and rendering via EGL instead of GLX.

Adds configure flags —with-x11 and —with-wayland.
If built with both, it detects the environ variable WAYLAND_DISPLAY at Startup and if found it starts as a wayland surface. Otherwise it starts as X11 window and renders with GLX as before.
—with-x11 is set by default, switching it off only drops the dependency on Xrender (yet).
—with-wayland adds the configure flag —with-libdecor and a dependency on libxkbcommon. —with-libdecor adds a dependency on libdecor. Libdecor is used to draw client side decorations if the compositor doesn’t support server side decorations. Without libdecor electric sheep starts without window decorations if the compositor does not support server side decorations.

When running as a wayland client it is possible to direct the output to wlr_layer_shell and run electric sheep as an animated background. For this set environment variable ELECTRICSHEEP_BACKGROUND. (Maybe going to put this in config GUI or via startup flag)

Double click to toggle full screen (if compositor is ok with it). Otherwise it uses the same key binds like electric sheep on X11.

--with-wayland adds dependencies dev-libs/wayland, media-libs/libglvnd (needed for wayland/EGL output), x11-libs/libxkbcommon and build dependency dev-util/wayland-scanner
--with-libdecor adds dependency gui-libs/libdecor (needed for client side decorations)

Since freeglut has no functioning wayland build (see freeglut/freeglut#72, freeglut/freeglut#141), xwayland is still needed for Elecritsheep to function properly, even when completely on wayland. (Will show Unable to open display '' when display variable is not set, see freeglut/freeglut#51)

  • test configure flags and desired effect on dependencies
  • currently this is rudimentary output handling. If made full screen it always goes full screen on the first output wayland finds. -> does not matter, when started in compositor the compositor handles this.
  • double tap with touch should toggle full screen as well as mouse
  • add wayland protocol extension using Autotools and wayland-scanner instead of putting in the sources manually -> will add build-dep on dev-util/wayland-scanner
  • proper handling of mouse
  • handling of touch (maybe double touch = toggle fullscreen) (DONE but untested because no device)
  • setup wlr_layer_shell glviewport porperly
  • make work with swaylock-plugin to use as screensaver
  • write some instruction for usage with wayland, libdecor, wlr_layer_shell
  • needs some major clean up of the code in egl.cpp, egl.h

Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
future me: make sure you have videos in ~/.electricsheep/content/mpeg.
Sometimes it takes ages to download those

Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
server side or using libdecor
adds --with-libdecor configure flag

Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
disabled fullscreen for now

Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
@OtterFlip

Copy link
Copy Markdown

Thanks for doing this! How stable is it on Wayland? I'm gonna be switching from X11 to Wayland and I'd like to bring my flock with me.

@Schievel1

Copy link
Copy Markdown
Contributor Author

Thanks for doing this! How stable is it on Wayland? I'm gonna be switching from X11 to Wayland and I'd like to bring my flock with me.

Can't complain about stability, but the problem here is that you don't have a proper screensaver program. Screenlocking works different on wayland, see https://www.jwz.org/blog/2023/09/wayland-and-screen-savers/. (take it with a grain of salt though. After all it's 2 years old.)
I've been experimenting with https://github.com/mstoeckl/swaylock-plugin but it's kind of hacky still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants