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
This commit is contained in:
Norman Feske 2024-10-22 12:20:48 +02:00 committed by Christian Helmuth
parent 7e9c1ca3ca
commit f30bbb1472
2 changed files with 9 additions and 1 deletions

View File

@ -203,7 +203,12 @@ class Nitpicker::Capture_session : public Session_object<Capture::Session>
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

View File

@ -292,6 +292,9 @@ class Nitpicker::Capture_root : public Root_component<Capture_session>
},
[&] { session.apply_policy(Policy::blocked()); }); });
}
_sessions.for_each([&] (Capture_session &session) {
session.screen_size_changed(); });
}
/**