The backend, decoration and resize-logging switches were only used
while working on this, and undocumented ones should not stay:
- VOXEL_WINDOW_BACKEND: the backend is still chosen by WAYLAND_DISPLAY,
and GLFW is used when it is not set;
- VOXEL_DECORATIONS: own decorations are always enabled when the
compositor provides none;
- VOXEL_LOG_RESIZE: the resize statistics are removed together with the
counters they needed.
WaylandDecorations.cpp replaces WaylandBar.cpp: drawing moved to the
engine, the file only holds the decoration behaviour now.
The backend sources live in window/wayland and were picked up by the
global source glob, so a build with VOXELENGINE_WAYLAND=OFF (and any
non-Linux build, where the option is skipped entirely) tried to compile
them and failed on the generated protocol headers.
They are now collected separately and added to the target only when the
backend is enabled.
Also restores the CRLF line endings of Engine.cpp, GUI.hpp and
input.cpp, which were rewritten with LF and made their diffs look like
whole-file rewrites.
The bar used to be drawn by the Wayland backend with its own shader,
bitmap font and textures, straight into the engine's GL frame. That
leaked GL state (the batch caches bound textures, so the engine kept
sampling the backend texture and all text turned into solid white
rectangles) and it duplicated fonts and styling.
Now the backend only owns the behaviour: hit zones, cursor shapes,
click interception and the compositor requests (move, resize,
minimize, maximize/restore, close). The bar itself is drawn by the
engine in WindowBar.cpp through the regular Batch2D/Font path, so it
looks like the rest of the UI.
Window gained getTitle(), getDecorationHeight() and
getDecorationHoveredButton(); GLFW keeps the defaults, so X11 and
Windows are unaffected. The backend's decoration drawing (bitmap font,
shader, quad batches) is removed: WaylandBar.cpp went from 630 to 140
lines.
Fixes found while debugging:
- GlStateGuard was defined but never used after the file split, so the
stretched frame left its texture bound and broke text rendering after
a window mode change; it is now applied around the cache capture and
the stretched frame;
- takeScreenshot() now reads the front buffer and restores the read
buffer afterwards.
WaylandWindow.cpp kept the window class with all methods defined in
place, the decorations, the free event listeners and the initialization
in one file. Now:
- WaylandWindow.hpp: the class declaration;
- WaylandWindow.cpp: surface, EGL, resize and frame pacing;
- WaylandBar.cpp: the window decorations (bar, font, buttons, dragging,
edge resizing);
- WaylandListeners.cpp/.hpp: the free Wayland event handlers;
- WaylandInit.cpp: wayland_window_initialize.
No functional change.
WaylandWindow.cpp held the protocol bindings, the shared compositor
state, the input implementation, the window itself, the free event
listeners and the initialization code in one 2400-line file.
Moved out of it:
- WaylandCommon.hpp/.cpp: shared compositor state, the display event
loop, keysym mapping and the window logger;
- WaylandInput.hpp: the input implementation (keyboard, clipboard,
cursors, key repeat).
No functional change.
Wayland support was missing a proper windowing layer: the GLFW backend
leaves the known platform gaps (cursor themes, window icon, window
position, fullscreen output selection).
The new backend talks to the compositor directly:
- xdg-shell, EGL, xkbcommon (keyboard, repeat, layout) instead of GLFW;
- cursors through wp_cursor_shape_manager_v1, so no cursor theme lookup
is required and no "standard cursor shape unavailable" errors appear;
- window icon and title are drawn by the engine itself, since Wayland
has no window icon protocol and GNOME provides no server-side
decorations;
- fullscreen requests the current output (set_fullscreen with NULL), so
the window no longer jumps to another monitor;
- interactive resize presents a cached frame scaled to the new size
while the pointer is down and refreshes the real frame when the drag
pauses, keeping the window glued to the cursor.
libdecor is not used: libdecor_frame_commit() redraws the whole
decoration and acks the configure in the same call, and mutter sends
200-330 configures per second during an interactive resize, so the
decoration was redrawn hundreds of times per second (measured: 2 s of
work per second, loop stalls up to 6 s). The decorations are drawn by
the engine instead, which measured 2.3 ms average configure-to-present
latency during a real drag.
GLFW stays the backend for X11 and Windows; VOXEL_WINDOW_BACKEND=x11
forces it on Wayland sessions.
reload_module loaded the new module code with the global environment,
while require runs modules in their pack environment. After reload,
PACK_ID and other pack globals were nil in the module.
src/CMakeLists.txt requires OpenSSL 3.0 (Crypto) since the crypto
library was added, but the README install commands did not list it,
so configuring on a clean system fails with "Could NOT find OpenSSL".
CI workflows and the Dockerfile already install libssl-dev.