From f30bbb1472b05c116bed37c93e97211c90c47df8 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 22 Oct 2024 12:20:48 +0200 Subject: [PATCH] nitpicker: restore Capture::Session::screen_size Since #5352, the 'screen_size' RPC function returns a rectangle clipped against the client's bounding box, which unfortunately prevents screen-capturing applications from determining the actual screen size. This patch restores the original behavior by clipping the panorama against client-specific constraints w/o clipping against the client's buffer size. Fixes #5365 --- repos/os/src/server/nitpicker/capture_session.h | 7 ++++++- repos/os/src/server/nitpicker/main.cc | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/repos/os/src/server/nitpicker/capture_session.h b/repos/os/src/server/nitpicker/capture_session.h index 722073fc90..c71f852b42 100644 --- a/repos/os/src/server/nitpicker/capture_session.h +++ b/repos/os/src/server/nitpicker/capture_session.h @@ -203,7 +203,12 @@ class Nitpicker::Capture_session : public Session_object Area screen_size() const override { - return Rect::intersect(_view_stack.bounding_box(), bounding_box()).area; + Rect const panorama = _view_stack.bounding_box(); + Rect const policy { _anchor_point(), + { .w = _policy.w.or_default(panorama.w()), + .h = _policy.h.or_default(panorama.h()) } }; + + return Rect::intersect(panorama, policy).area; } void screen_size_sigh(Signal_context_capability sigh) override diff --git a/repos/os/src/server/nitpicker/main.cc b/repos/os/src/server/nitpicker/main.cc index 2a42474734..2f5dfc9805 100644 --- a/repos/os/src/server/nitpicker/main.cc +++ b/repos/os/src/server/nitpicker/main.cc @@ -292,6 +292,9 @@ class Nitpicker::Capture_root : public Root_component }, [&] { session.apply_policy(Policy::blocked()); }); }); } + + _sessions.for_each([&] (Capture_session &session) { + session.screen_size_changed(); }); } /**