@@ -809,7 +809,7 @@ pub struct RecordingInfo {
809809enum CurrentRecordingTarget {
810810 Window {
811811 id : WindowId ,
812- bounds : LogicalBounds ,
812+ bounds : Option < LogicalBounds > ,
813813 } ,
814814 Screen {
815815 id : DisplayId ,
@@ -841,33 +841,55 @@ struct CurrentRecording {
841841async fn get_current_recording (
842842 state : MutableState < ' _ , App > ,
843843) -> Result < JsonValue < Option < CurrentRecording > > , ( ) > {
844+ tracing:: debug!( "get_current_recording called" ) ;
844845 let state = state. read ( ) . await ;
845846
846847 let ( mode, capture_target, status) = match & state. recording_state {
847- RecordingState :: None => return Ok ( JsonValue :: new ( & None ) ) ,
848- RecordingState :: Pending { mode, target } => ( * mode, target, RecordingStatus :: Pending ) ,
849- RecordingState :: Active ( inner) => (
850- inner. mode ( ) ,
851- inner. capture_target ( ) ,
852- RecordingStatus :: Recording ,
853- ) ,
848+ RecordingState :: None => {
849+ tracing:: debug!( "get_current_recording: state is None" ) ;
850+ return Ok ( JsonValue :: new ( & None ) ) ;
851+ }
852+ RecordingState :: Pending { mode, target } => {
853+ tracing:: debug!( "get_current_recording: state is Pending" ) ;
854+ ( * mode, target, RecordingStatus :: Pending )
855+ }
856+ RecordingState :: Active ( inner) => {
857+ tracing:: debug!( "get_current_recording: state is Active" ) ;
858+ (
859+ inner. mode ( ) ,
860+ inner. capture_target ( ) ,
861+ RecordingStatus :: Recording ,
862+ )
863+ }
854864 } ;
855865
856866 let target = match capture_target {
857- ScreenCaptureTarget :: Display { id } => CurrentRecordingTarget :: Screen { id : id. clone ( ) } ,
858- ScreenCaptureTarget :: Window { id } => CurrentRecordingTarget :: Window {
859- id : id. clone ( ) ,
860- bounds : scap_targets:: Window :: from_id ( id)
861- . ok_or ( ( ) ) ?
862- . display_relative_logical_bounds ( )
863- . ok_or ( ( ) ) ?,
864- } ,
865- ScreenCaptureTarget :: Area { screen, bounds } => CurrentRecordingTarget :: Area {
866- screen : screen. clone ( ) ,
867- bounds : * bounds,
868- } ,
867+ ScreenCaptureTarget :: Display { id } => {
868+ tracing:: debug!( "get_current_recording: target is Display" ) ;
869+ CurrentRecordingTarget :: Screen { id : id. clone ( ) }
870+ }
871+ ScreenCaptureTarget :: Window { id } => {
872+ let bounds =
873+ scap_targets:: Window :: from_id ( id) . and_then ( |w| w. display_relative_logical_bounds ( ) ) ;
874+ tracing:: debug!(
875+ "get_current_recording: target is Window, bounds={:?}" ,
876+ bounds
877+ ) ;
878+ CurrentRecordingTarget :: Window {
879+ id : id. clone ( ) ,
880+ bounds,
881+ }
882+ }
883+ ScreenCaptureTarget :: Area { screen, bounds } => {
884+ tracing:: debug!( "get_current_recording: target is Area" ) ;
885+ CurrentRecordingTarget :: Area {
886+ screen : screen. clone ( ) ,
887+ bounds : * bounds,
888+ }
889+ }
869890 } ;
870891
892+ tracing:: debug!( "get_current_recording: returning Some(CurrentRecording)" ) ;
871893 Ok ( JsonValue :: new ( & Some ( CurrentRecording {
872894 target,
873895 mode,
0 commit comments