reference count capture (#209)

* reference count capture

Multiple captures can now be created at the same position.
Captures at the same position are reference counted.

* update testcase

will be required by #200 / #164
This commit is contained in:
Ferdinand Schober
2024-10-05 21:22:28 +02:00
committed by GitHub
parent ab1b45ff45
commit 5b1dc4ccf8
8 changed files with 270 additions and 238 deletions

View File

@@ -3,10 +3,7 @@ use std::task::Poll;
use async_trait::async_trait;
use futures_core::Stream;
use super::{
error::X11InputCaptureCreationError, Capture, CaptureError, CaptureEvent, CaptureHandle,
Position,
};
use super::{error::X11InputCaptureCreationError, Capture, CaptureError, CaptureEvent, Position};
pub struct X11InputCapture {}
@@ -18,11 +15,11 @@ impl X11InputCapture {
#[async_trait]
impl Capture for X11InputCapture {
async fn create(&mut self, _id: CaptureHandle, _pos: Position) -> Result<(), CaptureError> {
async fn create(&mut self, _pos: Position) -> Result<(), CaptureError> {
Ok(())
}
async fn destroy(&mut self, _id: CaptureHandle) -> Result<(), CaptureError> {
async fn destroy(&mut self, _pos: Position) -> Result<(), CaptureError> {
Ok(())
}
@@ -36,7 +33,7 @@ impl Capture for X11InputCapture {
}
impl Stream for X11InputCapture {
type Item = Result<(CaptureHandle, CaptureEvent), CaptureError>;
type Item = Result<(Position, CaptureEvent), CaptureError>;
fn poll_next(
self: std::pin::Pin<&mut Self>,