summaryrefslogtreecommitdiffhomepage
path: root/packages/kernel/src/server.cpp
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-15 20:04:03 +0900
committerAdam Malczewski <[email protected]>2026-06-15 20:04:03 +0900
commit143cb713b685a9089e85c90a932fb79efa606dc6 (patch)
tree42958170e49eedca587c012717c12bc4021880c1 /packages/kernel/src/server.cpp
parentdb9753e6f42e43c08c43b848bc865aae97aa1655 (diff)
downloadunbox-143cb713b685a9089e85c90a932fb79efa606dc6.tar.gz
unbox-143cb713b685a9089e85c90a932fb79efa606dc6.zip
kernel: screenshot protocols + arbitrary-image decoding + input-transparent surfaces
Three additive, kernel-internal capabilities (no extension-facing signature changes beyond the documented UiSurfaceSpec field + SurfaceElement-unrelated probes): - Screenshots (grim): create wlr_screencopy_manager_v1 + wlr_xdg_output_manager_v1 in init() alongside the existing compositor/data-device globals (policy-free plumbing; wlroots wires them to the kernel-owned outputs/renderer). The captured image is the standard wlr_scene_output_commit composite, so RML-composited documents (scene-buffer nodes) are captured correctly. wlr.hpp gains the two headers (static-blanking re-audited inert). - Arbitrary raster image decode: vendor stb_image (single-header, public domain; warnings isolated to its own warning_level=0 TU) and extend the RMLUi RenderInterface LoadTexture (was uncompressed-TGA-only) to decode PNG/JPEG/BMP/ GIF/TGA via stbi_load_from_memory (RGBA, no BGR swizzle), falling back to the legacy TGA path. A SubstrateSystemInterface JoinPath override stops RmlUi stripping the leading '/' of an absolute source during URL resolution, so both <img src='/abs'> and decorator: image('/abs') load the same file. Deterministic ui_pixel readback tests (<img> + decorator paths, red/blue PNG fixtures). - input-transparent ui surfaces: UiSurfaceSpec gains 'bool input_transparent' (default false). When true the surface still composites but is skipped by the press-ownership hit test, so it never steals pointer/touch from windows above it -- required for a full-screen background (wallpaper). Deterministic seam test proves a transparent surface does not consume a press while an opaque one does.
Diffstat (limited to 'packages/kernel/src/server.cpp')
-rw-r--r--packages/kernel/src/server.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/kernel/src/server.cpp b/packages/kernel/src/server.cpp
index d4f47c8..4701a2a 100644
--- a/packages/kernel/src/server.cpp
+++ b/packages/kernel/src/server.cpp
@@ -161,14 +161,15 @@ void Server::ui_route_pointer_motion_for_test(double lx, double ly, unsigned int
}
}
-void Server::ui_route_pointer_button_for_test(double lx, double ly, bool pressed,
- unsigned int time_msec) {
+auto Server::ui_route_pointer_button_for_test(double lx, double ly, bool pressed,
+ unsigned int time_msec) -> bool {
if (impl_->substrate != nullptr) {
// A button needs a hover first (the cursor is already at (lx,ly) on a real
// seat); feed a motion so the substrate's pick is current, then the button.
impl_->substrate->route_pointer_motion(lx, ly, time_msec);
- (void)impl_->substrate->route_pointer_button(lx, ly, pressed, time_msec);
+ return impl_->substrate->route_pointer_button(lx, ly, pressed, time_msec);
}
+ return false;
}
void Server::ui_route_touch_down_for_test(int id, double lx, double ly, unsigned int time_msec) {
@@ -352,6 +353,15 @@ void Server::Impl::init() {
}
output_layout = require(wlr_output_layout_create(display), "wlr_output_layout");
+
+ // Policy-free Wayland globals for screenshot capability (e.g. grim).
+ // wlr_screencopy_manager_v1 lets clients capture output framebuffers via the
+ // wlr-screencopy protocol; wlr_xdg_output_manager_v1 advertises logical
+ // output names and geometry so clients can select outputs by name. Both are
+ // owned by the wl_display (destroyed with it) — no stored pointer needed.
+ wlr_screencopy_manager_v1_create(display);
+ wlr_xdg_output_manager_v1_create(display, output_layout);
+
new_output.connect(backend->events.new_output, [this](void* data) {
handle_new_output(static_cast<wlr_output*>(data));
});