File tree Expand file tree Collapse file tree 2 files changed +26
-20
lines changed Expand file tree Collapse file tree 2 files changed +26
-20
lines changed Original file line number Diff line number Diff line change
1
+ use cosmic_client_toolkit:: screencopy:: CaptureSession ;
2
+ use std:: {
3
+ pin:: Pin ,
4
+ task:: { Context , Poll } ,
5
+ } ;
6
+
7
+ // TODO wake stream when we get formats?
8
+ pub struct CursorStream {
9
+ // TODO formats
10
+ pub ( super ) capture_session : CaptureSession ,
11
+ }
12
+
13
+ impl futures:: stream:: Stream for CursorStream {
14
+ type Item = image:: RgbaImage ;
15
+
16
+ fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < image:: RgbaImage > > {
17
+ todo ! ( )
18
+ }
19
+ }
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ pub use cosmic_client_toolkit::screencopy::{CaptureSource, Rect};
53
53
54
54
use crate :: buffer;
55
55
56
+ mod cursor_stream;
56
57
mod gbm_devices;
57
58
mod toplevel;
58
59
mod workspaces;
@@ -243,28 +244,14 @@ impl Session {
243
244
receiver. await . unwrap ( )
244
245
}
245
246
246
- // XXX also need way to get formats?
247
- pub async fn capture_cursor_wl_buffer (
248
- & self ,
249
- buffer : & wl_buffer:: WlBuffer ,
250
- buffer_damage : & [ Rect ] ,
251
- ) -> Result < Option < Frame > , WEnum < FailureReason > > {
247
+ // Should only be called once
248
+ fn cursor_stream ( & self ) -> Option < cursor_stream:: CursorStream > {
252
249
let Some ( ( _, capture_session) ) = & self . 0 . capture_cursor_session else {
253
- return Ok ( None ) ;
250
+ return None ;
254
251
} ;
255
- let ( sender, receiver) = oneshot:: channel ( ) ;
256
- capture_session. capture (
257
- buffer,
258
- buffer_damage,
259
- & self . 0 . wayland_helper . inner . qh ,
260
- FrameData {
261
- frame_data : Default :: default ( ) ,
262
- sender : Mutex :: new ( Some ( sender) ) ,
263
- } ,
264
- ) ;
265
- self . 0 . wayland_helper . inner . conn . flush ( ) . unwrap ( ) ;
266
-
267
- receiver. await . unwrap ( ) . map ( Some )
252
+ Some ( cursor_stream:: CursorStream {
253
+ capture_session : capture_session. clone ( ) ,
254
+ } )
268
255
}
269
256
}
270
257
You can’t perform that action at this time.
0 commit comments