@@ -25,7 +25,7 @@ use crate::{
2525 OutputExt , PointExt , PointGlobalExt , PointLocalExt , RectExt , RectLocalExt , SeatExt ,
2626 } ,
2727 wayland:: protocols:: {
28- image_source :: ImageSourceData ,
28+ image_capture_source :: ImageCaptureSourceData ,
2929 screencopy:: {
3030 delegate_screencopy, BufferConstraints , CursorSession , DmabufConstraints , Frame ,
3131 ScreencopyHandler , ScreencopyState , Session ,
@@ -44,23 +44,26 @@ impl ScreencopyHandler for State {
4444 & mut self . common . screencopy_state
4545 }
4646
47- fn capture_source ( & mut self , source : & ImageSourceData ) -> Option < BufferConstraints > {
47+ fn capture_source ( & mut self , source : & ImageCaptureSourceData ) -> Option < BufferConstraints > {
4848 match source {
49- ImageSourceData :: Output ( weak) => weak
49+ ImageCaptureSourceData :: Output ( weak) => weak
5050 . upgrade ( )
5151 . and_then ( |output| constraints_for_output ( & output, & mut self . backend ) ) ,
52- ImageSourceData :: Workspace ( handle) => {
52+ ImageCaptureSourceData :: Workspace ( handle) => {
5353 let shell = self . common . shell . read ( ) . unwrap ( ) ;
5454 let output = shell. workspaces . space_for_handle ( & handle) ?. output ( ) ;
5555 constraints_for_output ( output, & mut self . backend )
5656 }
57- ImageSourceData :: Toplevel ( window) => {
57+ ImageCaptureSourceData :: Toplevel ( window) => {
5858 constraints_for_toplevel ( window, & mut self . backend )
5959 }
6060 _ => None ,
6161 }
6262 }
63- fn capture_cursor_source ( & mut self , _source : & ImageSourceData ) -> Option < BufferConstraints > {
63+ fn capture_cursor_source (
64+ & mut self ,
65+ _source : & ImageCaptureSourceData ,
66+ ) -> Option < BufferConstraints > {
6467 let size = if let Some ( ( geometry, _) ) = self
6568 . common
6669 . shell
@@ -84,7 +87,7 @@ impl ScreencopyHandler for State {
8487
8588 fn new_session ( & mut self , session : Session ) {
8689 match session. source ( ) {
87- ImageSourceData :: Output ( weak) => {
90+ ImageCaptureSourceData :: Output ( weak) => {
8891 let Some ( mut output) = weak. upgrade ( ) else {
8992 session. stop ( ) ;
9093 return ;
@@ -98,7 +101,7 @@ impl ScreencopyHandler for State {
98101
99102 output. add_session ( session) ;
100103 }
101- ImageSourceData :: Workspace ( handle) => {
104+ ImageCaptureSourceData :: Workspace ( handle) => {
102105 let mut shell = self . common . shell . write ( ) . unwrap ( ) ;
103106 let Some ( workspace) = shell. workspaces . space_for_handle_mut ( & handle) else {
104107 session. stop ( ) ;
@@ -112,7 +115,7 @@ impl ScreencopyHandler for State {
112115 } ) ;
113116 workspace. add_session ( session) ;
114117 }
115- ImageSourceData :: Toplevel ( mut toplevel) => {
118+ ImageCaptureSourceData :: Toplevel ( mut toplevel) => {
116119 let size = toplevel. geometry ( ) . size . to_physical ( 1 ) ;
117120 session. user_data ( ) . insert_if_missing_threadsafe ( || {
118121 Mutex :: new ( SessionUserData :: new ( OutputDamageTracker :: new (
@@ -123,7 +126,7 @@ impl ScreencopyHandler for State {
123126 } ) ;
124127 toplevel. add_session ( session) ;
125128 }
126- ImageSourceData :: Destroyed => unreachable ! ( ) ,
129+ ImageCaptureSourceData :: Destroyed => unreachable ! ( ) ,
127130 }
128131 }
129132 fn new_cursor_session ( & mut self , session : CursorSession ) {
@@ -160,7 +163,7 @@ impl ScreencopyHandler for State {
160163 } ) ;
161164
162165 match session. source ( ) {
163- ImageSourceData :: Output ( weak) => {
166+ ImageCaptureSourceData :: Output ( weak) => {
164167 let Some ( mut output) = weak. upgrade ( ) else {
165168 session. stop ( ) ;
166169 return ;
@@ -190,7 +193,7 @@ impl ScreencopyHandler for State {
190193
191194 output. add_cursor_session ( session) ;
192195 }
193- ImageSourceData :: Workspace ( handle) => {
196+ ImageCaptureSourceData :: Workspace ( handle) => {
194197 let mut shell = self . common . shell . write ( ) . unwrap ( ) ;
195198 let Some ( workspace) = shell. workspaces . space_for_handle_mut ( & handle) else {
196199 session. stop ( ) ;
@@ -222,7 +225,7 @@ impl ScreencopyHandler for State {
222225
223226 workspace. add_cursor_session ( session) ;
224227 }
225- ImageSourceData :: Toplevel ( mut toplevel) => {
228+ ImageCaptureSourceData :: Toplevel ( mut toplevel) => {
226229 let shell = self . common . shell . read ( ) . unwrap ( ) ;
227230 if let Some ( element) = shell. element_for_surface ( & toplevel) {
228231 if element. has_active_window ( & toplevel) {
@@ -245,13 +248,13 @@ impl ScreencopyHandler for State {
245248
246249 toplevel. add_cursor_session ( session) ;
247250 }
248- ImageSourceData :: Destroyed => unreachable ! ( ) ,
251+ ImageCaptureSourceData :: Destroyed => unreachable ! ( ) ,
249252 }
250253 }
251254
252255 fn frame ( & mut self , session : Session , frame : Frame ) {
253256 match session. source ( ) {
254- ImageSourceData :: Output ( weak) => {
257+ ImageCaptureSourceData :: Output ( weak) => {
255258 let Some ( mut output) = weak. upgrade ( ) else {
256259 session. stop ( ) ; // will fail the frame as well
257260 return ;
@@ -260,13 +263,13 @@ impl ScreencopyHandler for State {
260263 output. add_frame ( session, frame) ;
261264 self . backend . schedule_render ( & output) ;
262265 }
263- ImageSourceData :: Workspace ( handle) => {
266+ ImageCaptureSourceData :: Workspace ( handle) => {
264267 render_workspace_to_buffer ( self , session, frame, handle)
265268 }
266- ImageSourceData :: Toplevel ( toplevel) => {
269+ ImageCaptureSourceData :: Toplevel ( toplevel) => {
267270 render_window_to_buffer ( self , session, frame, & toplevel)
268271 }
269- ImageSourceData :: Destroyed => unreachable ! ( ) ,
272+ ImageCaptureSourceData :: Destroyed => unreachable ! ( ) ,
270273 }
271274 }
272275
@@ -296,12 +299,12 @@ impl ScreencopyHandler for State {
296299
297300 fn session_destroyed ( & mut self , session : Session ) {
298301 match session. source ( ) {
299- ImageSourceData :: Output ( weak) => {
302+ ImageCaptureSourceData :: Output ( weak) => {
300303 if let Some ( mut output) = weak. upgrade ( ) {
301304 output. remove_session ( session) ;
302305 }
303306 }
304- ImageSourceData :: Workspace ( handle) => {
307+ ImageCaptureSourceData :: Workspace ( handle) => {
305308 if let Some ( workspace) = self
306309 . common
307310 . shell
@@ -313,19 +316,19 @@ impl ScreencopyHandler for State {
313316 workspace. remove_session ( session)
314317 }
315318 }
316- ImageSourceData :: Toplevel ( mut toplevel) => toplevel. remove_session ( session) ,
317- ImageSourceData :: Destroyed => unreachable ! ( ) ,
319+ ImageCaptureSourceData :: Toplevel ( mut toplevel) => toplevel. remove_session ( session) ,
320+ ImageCaptureSourceData :: Destroyed => unreachable ! ( ) ,
318321 }
319322 }
320323
321324 fn cursor_session_destroyed ( & mut self , session : CursorSession ) {
322325 match session. source ( ) {
323- ImageSourceData :: Output ( weak) => {
326+ ImageCaptureSourceData :: Output ( weak) => {
324327 if let Some ( mut output) = weak. upgrade ( ) {
325328 output. remove_cursor_session ( session) ;
326329 }
327330 }
328- ImageSourceData :: Workspace ( handle) => {
331+ ImageCaptureSourceData :: Workspace ( handle) => {
329332 if let Some ( workspace) = self
330333 . common
331334 . shell
@@ -337,8 +340,10 @@ impl ScreencopyHandler for State {
337340 workspace. remove_cursor_session ( session)
338341 }
339342 }
340- ImageSourceData :: Toplevel ( mut toplevel) => toplevel. remove_cursor_session ( session) ,
341- ImageSourceData :: Destroyed => unreachable ! ( ) ,
343+ ImageCaptureSourceData :: Toplevel ( mut toplevel) => {
344+ toplevel. remove_cursor_session ( session)
345+ }
346+ ImageCaptureSourceData :: Destroyed => unreachable ! ( ) ,
342347 }
343348 }
344349}
0 commit comments