capture_session: detection of idle capture server

This patch enhances the Capture::Connection::Screen such that the
bounding box of the affected pixels can be tracked by the caller,
which can use this information to adjust its behavior to the
activity/inactivity of the capture server.

Issue #5344
This commit is contained in:
Norman Feske 2024-09-16 15:28:06 +02:00 committed by Christian Helmuth
parent 6d68d3297d
commit 3f1759a4d1

View File

@ -117,8 +117,10 @@ class Capture::Connection::Screen
void with_texture(auto const &fn) const { fn(_texture); }
void apply_to_surface(Surface<Pixel> &surface)
Rect apply_to_surface(Surface<Pixel> &surface)
{
Rect bounding_box { };
using Affected_rects = Session::Affected_rects;
Affected_rects const affected = _connection.capture_at(Capture::Point(0, 0));
@ -130,8 +132,13 @@ class Capture::Connection::Screen
surface.clip(rect);
Blit_painter::paint(surface, texture, Capture::Point(0, 0));
bounding_box = bounding_box.area.count()
? Rect::compound(bounding_box, rect)
: rect;
});
});
return bounding_box;
}
};